forex software

Create and Test Forex Strategies

forex software

Skip to forum content

Forex Forum

Forex Software, Forex Strategies, Expert Advisors Generator

You are not logged in. Please login or register.


Forex Forum → Expert Advisor Studio → Problem: IsOutOfSession always returns 'true'

Pages 1

You must login or register to post a reply

RSS topic feed

Posts: 6

Topic: Problem: IsOutOfSession always returns 'true'

I created a new EURUSD, H1,  Portfolio Expert with nearly 100 strategies -- and it never trades.  In the past, when I've created similar EAs there would be between 10-30 trades per day.

I added a few Print statements to the code and it appears that IsOutOfSession() always returns 'true'.  IsOutOfSession() checks for 'weekDay' and then sets 'skipTrade' to true or false.  In my case it appears to always get set to 'true'.

   else if(weekDay<5)
     {
      int lastBarFix=sessionCloseAtSessionClose ? periodLength : 0;
      skipTrade=timeFromMidnight<sessionMondayThursdayOpen || timeFromMidnight+lastBarFix>sessionMondayThursdayClose;
     }

When IsOutOfSession() returns 'true' then it immediately returns from OnBar() and trading will never occur. 

Is this a bug or do I have some setting that is wrong.  Thanks...

Re: Problem: IsOutOfSession always returns 'true'

A bit more information...

In the same account I have two other Portfolio EAs running and they are doing fine.  The other two were created a few weeks ago and their OnBar() does not include a call to IsOutOfSession().  Only the new Portfolio EA (that I created a few days ago) checks for IsOutOfSession() and it is the only EA that doesn't trade.

Re: Problem: IsOutOfSession always returns 'true'

Please see the session times and settings at the beginning of the expert.

Re: Problem: IsOutOfSession always returns 'true'

At the beginning of the expert I see the following:

// Session time is set in seconds from 00:00
int sessionSundayOpen           = 7777001;
int sessionSundayClose          = 7777002;
int sessionMondayThursdayOpen   = 7777003;
int sessionMondayThursdayClose  = 7777004;
int sessionFridayOpen           = 7777005;
int sessionFridayClose          = 7777006;
bool sessionIgnoreSunday        = 7777007;
bool sessionCloseAtSessionClose = 7777008;
bool sessionCloseAtFridayClose  = 7777009;

But I'm not sure what to do with these.

In my currently running EA Studio when I look under Tools / Settings it only shows Account Info.  There is nothing about 'Trading Session'.

Re: Problem: IsOutOfSession always returns 'true'

Please reload EA Studio.

You will see the Trading Session settings. After exporting the EA again, it will have the time set there.

Re: Problem: IsOutOfSession always returns 'true'

Excellent -- thank you, Popov.

Posts: 6

Pages 1

You must login or register to post a reply

Forex Forum → Expert Advisor Studio → Problem: IsOutOfSession always returns 'true'

Similar topics in this forum