Is there a function that returns the "time" of the last bar of a session ?
I ran into an unusual situation where my session is 1730 to 2355 and my study expects 2355 to be the last bar in that session (before plotting) but no data came in during that last 5 minute interval, thus my study didn't plot...
If 2350 was the last 5 minute bar of the 1730-2355 session (instead of 2355), how can I have the code adjust for that ? (as easy as possible- I'm not a pro programmer)..
help ! Last Bar Time of a Session needed
- fbertram
- Posts: 166
- Joined: Oct 16 2014
- Location: Seattle, USA
- Has thanked: 36 times
- Been thanked: 76 times
- Contact:
Hi SpTrader,
here is a code snippet I use to detect the last bar in a trading session:
The last bar will have a time stamp at the session end. Therefore, adding the bar interval to it, will lead to a time after the session end.
Hope this helps,
best regards, Felix
here is a code snippet I use to detect the last bar in a trading session:
Code: Select all
if CalcTime(Time, BarInterval) > SessionEndTime(1, 1) then
Trigger.Last = true
else Trigger.Last = false;
Hope this helps,
best regards, Felix