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

eaxtwoependingaorders.mq4

  • lefeuvr3

    Petit capital...très nombreux gains ...gagnant a 100%...tout petit programme ....lot a ajustement progressif.

    Code
    //+------------------------------------------------------------------+ //| eaxtwoependingaorders.mq4 | //| Copyright 2019, MetaQuotes Software Corp. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2019, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" //#property strict extern int MagicNumber=20100807; //magic extern double LotFactor =50; //lotsize factor double lot; extern double Ecart = 50; extern double stop_loss = 00; extern double take_profit = 80; extern int last_bar = 0; //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start(){ double MyPoint=Point; if(Digits==3 || Digits==5) MyPoint=Point*10; new_del () ; if (last_bar == Bars ) return ( 0 ); last_bar = Bars ; if ( OrdersTotal () == 0 ) { int buystop= OrderSend ( Symbol (), OP_BUYSTOP, NR(Lot_Volume()), Ask + Ecart * Point , 3 , Ask + Ecart * Point - stop_loss * Point , Bid + Ecart * Point + take_profit * Point ,"eaxtwoependingaorders",MagicNumber, 0 , Blue); int sellstop =OrderSend ( Symbol (), OP_SELLSTOP, NR(Lot_Volume()), Bid - Ecart * Point , 3 , Bid - Ecart * Point + stop_loss * Point, Ask - Ecart * Point - take_profit * Point ,"eaxtwoependingaorders", MagicNumber, 0 , Red); } return ( 0 ); } //-------------------- ( to close pending order) --------------- int new_del() { int i,a; int total = OrdersTotal(); string comentario,par; for (i=total-1; i >=0; i--) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) if (OrderType()==OP_BUY || OrderType()==OP_SELL) { for (a=total-1; a >=0; a--) { if(OrderSelect(a,SELECT_BY_POS,MODE_TRADES)) comentario=OrderComment(); par=StringSubstr(comentario,0,6); // if(OrderType()==OP_SELLSTOP) { bool modify1= OrderDelete(OrderTicket()); Print("Deleting SELL_STOP"," Ordertype:",OrderType()); return(1); } // if(OrderType()==OP_BUYSTOP) { bool modify2= OrderDelete(OrderTicket()); Print("Deleting BUY_STOP"," Ordertype:",OrderType()); return(1); } } } } return ( 0 ); } //+------------------------------------------------------------------+ //insuring its a new candle function //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //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); } int TotalOrdersCount() { int result=0; for(int i=0;i<OrdersTotal();i++) { if(OrderSelect(i,SELECT_BY_POS ,MODE_TRADES)) if (OrderMagicNumber()==MagicNumber) result++; } return (result); } //+------------------------------------------------------------------+ double Lot_Volume() { lot=AccountBalance() * 0.01 /LotFactor ; return(lot); } //+------------------------------------------------------------------+
    lefeuvr3 a joint une image
    eaxtwoependingaorders-mq4-11863
  • lefeuvr3

    Afin de permettre au robot de se reposer un peu la nuit ,moment où les spreads,sont à mon gout trop grands,je vais stopper son trading nocturne.
    Pour ce faire ,j' apporte une modification minime.

    Code
    extern int Start_Time = 7; // Time to allow trading to start ( hours of 24 hr clock ) 0 for both disables extern int Finish_Time = 22; // Time to stop trading ( hours of 24 hr clock ) 0 for both disables //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { if(TimeHour(TimeCurrent())>=Start_Time && TimeHour(TimeCurrent())<=Finish_Time )return(0);
    Modifié le 2019-11-29 08:49:42 par lefeuvr3 : correction fautes ortographe
  • Mikiburger

    Bonjour,

    Merci pour le partage.
    Ca ne fonctionne pas chez moi:
    Mikiburger a joint une image
    eaxtwoependingaorders-mq4-11870
  • lefeuvr3

    OK ,je vais revoir le programme
  • lefeuvr3

    Bonjour
    Après réflexion ,il est possible que cela soit du à un mauvais Backtest de ma part .
    Je pense qu'il faut modifier les paramètres en augmentant "le Spread" ou "Ecart"...il a été réalisé avec... écart actuel(5)...ce qui est le spread du moment sur ma plateforme...en fait je réalise que beaucoup de backtests effectués sur EURUSD sont faits avec des speads allant jusqu' à 20 !
    En fait ce n'est que mon humble avis
  • lefeuvr3

    Version modifiée

    Code
    //+------------------------------------------------------------------+ //| eaxtwoependingaorders V2.mq4 | //| Copyright 2019, MetaQuotes Software Corp. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2019, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" #property strict extern int MagicNumber=20100807; //magic extern string Name_EA = "eaxtwoependingaorders V2" ; extern double LotFactor =40; //lotsize factor double lot; extern int TakeProfit = 42; int StopLoss = 0; extern int ecartask=14; extern int ecartbid=0; int last_bar = 0; //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { double MyPoint=Point; if(Digits==3 || Digits==5) MyPoint=Point*10; new_del () ; if (last_bar == Bars) return(0); last_bar = Bars; if ( OrdersTotal () == 0 ) { int buystop = OrderSend(Symbol(),OP_BUYSTOP, (AccountEquity() * 0.01 /LotFactor),Ask+ecartask*Point,5,(Ask+ecartask*Point)-StopLoss*Point,(Ask+ecartask*Point)+TakeProfit*Point,"eaxtwoependingaorders V2",MagicNumber,0,clrBlue); int sellstop = OrderSend(Symbol(),OP_SELLSTOP, (AccountEquity() * 0.01 /LotFactor),Bid-ecartbid*Point,5,(Bid-ecartbid*Point)+StopLoss*Point,(Bid-ecartbid*Point)-TakeProfit*Point,"eaxtwoependingaorders V2",MagicNumber,0,clrBlue); } return ( 0 ); } //-------------------- ( to close pending order) --------------- int new_del() { int i,a; int total = OrdersTotal(); string comentario,par; for (i=total-1; i >=0; i--) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) if (OrderType()==OP_BUYSTOP || OrderType()==OP_SELLSTOP) { for (a=total-1; a >=0; a--) { if(OrderSelect(a,SELECT_BY_POS,MODE_TRADES)) if(OrderType()==OP_SELLSTOP) { bool modify1= OrderDelete(OrderTicket()); Print("Deleting SELL_STOP"," Ordertype:",OrderType()); return(1); } if(OrderType()==OP_BUYSTOP) { bool modify2= OrderDelete(OrderTicket()); Print("Deleting BUY_STOP"," Ordertype:",OrderType()); return(1); } } } } return ( 0 ); }
    Modifié le 2020-02-03 16:12:57 par lefeuvr3 : erreur sur balise
  • lefeuvr3

    Eurusd 1 mn du 04.02.2019 au 25.06.2019
    lefeuvr3 a joint une image
    eaxtwoependingaorders-mq4-11991
  • Mikiburger

    Non chez moi ça ne fonctionne toujours pas.
    Même avec la nouvelle version.
  • lefeuvr3

    Dans 10 jours j'essaierai de me repencher dessus....on va bien finir par y arriver !