Hello all, I hope you can assist.
I have a need to draw a signal on the chart, based on the latest candle. I only want to show one signal on the chart.
I’m using V11 and so can use IsLastBarUpdate to check I’m on the most recent bar.
e.g
IF IsLastBarUpdate > 1 THEN
DrawArrowDown(Barindex - 3, 20)
ENDIF
However as new bars are added to the chart, this leaves a trail of previous arrows on the chart, therefore I now test to check it’s not the opening second of the new bar in order to avoid drawing a history …
IF IsLastBarUpdate and CurrentSecond > 1 THEN
DrawArrowDown(Barindex - 3, 40)
ENDIF
This works fine ( I’ve attached code to demo this,and a screenshot, just set to 1 minute refresh and leave running for 2-3 minutes )
So far, so good BUT on a Monday morning in Europe when US stock market is closed ( e.g GME yesterday morning ! ), the CurrentSecond only returns 0, and therefore no arrow is drawn, until the market closes.
So, what;s my question ?
I’m using a workaround of testing the CurrentSecond in order to make my arrow only appear once. Should I expect CurrentSecond to return the current second time from my PC no matter the state of the market ? ( I think it should ). If not, how can I draw a single instance of a signal, on the chart, without a history appearing – even if the market is closed ?
I’ve attached a bit of sample code which shows both drawing methods and demonstrates the problem occurring, also a screenshot of the problem to save people having to load the code !!
Any help much appreciated, regards,
Bob