how to use SymbolInfoSessionTrade and SymbolInfoSessionQuote

 

Hi every one

i want to make table that shows trade time in a week for symbols. like the pic below.

how should i use SymbolInfoSessionTrade to create it?



 
Iman Pakravan:

Hi every one

i want to make table that shows trade time in a week for symbols. like the pic below.

how should i use SymbolInfoSessionTrade to create it?




is it possible?

 
Iman Pakravan:


is it possible?

Nothing?
 
I don't think anyone understands how to help you. As the answer is right below the link in your first post
 
La_patates:
I don't think anyone understands how to help you. As the answer is right below the link in your first post


may you help me why this is not working?



#property version   "1.00"
#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   
   
   
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//---

   //Comment("Current = ",TimeCurrent(),"\r\n",
   //        "GMT  = ",TimeGMT(),"\r\n",
   //        "Local = ",TimeLocal(),"\r\n",
   //        "TraeServer = ",TimeTradeServer(),"\r\n"
   //         )

   datetime d1,d2;
   SymbolInfoSessionTrade(Symbol(),SUNDAY,0,d1,d2);
   string s = TimeToString(d1,TIME_DATE|TIME_MINUTES)+"      "+TimeToString(d2,TIME_DATE|TIME_MINUTES)+"\r\n";

   SymbolInfoSessionTrade(Symbol(),MONDAY,0,d1,d2);
   s += TimeToString(d1,TIME_DATE|TIME_MINUTES)+"      "+TimeToString(d2,TIME_DATE|TIME_MINUTES)+"\r\n";

   SymbolInfoSessionTrade(Symbol(),TUESDAY,0,d1,d2);
   s += TimeToString(d1,TIME_DATE|TIME_MINUTES)+"      "+TimeToString(d2,TIME_DATE|TIME_MINUTES)+"\r\n";
   
   SymbolInfoSessionTrade(Symbol(),WEDNESDAY,0,d1,d2);
   s += TimeToString(d1,TIME_DATE|TIME_MINUTES)+"      "+TimeToString(d2,TIME_DATE|TIME_MINUTES)+"\r\n";

   SymbolInfoSessionTrade(Symbol(),TUESDAY,0,d1,d2);
   s += TimeToString(d1,TIME_DATE|TIME_MINUTES)+"      "+TimeToString(d2,TIME_DATE|TIME_MINUTES)+"\r\n";

   SymbolInfoSessionTrade(Symbol(),FRIDAY,0,d1,d2);
   s += TimeToString(d1,TIME_DATE|TIME_MINUTES)+"      "+TimeToString(d2,TIME_DATE|TIME_MINUTES)+"\r\n\r\n";


   SymbolInfoSessionTrade(Symbol(),SUNDAY,1,d1,d2);
   s += TimeToString(d1,TIME_DATE|TIME_MINUTES)+"      "+TimeToString(d2,TIME_DATE|TIME_MINUTES)+"\r\n";

   SymbolInfoSessionTrade(Symbol(),MONDAY,1,d1,d2);
   s += TimeToString(d1,TIME_DATE|TIME_MINUTES)+"      "+TimeToString(d2,TIME_DATE|TIME_MINUTES)+"\r\n";

   SymbolInfoSessionTrade(Symbol(),TUESDAY,1,d1,d2);
   s += TimeToString(d1,TIME_DATE|TIME_MINUTES)+"      "+TimeToString(d2,TIME_DATE|TIME_MINUTES)+"\r\n";
   
   SymbolInfoSessionTrade(Symbol(),WEDNESDAY,1,d1,d2);
   s += TimeToString(d1,TIME_DATE|TIME_MINUTES)+"      "+TimeToString(d2,TIME_DATE|TIME_MINUTES)+"\r\n";

   SymbolInfoSessionTrade(Symbol(),TUESDAY,1,d1,d2);
   s += TimeToString(d1,TIME_DATE|TIME_MINUTES)+"      "+TimeToString(d2,TIME_DATE|TIME_MINUTES)+"\r\n";

   SymbolInfoSessionTrade(Symbol(),FRIDAY,1,d1,d2);
   s += TimeToString(d1,TIME_DATE|TIME_MINUTES)+"      "+TimeToString(d2,TIME_DATE|TIME_MINUTES)+"\r\n\r\n";


   SymbolInfoSessionTrade(Symbol(),SUNDAY,2,d1,d2);
    s += TimeToString(d1,TIME_DATE|TIME_MINUTES)+"      "+TimeToString(d2,TIME_DATE|TIME_MINUTES)+"\r\n";

   SymbolInfoSessionTrade(Symbol(),MONDAY,2,d1,d2);
   s += TimeToString(d1,TIME_DATE|TIME_MINUTES)+"      "+TimeToString(d2,TIME_DATE|TIME_MINUTES)+"\r\n";

   SymbolInfoSessionTrade(Symbol(),TUESDAY,2,d1,d2);
   s += TimeToString(d1,TIME_DATE|TIME_MINUTES)+"      "+TimeToString(d2,TIME_DATE|TIME_MINUTES)+"\r\n";
   
   SymbolInfoSessionTrade(Symbol(),WEDNESDAY,2,d1,d2);
   s += TimeToString(d1,TIME_DATE|TIME_MINUTES)+"      "+TimeToString(d2,TIME_DATE|TIME_MINUTES)+"\r\n";

   SymbolInfoSessionTrade(Symbol(),TUESDAY,2,d1,d2);
   s += TimeToString(d1,TIME_DATE|TIME_MINUTES)+"      "+TimeToString(d2,TIME_DATE|TIME_MINUTES)+"\r\n";

   SymbolInfoSessionTrade(Symbol(),FRIDAY,2,d1,d2);
   s += TimeToString(d1,TIME_DATE|TIME_MINUTES)+"      "+TimeToString(d2,TIME_DATE|TIME_MINUTES)+"\r\n\r\n";


   SymbolInfoSessionTrade(Symbol(),SUNDAY,3,d1,d2);
    s += TimeToString(d1,TIME_DATE|TIME_MINUTES)+"      "+TimeToString(d2,TIME_DATE|TIME_MINUTES)+"\r\n";

   SymbolInfoSessionTrade(Symbol(),MONDAY,3,d1,d2);
   s += TimeToString(d1,TIME_DATE|TIME_MINUTES)+"      "+TimeToString(d2,TIME_DATE|TIME_MINUTES)+"\r\n";

   SymbolInfoSessionTrade(Symbol(),TUESDAY,3,d1,d2);
   s += TimeToString(d1,TIME_DATE|TIME_MINUTES)+"      "+TimeToString(d2,TIME_DATE|TIME_MINUTES)+"\r\n";
   
   SymbolInfoSessionTrade(Symbol(),WEDNESDAY,3,d1,d2);
   s += TimeToString(d1,TIME_DATE|TIME_MINUTES)+"      "+TimeToString(d2,TIME_DATE|TIME_MINUTES)+"\r\n";

   SymbolInfoSessionTrade(Symbol(),TUESDAY,3,d1,d2);
   s += TimeToString(d1,TIME_DATE|TIME_MINUTES)+"      "+TimeToString(d2,TIME_DATE|TIME_MINUTES)+"\r\n";

   SymbolInfoSessionTrade(Symbol(),FRIDAY,3,d1,d2);
   s += TimeToString(d1,TIME_DATE|TIME_MINUTES)+"      "+TimeToString(d2,TIME_DATE|TIME_MINUTES)+"\r\n\r\n";



   Comment(s);
   return(rates_total);
  }




 
