Why is my SymbolInfoSessionQuote returning false?

J Sky  

Hi everyone,

I'm quite new to EA programming.
I'm trying to check that all my symbols are open and will be open for at least 10 minutes before I open any positions.

My code is below:

   //check if all symbols open now and for the next 10 minutes
   
   datetime start;
   datetime finish;
   datetime serverTime = TimeTradeServer();
   MqlDateTime st;      //server time in MqlDateTime format
   TimeToStruct(serverTime,st);      
   
   bool symbolsOpen = true;    //true if all symbols are open now and for the next 10 minutes  

   //cycle through symbols, checking that they are all open now and for the next 10 minutes
   for (int i=0;i<ArraySize(markets);i++)
   {   
      printf (SymbolInfoSessionQuote(markets[i],(ENUM_DAY_OF_WEEK)st.day_of_week,0,start,finish));    

      //debugging
      printf(st.day_of_week);
      printf((ENUM_DAY_OF_WEEK)st.day_of_week);
      printf(markets[i]);
      printf("market opens at "+start);
      printf("market closes at "+finish);
      printf("server time is "+serverTime);
      printf("server time plus 10 minutes is "+ (serverTime + 600));
      
      //check if this symbol is open now and for the next 10 minutes
      symbolsOpen = symbolsOpen && (serverTime>start) && (finish>serverTime + 600);
      printf(symbolsOpen);

   }


SymbolInfoSessionQuote is returning false and I don't know why. 

so start and finish are not being updated by SymbolInfoSessionQuote

Documentation on MQL5: Market Info / SymbolInfoSessionQuote
Documentation on MQL5: Market Info / SymbolInfoSessionQuote
  • www.mql5.com
SymbolInfoSessionQuote - Market Info - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
Keith Watford  
Please edit your post and use the code button (Alt+S) when pasting code.
EDIT your original post, please do not just post the code properly in a new post.
Reason: