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

MODULO LOTS AUTOAJUSTES TP ST

  • lefeuvr3

    MODULOSTOP_2_2_RSI..VOL..ADX.mq4 ….
    merci de l'améliorer

    Code
    //+------------------------------------------------------------------+ //| MODULOSTOP_2_2_RSI..VOL..ADX.mq4 | //| QPG | EURUSD 1 MN //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "QPG" #property link "https://www.mql5.com" #property version "1.00" //+------------------------------------------------------------------+ //| ModuloStop_2_2.mq4 | //+------------------------------------------------------------------+ int stopOK = 0; // ne pas modifier int sendOK = 0; // ne pas modifier extern double Lots=0.23; // à modifier selon vos moyens extern int long_court=1; // 0 = Long & 1 = Court extern int ecart=100; // diminuer l'écart = + de gain, mais exige un capital plus important extern int gain=26; // no comment ;) extern int adxperiod= 17; extern int adxthreshold=24; extern int rsiperiod=14; extern int rsilower =30; extern int rsiupper =70; //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { // double valeur1 = iAO(Symbol(),0,0); // Connecter à l'indicateur technique >> modif de ModuloStop_2_1********* double booster = Volume[1]> Volume[0] &&iADX(Symbol(),0,adxperiod,PRICE_CLOSE,MODE_MAIN,0)> adxthreshold &&iRSI(Symbol(),0,rsiperiod,PRICE_CLOSE,0)>rsilower && iRSI(Symbol(),0,rsiperiod,PRICE_CLOSE,0)<rsiupper ; Comment(AccountEquity() - AccountBalance()); int type = OrderType(); int type2 = OrderType(); if (Hour()==1 && Minute()==1 && Seconds()==1 && sendOK==0) { sendOK=1;stopOK=0; if(long_court==1 && booster ) //modif de ModuloStop_2_1******************************************************** { OrderSend(Symbol(), OP_SELLSTOP, Lots, Bid-ecart*Point, 0, 0, 0, "Ordre 2 !"); } if(long_court==0 && booster )//modif de ModuloStop_2_1******************************************************** { OrderSend(Symbol(), OP_BUYSTOP, Lots, Ask+ecart*Point, 0, 0, 0, "Ordre 2 !"); } } if (Hour()>=23 && stopOK==0) { stopOK=1;sendOK=0; int u = OrdersTotal() - 1; while (u >= 0) { OrderSelect(u, SELECT_BY_POS); if (type == OP_SELLSTOP || type == OP_BUYSTOP) { OrderDelete(OrderTicket()); } u -= 1; } } if (AccountEquity()>= AccountBalance()+ gain) { int w = OrdersTotal() - 1; while (w >= 0) { OrderSelect(w, SELECT_BY_POS); { OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 2); OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 2); } w -= 1; } } return(0); }
    lefeuvr3 a joint une image
    modulo-lots-autoajustes-tp-st-11060
  • lefeuvr3

    version ameliorée …..merci d'apporter votre pierre à son élaboration
    La taille des lots s'adapte automatiquement au capital
    Code
    //+------------------------------------------------------------------+ //| MODULOSTOP_2_2RSI.VOL.ADX.AUTOAJUSTABLE.mq4 | //| QPG | //| https://www.mql5.com | //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| EURUSD 1 MN //+------------------------------------------------------------------+ #property copyright "QPG" #property link "https://www.mql5.com" #property version "1.00" int stopOK = 0; // ne pas modifier int sendOK = 0; // ne pas modifier //extern double Lots=0.23; // à modifier selon vos moyens extern int long_court=1; // 0 = Long & 1 = Court extern double LotFactor = 40; //lotsize factor extern int ecart=100; // diminuer l'écart = + de gain, mais exige un capital plus important extern int gain=26; // no comment ;) double lot ; extern int adxperiod= 17; extern int adxthreshold=24; extern int rsiperiod=14; extern int rsilower =30; extern int rsiupper =70; //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { // double valeur1 = iAO(Symbol(),0,0); // Connecter à l'indicateur technique >> modif de ModuloStop_2_1********* double booster = Volume[1]> Volume[0] &&iADX(Symbol(),0,adxperiod,PRICE_CLOSE,MODE_MAIN,0)> adxthreshold &&iRSI(Symbol(),0,rsiperiod,PRICE_CLOSE,0)>rsilower && iRSI(Symbol(),0,rsiperiod,PRICE_CLOSE,0)<rsiupper ; Comment(AccountEquity() - AccountBalance()); int type = OrderType(); int type2 = OrderType(); if (Hour()==1 && Minute()==1 && Seconds()==1 && sendOK==0) { sendOK=1;stopOK=0; if(long_court==1 && booster ) //modif de ModuloStop_2_1******************************************************** { bool modif1= OrderSend(Symbol(), OP_SELLSTOP, NR(Lot_Volume()), Bid-ecart*Point, 0, 0, 0, "Ordre 2 !"); } if(long_court==0 && booster )//modif de ModuloStop_2_1******************************************************** { bool modif2= OrderSend(Symbol(), OP_BUYSTOP,NR(Lot_Volume()), Ask+ecart*Point, 0, 0, 0, "Ordre 2 !"); } } if (Hour()>=23 && stopOK==0) { stopOK=1;sendOK=0; int u = OrdersTotal() - 1; while (u >= 0) { if(OrderSelect(u, SELECT_BY_POS)) if (type == OP_SELLSTOP || type == OP_BUYSTOP) { bool modif3=OrderDelete(OrderTicket()); } u -= 1; } } if (AccountEquity()>= AccountBalance()+ gain) { int w = OrdersTotal() - 1; while (w >= 0) { if(OrderSelect(w, SELECT_BY_POS)) { bool modif4= OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 2); bool modif5= OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 2); } w -= 1; } } 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); } //+------------------------------------------------------------------+ //+------------------------------------------------------------------+
    Modifié le 2018-11-27 07:29:21 par lefeuvr3
    lefeuvr3 a joint une image
    modulo-lots-autoajustes-tp-st-11061
Page 2