Download MetaTrader 5
To add comments, please log in or register
Why to sell products in MetaTrader AppStore? Find that out from the article!
coolaid
97
coolaid 2014.05.02 06:52 
      
      string name;  
      datetime t=iTime(NULL,1,0);
      double o=iOpen(NULL,1,0);
      Print(t +" ",+o);
      if(B==1)
        {

         RefreshRates();
         name="Buy "+TimeToStr(TimeCurrent())+" "+IntegerToString(value);
        // Print("ObjectCreated:"+name);
         if(!ObjectCreate(ChartID(),name,OBJ_ARROW_BUY,0,t,o)){
            Alert("BuyObjectNotCreated:"+GetLastError());} 
         B=0;
         value++;
        }
        
      if(S==1)
        {
         RefreshRates();
         name="Sell "+TimeToStr(TimeCurrent())+" "+IntegerToString(value);
         //Print("BuyObjectCreated:"+name);
         if(!ObjectCreate(ChartID(),name,OBJ_ARROW_SELL,0,t,o)){
            Alert("SellObjectNotCreated:"+GetLastError());} 
         S=0;
         value++;
        }
Works perfectly on a live chart but not in strat tester.
Alain Verleyen
Moderator
28671
Alain Verleyen 2014.05.02 09:05  
Coolaid:
Works perfectly on a live chart but not in strat tester.
Try to use 0 instead of ChartID().
coolaid
97
coolaid 2014.05.02 10:15  
angevoyageur:
Try to use 0 instead of ChartID().


Worked!
/
To add comments, please log in or register