Rejoindre la communauté
banner_forum
Devenez membre de la plus grande
communauté francophone sur le Forex
Partagez, échangez et apprenez en gagnant des crédits sur votre compte de trading

Programmer un Stop-Suiveur sur DONCHIAN CHANNEL - Help

  • arka3579

    Bonjour je recherche un Expert Advisor pour trading manuel.
    Il aurai 2 fonctions :
    Positionnement Auto du StopLoss sur le DONCHIAN au moment de l'ouverture d'une position BULLISH ou BEARISH.
    Il serai en plus ET SURTOUT suiveur.

    Je ne trouve pas grand chose a ce sujet, et de plus, j'y arrive pas.
    Si vous avez un code pour EA afin de m'aider, sinon un lien, ben, génial.
    Merci pour votre coup de pouce.

    Yohan.
    Modifié le 2022-04-30 12:48:12 par arka3579
    arka3579 a joint une image
    programmer-un-stop-suiveur-sur-donchian-channel-help-13873
  • arka3579

    J'ai fais cela, mais c'est totalement approximatif.
    D'ailleurs au sujet de tester une E.A. manuel le WEEK-End sur mT4, .. ... EST CE POSSIBLE, vu que les marchés sont fermé ?!

    Code
    //+------------------------------------------------------------------+ //| e-Trailing.mq4 | //+------------------------------------------------------------------+ extern bool AllPositions =False; extern bool ProfitTrailing=True; input double DC_Period = 20; //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ void start() { for(int i=0; i<OrdersTotal(); i++) { if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) { if (AllPositions || OrderSymbol()==Symbol()) { TrailingStop(); } } } } //+------------------------------------------------------------------+ void TrailingStop() { double High1=iHigh(Symbol(),PERIOD_CURRENT,iHighest(Symbol(),PERIOD_CURRENT,MODE_HIGH,DC_Period,1)); double Low1=iLow(Symbol(),PERIOD_CURRENT,iLowest(Symbol(),PERIOD_CURRENT,MODE_LOW,DC_Period,1)); for(int i=OrdersTotal()-1; i>=0;i--) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) if(OrderSymbol()==Symbol()) if(OrderMagicNumber()==0) if(OrderType()==OP_BUY) { if(Bid-OrderOpenPrice()>Low1) if(OrderStopLoss()<Bid-Low1) int TBM=OrderModify(OrderTicket(),OrderOpenPrice(),Bid-(Low1),OrderTakeProfit(),0,clrNONE); } else if(OrderType()==OP_SELL) { if(OrderOpenPrice()-Ask>High1) if(OrderStopLoss()>Ask+High1) int TSM=OrderModify(OrderTicket(),OrderOpenPrice(),Ask+(High1),OrderTakeProfit(),0,clrNONE); } } }