"Sessionlastbar" behaviour in realtime

Questions about MultiCharts and user contributed studies.
wilkinsw
Posts: 662
Joined: 21 Apr 2013
Has thanked: 154 times
Been thanked: 104 times

"Sessionlastbar" behaviour in realtime

Postby wilkinsw » 15 Dec 2016

Hi,

How does sessionlastbar toggle to TRUE in realtime trading? What does it check exactly?

If close time of session is 1320 and I have a 30min timeframe chart......On the first tick received after 1300, does sessionlastbar=true?

Or is it doing it retrospectively? Say on the first tick of the new session.... if I reload the chart, it will show the 1320 previous bar as TRUE?

I can see that if I load a historical chart, sessionlastbar will be True for the last bar of the session on a day with an early close. How does it know? Therefore it must be a retrospective query?

Thanks.

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: "Sessionlastbar" behaviour in realtime

Postby Henry MultiСharts » 22 Dec 2016

How does sessionlastbar toggle to TRUE in realtime trading? What does it check exactly?
Hello wilkinsw,

SessionLastBar returns True on the last calculation of the study for the selected session.
If close time of session is 1320 and I have a 30min timeframe chart......On the first tick received after 1300, does sessionlastbar=true?
No. If it is indeed a calculation on the last bar for the session then sessionlastbar=true will be on bar close (IOG=Off) or last tick of the bar (IOG=On).
Or is it doing it retrospectively? Say on the first tick of the new session.... if I reload the chart, it will show the 1320 previous bar as TRUE?
New session is not related to this reserved word.

wilkinsw
Posts: 662
Joined: 21 Apr 2013
Has thanked: 154 times
Been thanked: 104 times

Re: "Sessionlastbar" behaviour in realtime

Postby wilkinsw » 03 Jan 2017

Hi Henry,

I think I may have run into an issue when using "sessionlastbar" to assign a value to a variable, when trading live.

How is it known when a tick is the "last tick" of the session? What is the exact logic please. Is it done on a timer, ie once time>=session end time + timer countdown?

Thanks.

User avatar
Angelina MultiСharts
Posts: 260
Joined: 28 Dec 2016
Has thanked: 28 times
Been thanked: 66 times

Re: "Sessionlastbar" behaviour in realtime

Postby Angelina MultiСharts » 31 Jan 2017

Hello wilkinsw,

Here is how the tick is recognized as a "last tick" of the session:
1. If there are new ticks with a timestamp outside of session hours. In this case "sessionlastbar" is assigned to the bar straight away.
2. It there are no new ticks, formula time>=session end time + timer countdown is used, timer value is set in the Registry. "sessionlastbar" property is assigned to the bar after the timeout.


Return to “MultiCharts”