Download MetaTrader 5
To add comments, please log in or register
Are you used to trading from your smartphone? Mobile version of MetaTrader 5 will suit you best!
Ma Yuliang
251
Ma Yuliang 2015.07.11 02:27 

I am really busy on the trading day.

So could only code some script on Saturday and Sunday.

Then I found there is no sigle come in.OnCalculate and OnTick could only draw indicator on histroy data.

Could any one know how to test Indicator script on Sunday?

Marco vd Heijden
Moderator
4207
Marco vd Heijden 2015.07.11 08:54  
//+------------------------------------------------------------------+
//| Timer function                                                   |
//+------------------------------------------------------------------+
void OnTimer()
  {
   OnTick();
  }
Ma Yuliang
251
Ma Yuliang 2015.07.12 12:20  
Marco vd Heijden:

It's really a good idea.

I wrote OnCalculation in OnTimer too.

void OnTimer()
  {
//---

   datetime arrTime[];
   double   arrOpen[],arrHigh[],arrLow[],arrClose[];
   long      arrTickVolume[],arrVolume[];
   int      arrSpread[];
   ArrayCopy(arrTime,Time,0,0,WHOLE_ARRAY);
   ArrayCopy(arrOpen,Open,0,0,WHOLE_ARRAY);
   ArrayCopy(arrHigh,High,0,0,WHOLE_ARRAY);
   ArrayCopy(arrLow,Low,0,0,WHOLE_ARRAY);
   ArrayCopy(arrClose,Close,0,0,WHOLE_ARRAY);
   ArrayCopy(arrVolume,Volume,0,0,WHOLE_ARRAY);
   CopyTickVolume(Symbol(),0,0,Bars-1,arrTickVolume);
   CopySpread(Symbol(),0,0,Bars-1,arrSpread);
   OnCalculate(Bars,0,arrTime,arrOpen,arrHigh,arrLow,arrClose,arrTickVolume,arrVolume,arrSpread);
  }
/
To add comments, please log in or register