Iman Pakravan:


may you help me why this is not working?

.

I understand that you are either connected to the mql5 demo or using a broker that is on nyc+7 timezone
If so, it all seems to work fine. Did you read the documentation? It will provide you the answer!
 
La_patates:
I understand that you are either connected to the mql5 demo or using a broker that is on nyc+7 timezone
If so, it all seems to work fine. Did you read the documentation? It will provide you the answer!

yes i red it all but i didnt get the point.

 

Iman Pakravan #:


may you help me why this is not working?






//--- set datetime variables

datetime de, a; 

//--- get open and close session

SymbolInfoSessionTrade(_Symbol,FRIDAY,0,de,a);

//--- set MqlDateTime variables

MqlDateTime sec_aper, sec_cier;

//--- convert datetime variables to MqlDateTime variables

TimeToStruct(de,sec_aper);

TimeToStruct(a,sec_cier);


//--- check if this works for you

Comment("Open: ", sec_aper.hour, ":", sec_aper.min, "; Close: ", sec_cier.hour, ":", sec_cier.min);


 
Sergio Chiroy #:

//--- set datetime variables

datetime de, a; 

//--- get open and close session

SymbolInfoSessionTrade(_Symbol,FRIDAY,0,de,a);

//--- set MqlDateTime variables

MqlDateTime sec_aper, sec_cier;

//--- convert datetime variables to MqlDateTime variables

TimeToStruct(de,sec_aper);

TimeToStruct(a,sec_cier);


//--- check if this works for you

Comment("Open: ", sec_aper.hour, ":", sec_aper.min, "; Close: ", sec_cier.hour, ":", sec_cier.min);


Thank You!