Download MetaTrader 5

Simple EA code gets unmatched data error

To add comments, please log in or register
rightvaughn
5
rightvaughn 2016.03.27 02:13 

Brand new to coding and trading.

Two questions: Why doesn't this work?

Would this even potentially be profitable?

   { 
   double DayOpen = iOpen(NULL,PERIOD_D1,1);
   double TakeProfitLevel;
   double StopLossLevel;
   int TakeProfit = 10;
   int StopLoss = 10; 
   TakeProfitLevel = Bid + TakeProfit*Point;   //0.0001
   StopLossLevel = Bid - StopLoss*Point;
   int total = OrdersTotal();
   if (total <= 0  && Bid < DayOpen - StopLossLevel)
   { 
   OrderSend("EURUSD", OP_BUY, 1.0, Ask, 0, StopLossLevel, TakeProfitLevel, "1st Order");
   }
   }
Keith Watford
Moderator
9640
Keith Watford 2016.03.27 03:28  
   TakeProfitLevel = Bid + TakeProfit*Point;   //0.0001

As Buys are opened at Ask, it is possible that you are trying to set take profit at below the entry price

To add comments, please log in or register