Download MetaTrader 5
To add comments, please log in or register
Share your program via Code Base. Gain access to millions of traders!
Al
20
Al 2014.10.20 11:56  
Gooly, thanks a lot. I will try your code.
Carl Schreiber
6123
Carl Schreiber 2014.10.20 13:07  

Nungen,

try this - I think IsTradeAllowed("symbol", Time) is broker-time dependent - and not whether the market is open or not, whether you get ticks or not!

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

  	if ( StringFind(dax2,"TRUE   @")<0 && IsTradeAllowed(".DE30CashXE",TimeCurrent()) ) 
  		dax2 = "\n.DE30CashXE   changes to TRUE   @ GMT: "+TimeToStr(TimeGMT(),TIME_DATE|TIME_SECONDS)+"  TmeC: "+TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS);
   else if ( StringFind(dax2,"FALSE  @")<0 && !IsTradeAllowed(".DE30CashXE",TimeCurrent())) 
  		dax2 = "\n.DE30CashXE   changes to FALSE  @ GMT: "+TimeToStr(TimeGMT(),TIME_DATE|TIME_SECONDS)+"  TmeC: "+TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS);
  		
   Comment("GMT: ",TimeToStr(TimeGMT(),TIME_DATE|TIME_SECONDS),"  TmeC: ",TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS),"\n",
      "Just empty      isTrdAllowd:  ",IsTradeAllowed(),"\n",
   	Symbol(),"        isTrdAllowd:   ",IsTradeAllowed(Symbol(),TimeCurrent()),"  normal Forex\n",
   	".DE30Cash     isTrdAllowd:   ",IsTradeAllowed(".DE30Cash",TimeCurrent()),"  DAX\n",
   	".DE30CashXE  isTrdAllowd:   ",IsTradeAllowed(".DE30CashXE",TimeCurrent()),
   	" 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