Hi All,
Does someone know the trick which avoids drawing on the last bar ? It should be very easy, but I can’t find anything (also tried stuff around IsLastBarUpdate).
You see me drawing minutes above the bars. But the current (rightmost) bar repeats the minute of the previous bar (see the “08”). And, if I would be able to add an extra minute/count to that current bar, it would also be fine (even better; I want to show it correctly – or show nothing if it’s wrong).
Thanks !
Peter
Please post the code so I can get a better picture of what you want to be plotted or not.
// Apply to 1 minute Chharts.
//DefParam DrawOnLastBarOnly = true
DefParam CalculateOnLastBars = 1500
MyMinute = Minute - 1 // Because we need correction.
If MyMinute = -1 then
MyMinute = 59
endif
Once VerticalOffset = 0 // Would like a pixel offset here. ;-)
Once LastBarWritten = BarIndex
//If LastBarWritten <> BarIndex + 1 then
If MyMinute = MyMinute[1] then // This seems to work ?
MyMinuteReal = MyMinute + 1
else
MyMinuteReal = MyMinute
endif
DrawText (MyMinuteReal, barindex, high + VerticalOffset * 2, SansSerif, standard, 11)
//endif
LastBarWritten = BarIndex
Dummy = close
Return dummy
During the posting of this, I suddenly saw the light (??). This is in a static environment because markets are closed at this moment. So must check later today on a live market whether this works out for real (it could matter).
Replace line 24 with:
DrawText (MyMinuteReal[1], barindex-1, high[1] + VerticalOffset * 2, SansSerif, standard, 11)
Yes, thanks. I had that version too by means of a similar If as that I already use, around the DrawText. That (and yours) omits the drawing on the current bar. This is great for certain applications.
The one I showed indeed now works too and that is drawing the correct minute on the current bar, also when the market is live.