Announcement

Collapse
No announcement yet.

Interesting sitiuation

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

  • Interesting sitiuation

    I usually have a routine I only run one time ti initialize variables.

    Recently, I added some drawTextAbsolute stmts to this routine and could not get the text to draw.

    if(start1==0){

    drawTextAbsolute( -26, pt2*100, "+"+(pt2*100).toFixed(0), Color.red, null, v|bb, "Comic Sans MS", 14, -55 );
    drawTextAbsolute( -26, pt8*100, (pt8*100).toFixed(0), Color.green, null, v|bb, "Comic Sans MS", 14, -66 );

    start1 = 1;

    }

    if I changed the IF stmt to

    if(start1==0&&getCurrentBarIndex()==0){

    the text would draw.

  • #2
    David:

    It's hard to say for sure by only looking at a code snippet but my guess is that this code will kick in when the very first bar is processed by the script (I use a similar initialization routine). If the pt2 variable (e.g., the Y coordinate in the drawLine call) is null at that point, then drawLineAbsolute will draw the assigned text at a price value of 0. Try it and then scroll down to a price of 0 and I think you might see it there.

    Chris

    Comment

    Working...
    X