Download MetaTrader 5

Parameters of IsTradeAllowed()

To add comments, please log in or register
Al
20
Al  

Function IsTradeAllowed now accepts two parameters. Undocumented. Does anybody know the meaning of the two params?

Carl Schreiber
6978
Carl Schreiber  
Nungen:

Function IsTradeAllowed now accepts two parameters. Undocumented. Does anybody know the meaning of the two params?


How did you know it? Can you show us how did you find that?
Simon Gniadkowski
Moderator
18023
Simon Gniadkowski  
gooly:
How did you know it? Can you show us how did you find that?

I guess from here:

 


Al
20
Al  
RaptorUK:

I guess from here:

 


You are right.
Carl Schreiber
6978
Carl Schreiber  
RaptorUK:

I guess from here:

And this is from where?

Al
20
Al  
gooly:
RaptorUK:

And this is from where?

Entering name of the function into the mql editor.
Carl Schreiber
6978
Carl Schreiber  
Nungen:
Entering name of the function into the mql editor.

Ahh - ok, I see.

Have you already played around with this feature?

A Forex-Symbol wouldn't make sense but what about a Share-Index (e.g. DAX) 'outside and insinde' its trading times?

I have created an indicator that will tell me tomorrow:

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(TimeToStr(TimeGMT(),TIME_DATE| TIME_MINUTES),"\n",
        Symbol(),"        isTrdAllowd:   ",IsTradeAllowed(Symbol(),TimeGMT()),"  normal Forex\n",
        ".DE30Cash     isTrdAllowd:   ",IsTradeAllowed(".DE30Cash",TimeGMT()),"  DAX\n",
        ".DE30CashXE  isTrdAllowd:   ",IsTradeAllowed(".DE30CashXE",TimeGMT()),
        " DAX Xetra Trading Hours (9:00.17:30 Ffm == 7:00-15:30 GMT now!)\n"
   );
//--- return value of prev_calculated for next call
   return(rates_total);
  }
Al
20
Al  
gooly: Have you already played around with this feature?
Not yet. Your indicator is interesting. It would be very useful if worked this way.
Carl Schreiber
6978
Carl Schreiber  

Interesting!

The forex market just opened and IsTradeAllowed (see the code above of my indicator) still shows false ?? (Server has GMT as well!)

OK, as it could be that the problem is the indicator - must not trade I mad a dummy-EA:

void OnTick()
  {
   Comment("GMT: ",TimeToStr(TimeGMT(),TIME_DATE| TIME_MINUTES),"\n",
      "Just empty      isTrdAllowd:  ",IsTradeAllowed(),"\n",
        Symbol(),"        isTrdAllowd:   ",IsTradeAllowed(Symbol(),TimeGMT()),"  normal Forex\n",
        ".DE30Cash     isTrdAllowd:   ",IsTradeAllowed(".DE30Cash",TimeGMT()),"  DAX\n",
        ".DE30CashXE  isTrdAllowd:   ",IsTradeAllowed(".DE30CashXE",TimeGMT()),
        " DAX Xetra Trading Hours (9:00.17:30 Ffm == 7:00-15:30 GMT now!)\n"
   );
   
  }

But I get the same result:


Not implemented yet I guess :(

Carl Schreiber
6978
Carl Schreiber  

Wow! Now the second line changes to true:


I change my dummy to:

string dax1="\n.",dax2="\n:";
void OnTick()
  {
        if ( dax1=="\n." && IsTradeAllowed(".DE30Cash",TimeGMT()) ) 
                dax1 = "\n.DE30Cash   changes to TRUE   @ "+TimeToStr(TimeGMT(),TIME_DATE|TIME_SECONDS);
        if ( dax2=="\n:" && IsTradeAllowed(".DE30CashXE",TimeGMT()) ) 
                dax2 = "\n.DE30CashXE   changes to TRUE   @ "+TimeToStr(TimeGMT(),TIME_DATE|TIME_SECONDS);
                
   Comment("GMT: ",TimeToStr(TimeGMT(),TIME_DATE| TIME_MINUTES),"\n",
      "Just empty      isTrdAllowd:  ",IsTradeAllowed(),"\n",
        Symbol(),"        isTrdAllowd:   ",IsTradeAllowed(Symbol(),TimeGMT()),"  normal Forex\n",
        ".DE30Cash     isTrdAllowd:   ",IsTradeAllowed(".DE30Cash",TimeGMT()),"  DAX\n",
        ".DE30CashXE  isTrdAllowd:   ",IsTradeAllowed(".DE30CashXE",TimeGMT()),
        " DAX Xetra Trading Hours (9:00.17:30 Ffm == 7:00-15:30 GMT now!)",
        dax1,dax2
   );
   
  }
Carl Schreiber
6978
Carl Schreiber  

For other to check themselves I changed my code a bit:

string dax1,dax2;
void OnTick()
  {
        if ( StringFind(dax1,"TRUE   @")<0 && IsTradeAllowed(".DE30Cash",TimeGMT()) ) 
                dax1 = "\n.DE30Cash      changes to TRUE   @ "+TimeToStr(TimeGMT(),TIME_DATE|TIME_SECONDS);
        else if ( StringFind(dax1,"FALSE  @")<0 && !IsTradeAllowed(".DE30Cash",TimeGMT()) ) 
                dax1 = "\n.DE30Cash      changes to FALSE  @ "+TimeToStr(TimeGMT(),TIME_DATE|TIME_SECONDS);

        if ( StringFind(dax2,"TRUE   @")<0 && IsTradeAllowed(".DE30CashXE",TimeGMT()) ) 
                dax2 = "\n.DE30CashXE   changes to TRUE   @ "+TimeToStr(TimeGMT(),TIME_DATE|TIME_SECONDS);
   else if ( StringFind(dax2,"FALSE  @")<0 && !IsTradeAllowed(".DE30CashXE",TimeGMT())) 
                dax2 = "\n.DE30CashXE   changes to FALSE  @ "+TimeToStr(TimeGMT(),TIME_DATE|TIME_SECONDS);
                
   Comment("GMT: ",TimeToStr(TimeGMT(),TIME_DATE|TIME_SECONDS),"\n",
      "Just empty      isTrdAllowd:  ",IsTradeAllowed(),"\n",
        Symbol(),"        isTrdAllowd:   ",IsTradeAllowed(Symbol(),TimeGMT()),"  normal Forex\n",
        ".DE30Cash     isTrdAllowd:   ",IsTradeAllowed(".DE30Cash",TimeGMT()),"  DAX\n",
        ".DE30CashXE  isTrdAllowd:   ",IsTradeAllowed(".DE30CashXE",TimeGMT()),
        " DAX Xetra Trading Hours (9:00.17:30 Ffm == 7:00-15:30 GMT now!)",
        dax1,dax2
   );
   
  }
12
To add comments, please log in or register