Download MetaTrader 5

Stop loss doesnt view on platform but my EA robot use it good

To add comments, please log in or register
Publish your articles and improve your rating!
emko513
14
emko513 2015.06.02 23:32 

Hello guys i have small problem with stop loss.My EA robot use it good but i doesnt see it on platform.

Here is Stop loss (Stopper) code :

}

   total = CountTrades();

   AveragePrice = 0;

   double Count = 0;

   for (cnt = OrdersTotal() - 1; cnt >= 0; cnt--) {

      OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

      if (OrderSymbol() != Symbol() || OrderMagicNumber() != MagicNumber) continue;

      if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) {

         if (OrderType() == OP_BUY || OrderType() == OP_SELL) {

            AveragePrice += OrderOpenPrice() * OrderLots();

            Count += OrderLots();

         }

      }

   }

   if (total > 0) AveragePrice = NormalizeDouble(AveragePrice / Count, Digits);

   if (NewOrdersPlaced) {

      for (cnt = OrdersTotal() - 1; cnt >= 0; cnt--) {

         OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

         if (OrderSymbol() != Symbol() || OrderMagicNumber() != MagicNumber) continue;

         if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) {

            if (OrderType() == OP_BUY) {

               PriceTarget = AveragePrice + TakeProfit * Point;

               BuyTarget = PriceTarget;

               Stopper = AveragePrice - Stoploss * Point;

               flag = TRUE;

            }

         }

         if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) {

            if (OrderType() == OP_SELL) {

               PriceTarget = AveragePrice - TakeProfit * Point;

               SellTarget = PriceTarget;

               Stopper = AveragePrice + Stoploss * Point;

               flag = TRUE;

            }

         }

      }

   }

   if (NewOrdersPlaced) {

      if (flag == TRUE) {

         for (cnt = OrdersTotal() - 1; cnt >= 0; cnt--) {

            OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

            if (OrderSymbol() != Symbol() || OrderMagicNumber() != MagicNumber) continue;

            if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) OrderModify(OrderTicket(), NormalizeDouble(AveragePrice,Digits), NormalizeDouble(OrderStopLoss(),Digits), NormalizeDouble(PriceTarget,Digits), 0, Yellow);

            NewOrdersPlaced = FALSE;

         }

      }

   }

   return (0); 

 

 

 

Please anyone know what do it with it? :P (Thanks for all post and comment) 

To add comments, please log in or register