Announcement

Collapse
No announcement yet.

drawText bug?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • drawText bug?

    I have been working on some code that uses drawtextabsolute.
    I've run into a weird circumstance that I can't figure out.

    I keep getting a parameter 3 of drawtextabsolute is invalid error when I first launch esignal and have this study on my charts. It appears to get this error when the bars are first loaded on the chart. If I add the efs to an existing chart, this does not happen.

    it seems to have something to do with the formatPricenumber function.

    I call this function to convert my number to a string for printing on the chart. This helps especially in bonds.

    If I remove this function and just print the raw value, then I do not get the above error, but then I loose the functionality of formatpricenumber.

    Can anyone help me figure this one out?

    It seems that formatpricenumber might have a bug in it that returns a weird value during the first bar load on a new run of esignal? I tried to put a debugprintln in there to see what it was but it does not print it to the output window.

    Any suggestions.

    here's the line that is being printed.

    drawTextAbsolute(2, stopplot, pround(stopplot), Color.black, z, Text.BOLD | Text.FRAME | Text.VCENTER | Text.ONTOP, null, 10, "Pivot");

    the pround function is as follows:

    function pround(price)
    {var a,t;
    a=roundit(price);
    t=formatPriceNumber(a);
    return t;
    }

    roundit is my own rounding routine to round to the nearest tick, it returns a correct number so it is not the issue.

    thx

  • #2
    Hello philli4093,

    Your variable, stopplot, is probably not getting initialized with a valid number before you call pround(stopplot). Try adding some validation to stopplot before you make the drawText call.

    PHP Code:
    if (!isNaN(stopplot)) {
        
    drawTextAbsolute(2stopplotpround(stopplot), Color.blackzText.BOLD Text.FRAME Text.VCENTER Text.ONTOPnull10"Pivot");

    Jason K.
    Project Manager
    eSignal - an Interactive Data company

    EFS KnowledgeBase
    JavaScript for EFS Video Series
    EFS Beginner Tutorial Series
    EFS Glossary
    Custom EFS Development Policy

    New User Orientation

    Comment

    Working...
    X