I'm working on something where a parameter depends on the time value of a chart.
Is there a way in code of accessing this value (whether it be 20 mins, 55 mins, 1729 seconds or any time value) so I can use it within an indicator?
Thanks in advance for any advice.
Added on edit:
I think I've found a way of doing this:
Time[0].Subtract(Time[1]).TotalSeconds;
Trouble is, I'm experiencing this problem: I've added the following in OnBarUpdate:
if (CurrentBar < 60) return; int BarValueSeconds = (int) Time[0].Subtract(Time[1]).TotalSeconds; // *** int BarValueMinutes = (int) BarValueSeconds / 60; Print(BarValueMinutes);
5
5
Error on calling 'OnBarUpdate' method for indicator 'BarNumbersCounting02c' on bar 1436: Object reference not set to an instance of an object.
int BarValueSeconds = (int) Time[[B][COLOR="Blue"]1[/COLOR][/B]].Subtract(Time[[B][COLOR="blue"]2[/COLOR][/B]]).TotalSeconds;
Any advice much appreciated and I'm wondering if there may be a more direct way of achieving this.
Comment