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

SSEAT de John Davis

  • lefeuvr3

    Je me suis permis d'ameliorer cet EA en gardant son esprit de simple EA
    Code
    //+------------------------------------------------------------------+ //| Super Simple Expert Advisor Template.mq4 | //| John Davis | //| http://www.tidyneat.com | //+------------------------------------------------------------------+ #property copyright "Johnthe" #property link "https://www.mql5.com/en/users/johnthe" #property description "Just gives an idea! " #property description "Opens buys on bulish engulfing" #property description "Opens sells on bearish engulfing" #property strict extern double ProfitGoal=20.00; // Profit goal in deposit currency <or =3400 extern double MaxLoss=-20.00; extern bool trail = true; extern double TrailingStop = 430; double lot; //lotsize extern double LotFactor=64; //lotsize factor sinput string RSI_Settings; input int period=12; // Averagin period for calculation input ENUM_APPLIED_PRICE appPrice=PRICE_HIGH; // Applied price input int OverSold=85; // Over bought level input int OverBought=15; // Over sold level extern int a=2; extern int b=3; extern int c=3; extern int d=3; extern int e=3; extern int f=2; extern int g=3; extern int h=3; extern int m=2; extern int j=3; extern int k=0; extern int l=3; extern int adxperiod= 14; extern int adxthreshold=20; datetime NewTime=0; //+------------------------------------------------------------------+ //| Begin main function | //+------------------------------------------------------------------+ void trail() { for (int i = 0; i < OrdersTotal(); i++) { if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) if ( OrderSymbol()==Symbol() ) { if (OrderType() == OP_BUY) { if (Bid - OrderOpenPrice() > TrailingStop * MarketInfo(OrderSymbol(), MODE_POINT)) { if (OrderStopLoss() < Bid - TrailingStop * MarketInfo(OrderSymbol(), MODE_POINT)) { bool modify1=OrderModify(OrderTicket(), OrderOpenPrice(), Bid - TrailingStop * MarketInfo(OrderSymbol(), MODE_POINT), OrderTakeProfit(), Red); } } } else if (OrderType() == OP_SELL) { if (OrderOpenPrice() - Ask > TrailingStop * MarketInfo(OrderSymbol(), MODE_POINT)) { if ((OrderStopLoss() > Ask + TrailingStop * MarketInfo(OrderSymbol(), MODE_POINT)) || (OrderStopLoss() == 0)) { bool modify2=OrderModify(OrderTicket(), OrderOpenPrice(), Ask + TrailingStop * MarketInfo(OrderSymbol(), MODE_POINT), OrderTakeProfit(), Red); } } } } } } int start() { if (trail) trail(); { if(NewTime!=Time[0]) // Run only on new bars { double Regulator = Volume[1]> Volume[0] &&iADX(Symbol(),0,adxperiod,PRICE_CLOSE,MODE_MAIN,0)> adxthreshold ; NewTime=Time[0]; double rsi=iRSI(_Symbol,PERIOD_CURRENT,period,appPrice,1); bool orderOpended=false; if(rsi<OverBought && Regulator&& iOpen(NULL,0,a)>iClose(NULL,0,b) && // Place Buy logic in if statemet iOpen(NULL,0,c)<iClose(NULL,0,d) && // Buy logic iOpen(NULL,0,e)<iClose(NULL,0,f)) // Buy logic orderOpended=OrderSend(Symbol(),OP_BUY,NR(Lot_Volume()),Ask,3,0,0,NULL,0,0,Blue); else if(rsi>OverSold && Regulator&& iOpen(NULL,0,g)<iClose(NULL,0,h) && // Place Sell logic in if satement iOpen(NULL,0,m)>iClose(NULL,0,j) && // Sell logic iOpen(NULL,0,k)>iClose(NULL,0,l)) // Sell logic orderOpended=OrderSend(Symbol(),OP_SELL,NR(Lot_Volume()),Bid,3,0,0,NULL,0,0,Red); } // Checks if you reached your profit goal or loss limit if(AccountProfit()>=ProfitGoal || AccountProfit()<=MaxLoss ) { // Closes all orders oldest first inline with FIFO for(int i=0; i<OrdersTotal(); i++) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) if(OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),10,clrNONE)) i--; // Decrement by one since closed orders are removed from que } } return(0); } } //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //Calculates Lot Size based on balance and factor //+------------------------------------------------------------------+ double NR(double thelot) { double maxlots=MarketInfo(Symbol(),MODE_MAXLOT), minilot=MarketInfo(Symbol(),MODE_MINLOT), lstep=MarketInfo(Symbol(),MODE_LOTSTEP); double lots=lstep*NormalizeDouble(thelot/lstep,0); lots=MathMax(MathMin(maxlots,lots),minilot); return (lots); } //+------------------------------------------------------------------+ double Lot_Volume() { lot=AccountBalance() * 0.01 /LotFactor ; return(lot); } //+------------------------------------------------------------------+
    lefeuvr3 a joint une image
    sseat-de-john-davis-10959
  • Mikiburger

    Je n'arrive pas aux mêmes résultats
    Mikiburger a joint une image
    sseat-de-john-davis-11201
  • lefeuvr3

    Tu as raison ....je pense que cela viens,peut être , du fait qu' à l’époque je faisais des backtests sur compte demo et cela faussait les paramètres .
    Maintenant je backteste sur un compte réel et c'est beaucoup mieux.
    Amicalement
    gerard