LastHour built-in function - 2 questions

Questions about MultiCharts and user contributed studies.
Nicolas23
Posts: 50
Joined: 13 Oct 2011
Has thanked: 22 times
Been thanked: 35 times

LastHour built-in function - 2 questions

Postby Nicolas23 » 23 Nov 2011

Hi,

I have two questions about the way the function LastHour is coded in MultiCharts.

The built-in code is:

Code: Select all

LastHour = Time >= CalcTime( SessionEndTime( 1, 1 ), -60 ) and Time < SessionEndTime( 1, 1 ) ;
Question #1
Shouldn't SessionEndTime(1,1) be replaced by SessionEndTime(1, CurrentSession(1)) in order to take into account the possibility that all sessions do not necessarily end at the same time?

Question #2
If session ends at 00:30 and current time is 23:45 then I think that CalcTime return -30 and LastHour returns false, whereas it should return true.
Have I missed something?

Thanks in advance for your help,

Nicolas

User avatar
Roman MultiCharts
Posts: 50
Joined: 28 Nov 2011
Has thanked: 21 times
Been thanked: 67 times

Re: LastHour built-in function - 2 questions

Postby Roman MultiCharts » 28 Nov 2011

Hello Nicolas23,

1) It's reasonable to replace SessionEndTime(1,1) by SessionEndTime(1, CurrentSession(1)) in case if the session hours vary.

2) It seems that in the script the switching to the following day is not foreseen (swithching over "0:00").


Return to “MultiCharts”