無料でロボットをダウンロードする方法を見る
Twitter上で私たちを見つけてください。
私たちのファンページに参加してください
興味深いスクリプト?
それではリンクにそれを投稿してください。-
他の人にそれを評価してもらいます
記事を気に入りましたか?MetaTrader 5ターミナルの中でそれを試してみてください。
エキスパート

More Trade After Break Even - MetaTrader 4のためのエキスパート

ビュー:
8330
評価:
(25)
パブリッシュ済み:
2021.07.13 09:50
MQL5フリーランス このコードに基づいたロボットまたはインジケーターが必要なら、フリーランスでご注文ください フリーランスに移動

The Masterpiece of this little EA is the Orders count function ,

int OrdersCounter()
  {
   int counter=0;
//---
   for(int i=OrdersTotal()-1; i>=0; i--)
      if(OrderSelect(i,SELECT_BY_POS))
         if(OrderMagicNumber()==MagicNumber && OrderSymbol()==Symbol()) // if order has been opened by this EA
           {
//--- if break even has taken place 
   /* For buys Only when the StopLoss is equal or above the Open Price NOTE This is implementetion is not
   good if you are going to have Pending Orders Its only suitable for buy and sells only*/
            double XBreakeven = OrderType()==OP_BUY ? OrderStopLoss() >= OrderOpenPrice() : OrderStopLoss() <= OrderOpenPrice();
            if(!XBreakeven) //If only Break Even and trailing stop hasn't taken place'
              {
               counter++; //count the Position
              }
           }
   return counter;
  }

Where as we count Only the Orders that have NOT stoploss above or equal to its open price for buy and below its open price sell . I short we count all orders that have not been breakeven or trailing stop has not protected its opening price.

 double XBreakeven = OrderType()==OP_BUY ? OrderStopLoss() >= OrderOpenPrice() : OrderStopLoss() <= OrderOpenPrice();
            if(!XBreakeven) //If only Break Even and trailing stop hasn't taken place'

Through that we make a counter that returns the value that we are going to use to limit our maximum position which in our case we have just set to 1 order at a time

   if(OrdersCounter()<MaximumOrders)

So whenever the breakeven takes place this function will ignore counting it , which by then since we had only one position in this Example .. it will return zero and boom we open  another sale and the process continues

Also this wouldn't be possible if I did not create a break even function ,

void BreakEvenFunction()
  {
//---
   for(int i=OrdersTotal()-1; i>=0; i--)
      if(OrderSelect(i,SELECT_BY_POS))
         if(OrderMagicNumber()==MagicNumber && OrderSymbol()==Symbol())
           {
// for buy if Bid above Open Price + Breakeven pips Vice Versa for sells
            double xHybrid = OrderType()==OP_BUY ? (Bid>OrderOpenPrice()+BreakevenPips*_Point && OrderStopLoss()<OrderOpenPrice()) : (Ask<OrderOpenPrice()-BreakevenPips*_Point && OrderStopLoss()>OrderOpenPrice());
            /* For buys Only when the StopLoss is equal or above the Open Price Vice versa for sell */
            if(xHybrid)
              {
               bool modfy = OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice(),OrderTakeProfit(),0,clrNONE);
              }
           }
  }

Try it ??

    Cercós Chaos vs Movement Cercós Chaos vs Movement

    Volatility indicator

    Moving average breakout Moving average breakout

    trending breakout

    Alligator trend cross Alligator trend cross

    Candle cross either of three lines.

    Indicador Media móvil Hull para MT4 Indicador Media móvil Hull para MT4

    Indicador de medias móviles Hull (HMA) para Metatrader 4 que cambia de color dependiendo de la tendencia. La HMA es una media móvil diseñada para seguir de cerca la acción del precio más reciente pero sin perder el efecto de suavizado. Puede resultar muy útil para el análisis de tendencias.