I am able to identify the opening tick of a new X-tick bar using the below code, but is there a way to store a value at this point in time?
With each new tick that arrives, the value of my indicator changes but I would like to compare it to the value at the bar open (which will be different from the previous bar close value).
As soon as the “NewBarOnChart” is false (from tick 2 onwards), I lose the opening value of my indicator. Can I somehow store it?
// -> Bar On Chart
CurrTime = CurrentTime + (10000 * TimeZoneAdjustment)
LastBarOnChart = (Date = Today)
LastBarOnChart = LastBarOnChart AND (CurrTime = OpenTime)
LastBarOnChart = LastBarOnChart AND (Time >= CurrTime)
NewBarOnChart = LastBarOnChart
NewBarOnChart = NewBarOnChart AND (Time = OpenTime)