CurrentSession function return oft -1 Value, BUG ?!

Questions about MultiCharts and user contributed studies.
radekj
Posts: 113
Joined: 28 Apr 2008
Has thanked: 20 times
Been thanked: 1 time

CurrentSession function return oft -1 Value, BUG ?!

Postby radekj » 30 Jul 2010

CurrentSession function return oft -1 Value for daily ES chart (Regular session settings).
Seems to be a bug !

MC 6 beta 4
WinXP Pro SP3 32bit

ciao
radekj

radekj
Posts: 113
Joined: 28 Apr 2008
Has thanked: 20 times
Been thanked: 1 time

Re: CurrentSession function return oft -1 Value, BUG ?!

Postby radekj » 30 Jul 2010

CurrentSession() function is very importend because it is only the way to determine the session change/break via:

CurrentSession(0)[0] <> CurrentSession(0)[1]

if this function has bug big part of EL sources are useless !

ciao
radekj

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 489 times

Re: CurrentSession function return oft -1 Value, BUG ?!

Postby Dave Masalov » 05 Aug 2010

Dear radekj,

The engineers have confirmed that it is a bug. It has been added to our fix list.

User avatar
swisstrader
Posts: 110
Joined: 16 Nov 2005
Location: Earth
Has thanked: 13 times
Been thanked: 19 times
Contact:

Re: CurrentSession function return oft -1 Value, BUG ?!

Postby swisstrader » 21 Aug 2010

Dear radekj,

The engineers have confirmed that it is a bug. It has been added to our fix list.

I have coded a test indicator after I've read the thread here.
With release 6.01.3605 the bug is fixed. My test indicator show the right trigger plots
in all session types.

-swisstrader

sptrader
Posts: 742
Joined: 09 Apr 2010
Location: Texas
Has thanked: 483 times
Been thanked: 274 times
Contact:

Re: CurrentSession function return oft -1 Value, BUG ?!

Postby sptrader » 21 Aug 2010

swisstrader: thanks for finding the BUG and confirming the fix...

Nicolas23
Posts: 50
Joined: 13 Oct 2011
Has thanked: 22 times
Been thanked: 35 times

Re: CurrentSession function return oft -1 Value, BUG ?!

Postby Nicolas23 » 09 Dec 2011

Hi,

For information (since problem solved)...

I had the same problem when using ET Z1-DT from eSignal data feed.

Apparently, it was due to the fact that the contract rolled over.
Problem was solved by using ET Z2011-DT (manual import) instead.

Nicolas

(EDIT: correction of typos)
Last edited by Nicolas23 on 10 Dec 2011, edited 1 time in total.

User avatar
swisstrader
Posts: 110
Joined: 16 Nov 2005
Location: Earth
Has thanked: 13 times
Been thanked: 19 times
Contact:

CurrentSession code with second time trigger

Postby swisstrader » 09 Dec 2011

CurrentSession code with second time trigger will work faster than original function because of substituted function (MinutesIntoWeek)

Enjoy!

Code: Select all

inputs: SessionType(NumericSimple); { 0 = autodetect, 1 = regular}

vars: SessionNumber (-1),
Initialized(false),
dSessionCount (0),
BT(0), ii(0),
jj(0), nn(0),
BarLocation (0);

arrays: SessionStart[1,50](0),
SessionEnd [1,50](0); { these arrays allow for a maximum 50 sessions per week }



uwCurrentSession_s = -1;

if Initialized = false then begin
for ii = 0 to 1 begin
dSessionCount = SessionCount(0); {SessionCount(0) returns the number of sessions per week}
for jj = 1 to dSessionCount begin
SessionStart[ii,jj] = 1440 * SessionStartDay(ii,jj)
+ 60 * IntPortion ( SessionStartTime(ii,jj)*0.01 )
+ 100 * FracPortion( SessionStartTime(ii,jj)*0.01 );
SessionEnd [ii,jj] = 1440 * SessionEndDay (ii,jj)
+ 60 * IntPortion ( SessionEndTime (ii,jj)*0.01 )
+ 100 * FracPortion( SessionEndTime (ii,jj)*0.01 );
end;
end;
Initialized = true;
BT = BarType;
end;

BarLocation = 1440 * DayOfWeek (Date)
+ 60 * IntPortion (Time_s*0.0001) // 10_min
+ 100 * FracPortion(Time_s*0.0001); // 01_min

for nn = 1 to dSessionCount begin
if ( (BT = 0 and BarLocation >= SessionStart[SessionType,nn]) or (BarLocation > SessionStart[SessionType,nn]) )
AND ( BarLocation <= SessionEnd [SessionType,nn] )
then begin
SessionNumber = nn; { Output the SessionNumber of the current bar }
nn = dSessionCount; { this short circuits the loop }
end;
end;

uwCurrentSession_s = SessionNumber;


Return to “MultiCharts”