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

EA MA OPEN CLOSE MTF RSI ADX

  • lefeuvr3

    Merci d'ameliorer mon dernier EA maison
    Je conseille un backtest tous les 15 jours en cas d'utilisation dans un premier temps

    //+------------------------------------------------------------------+
    //
    // QPG MM OPEN CLOSE MTF ADX RSI.mq4
    //
    //+------------------------------------------------------------------+
    // DO NOT DELETE THIS HEADER
    // DELETING THIS HEADER IS COPYRIGHT INFRIGMENT
    //
    // Copyright ©2011, ForexEAdvisor.com
    // ForexEAdvisor Strategy Builder version 0.2
    // http://www.ForexEAdvisor.com
    //
    // THIS EA CODE HAS BEEN GENERATED USING FOREXEADVISOR STRATEGY BUILDER 0.2
    // on: 6/28/2018 12:55:55 PM
    // Disclaimer: This EA is provided to you "AS-IS", and ForexEAdvisor disclaims any warranty
    // or liability obligations to you of any kind.
    // UNDER NO CIRCUMSTANCES WILL FOREXEADVISOR BE LIABLE TO YOU, OR ANY OTHER PERSON OR ENTITY,
    // FOR ANY LOSS OF USE, REVENUE OR PROFIT, LOST OR DAMAGED DATA, OR OTHER COMMERCIAL OR
    // ECONOMIC LOSS OR FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, STATUTORY, PUNITIVE,
    // EXEMPLARY OR CONSEQUENTIAL DAMAGES WHATSOEVER RELATED TO YOUR USE OF THIS EA OR
    // FOREXEADVISOR STRATEGY BUILDER
    // Because software is inherently complex and may not be completely free of errors, you are
    // advised to verify this EA. Before using this EA, please read the ForexEAdvisor Strategy Builder
    // license for a complete understanding of ForexEAdvisor' disclaimers.
    // USE THIS EA AT YOUR OWN RISK.
    //
    // Before adding this expert advisor to a chart, make sure there are NO
    // open positions.
    // DO NOT DELETE THIS HEADER
    // DELETING THIS HEADER IS COPYRIGHT INFRIGMENT
    //+------------------------------------------------------------------+
    extern int MagicNumber=20180807;
    extern double Lots =0.01;
    extern double StopLoss=96;
    extern double TakeProfit=104;
    extern int TrailingStop=80;
    extern int Slippage=3;
    extern string Per="periode MM";
    extern int PEROM1=34;
    extern int PERCM1=1;
    extern int PEROM15=10;
    extern int PERCM15=24;
    extern int PEROH1=4;
    extern int PERCH1=3;
    extern string mod="Mode MM";
    //MODE_SMA=0
    //Simple Moving Average
    //Equal weight is given to each price over the calculation period. Bias: Smooth (anti-noise)
    //MODE_EMA=1 Exponential Moving Average
    // More weight is given to recent prices in attempt to reduce lag. Bias: Speed (anti-lag)
    //MODE_SMMA=2
    // Smoothed Moving Average
    // Similar to a SMA; however, rather than subtracting the oldest value, the previous smoothed average value is subtracted. Bias: Smooth (anti-noise)
    //MODE_LWMA=3
    //Linear Weighted Moving Average
    //Designed to put more weight on recent data and less weight on past data. Bias: Speed (anti-lag)
    extern int MODEMA=1;
    extern int adxperiod =26;
    extern int adxthreshold =22;

    extern int shift0pen0 =1;
    extern int shift0pen1=0;
    extern int shiftClose0=0;
    extern int shiftClose1=1;
    double Timeframe=0;
    //+------------------------------------------------------------------+
    // expert start function
    //+------------------------------------------------------------------+
    int start()
    {
    double MyPoint=Point;
    if(Digits==3 || Digits==5) MyPoint=Point*10;

    double TheStopLoss=0;
    double TheTakeProfit=0;
    if( TotalOrdersCount()==0 )
    {
    int result=0;

    // Here is your open buy rule
    if(iMA(NULL,PERIOD_M1,PEROM1,0,MODEMA,PRICE_OPEN,shift0pen0)>iMA(NULL,PERIOD_M1,PERCM1,0,MODEMA,PRICE_CLOSE,shiftClose0)&&iMA(NULL,PERIOD_M1,PEROM1,1,MODEMA,PRICE_OPEN,shift0pen1)<iMA(NULL,PERIOD_M1,PERCM1,1,MODEMA,PRICE_CLOSE,shiftClose1)&&
    iMA(NULL,PERIOD_M15,PEROM15,0,MODEMA,PRICE_OPEN,shift0pen0)>iMA(NULL,PERIOD_M15,PERCM15,0,MODEMA,PRICE_CLOSE,shiftClose0)&&iMA(NULL,PERIOD_M15,PEROM15,1,MODEMA,PRICE_OPEN,shift0pen1)<iMA(NULL,PERIOD_M15,PERCM15,1,MODEMA,PRICE_CLOSE,shiftClose1)&&
    iMA(NULL,PERIOD_H1,PEROH1,0,MODEMA,PRICE_OPEN,shift0pen0)>iMA(NULL,PERIOD_H1,PERCH1,0,MODEMA,PRICE_CLOSE,shiftClose0)&&iMA(NULL,PERIOD_H1,PEROH1,1,MODEMA,PRICE_OPEN,shift0pen1)<iMA(NULL,PERIOD_H1,PERCH1,1,MODEMA,PRICE_CLOSE,shiftClose1) // Here is your open buy rule
    &&(iADX(Symbol(),Timeframe,adxperiod,PRICE_CLOSE,MODE_MAIN,0)>adxthreshold )

    )
    {
    result=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,0,0,"EA Generator www.ForexEAdvisor.com",MagicNumber,0,Blue);
    if(result>0)
    {
    TheStopLoss=0;
    TheTakeProfit=0;
    if(TakeProfit>0) TheTakeProfit=Ask+TakeProfit*MyPoint;
    if(StopLoss>0) TheStopLoss=Ask-StopLoss*MyPoint;
    if(OrderSelect(result,SELECT_BY_TICKET)==true)
    bool modif1= OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(TheStopLoss,Digits),NormalizeDouble(TheTakeProfit,Digits),0,Green);
    }
    return(0);
    }
    // Here is your open Sell rule
    if(iMA(NULL,PERIOD_M1,PEROM1,0,MODEMA,PRICE_OPEN,shift0pen0)<iMA(NULL,PERIOD_M1,PERCM1,0,MODEMA,PRICE_CLOSE,shiftClose0)&&iMA(NULL,PERIOD_M1,PEROM1,1,MODEMA,PRICE_OPEN,shift0pen1)>iMA(NULL,PERIOD_M1,PERCM1,1,MODEMA,PRICE_CLOSE,shiftClose1)&& // Here is your open Sell rule
    iMA(NULL,PERIOD_M15,PEROM15,0,MODEMA,PRICE_OPEN,shift0pen0)<iMA(NULL,PERIOD_M15,PERCM15,0,MODEMA,PRICE_CLOSE,shiftClose0)&&iMA(NULL,PERIOD_M15,PEROM15,1,MODEMA,PRICE_OPEN,shift0pen1)>iMA(NULL,PERIOD_M15,PERCM15,1,MODEMA,PRICE_CLOSE,shiftClose1)
    &&iMA(NULL,PERIOD_H1,PEROH1,0,MODEMA,PRICE_OPEN,shift0pen0)<iMA(NULL,PERIOD_H1,PERCH1,0,MODEMA,PRICE_CLOSE,shiftClose0)&&iMA(NULL,PERIOD_H1,PEROH1,1,MODEMA,PRICE_OPEN,shift0pen1)>iMA(NULL,PERIOD_H1,PERCH1,1,MODEMA,PRICE_CLOSE,shiftClose1)
    &&(iADX(Symbol(),Timeframe,adxperiod,PRICE_CLOSE,MODE_MAIN,0)>adxthreshold )

    )
    {
    result=OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,0,0,"EA Generator www.ForexEAdvisor.com",MagicNumber,0,Red);
    if(result>0)
    {
    TheStopLoss=0;
    TheTakeProfit=0;
    if(TakeProfit>0) TheTakeProfit=Bid-TakeProfit*MyPoint;
    if(StopLoss>0) TheStopLoss=Bid+StopLoss*MyPoint;
    if (OrderSelect(result,SELECT_BY_TICKET)==true)
    bool modif2= OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(TheStopLoss,Digits),NormalizeDouble(TheTakeProfit,Digits),0,Green);
    }
    return(0);
    }
    }

    for(int cnt=0;cnt<OrdersTotal();cnt++)
    {

    if(OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES)==true)
    if(OrderType()<=OP_SELL &&
    OrderSymbol()==Symbol() &&
    OrderMagicNumber()==MagicNumber
    )
    {
    if(OrderType()==OP_BUY)
    {
    if(iMA(NULL,PERIOD_M1,PEROM1,0,MODEMA,PRICE_OPEN,shift0pen0)<iMA(NULL,PERIOD_M1,PERCM1,0,MODEMA,PRICE_CLOSE,shiftClose0)&&iMA(NULL,PERIOD_M1,PEROM1,1,MODEMA,PRICE_OPEN,shift0pen1)>iMA(NULL,PERIOD_M1,PERCM1,1,MODEMA,PRICE_CLOSE,shiftClose1)&& //here is your close buy rule
    iMA(NULL,PERIOD_M15,PEROM15,0,MODEMA,PRICE_OPEN,shift0pen0)<iMA(NULL,PERIOD_M15,PERCM15,0,MODEMA,PRICE_CLOSE,shiftClose0)&&iMA(NULL,PERIOD_M15,PEROM15,1,MODEMA,PRICE_OPEN,shift0pen1)>iMA(NULL,PERIOD_M15,PERCM15,1,MODEMA,PRICE_CLOSE,shiftClose1)
    &&iMA(NULL,PERIOD_H1,PEROH1,0,MODEMA,PRICE_OPEN,shift0pen0)<iMA(NULL,PERIOD_H1,PERCH1,0,MODEMA,PRICE_CLOSE,shiftClose0)&&iMA(NULL,PERIOD_H1,PEROH1,1,MODEMA,PRICE_OPEN,shift0pen1)>iMA(NULL,PERIOD_H1,PERCH1,1,MODEMA,PRICE_CLOSE,shiftClose1) //here is your close buy rule
    &&(iADX(Symbol(),Timeframe,adxperiod,PRICE_CLOSE,MODE_MAIN,0)>adxthreshold )

    )
    {
    bool modif5= OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),Slippage,Red);
    }
    if(TrailingStop>0)
    {
    if(Bid-OrderOpenPrice()>MyPoint*TrailingStop)
    {
    if(OrderStopLoss()<Bid-MyPoint*TrailingStop)
    {
    bool modif3= OrderModify(OrderTicket(),OrderOpenPrice(),Bid-TrailingStop*MyPoint,OrderTakeProfit(),0,Green);
    return(0);
    }
    }
    }
    }
    else
    {
    if(iMA(NULL,PERIOD_M1,PEROM1,0,MODEMA,PRICE_OPEN,shift0pen0)>iMA(NULL,PERIOD_M1,PERCM1,0,MODEMA,PRICE_CLOSE,shiftClose0)&&iMA(NULL,PERIOD_M1,PEROM1,1,MODEMA,PRICE_OPEN,shift0pen1)<iMA(NULL,PERIOD_M1,PERCM1,1,MODEMA,PRICE_CLOSE,shiftClose1)&& // here is your close sell rule
    iMA(NULL,PERIOD_M15,PEROM15,0,MODEMA,PRICE_OPEN,shift0pen0)>iMA(NULL,PERIOD_M15,PERCM15,0,MODEMA,PRICE_CLOSE,shiftClose0)&&iMA(NULL,PERIOD_M15,PEROM15,1,MODEMA,PRICE_OPEN,shift0pen1)<iMA(NULL,PERIOD_M15,PERCM15,1,MODEMA,PRICE_CLOSE,shiftClose1)
    &&iMA(NULL,PERIOD_H1,PEROH1,0,MODEMA,PRICE_OPEN,shift0pen0)>iMA(NULL,PERIOD_H1,PERCH1,0,MODEMA,PRICE_CLOSE,shiftClose0)&&iMA(NULL,PERIOD_H1,PEROH1,1,MODEMA,PRICE_OPEN,shift0pen1)<iMA(NULL,PERIOD_H1,PERCH1,1,MODEMA,PRICE_CLOSE,shiftClose1) // here is your close sell rule
    &&(iADX(Symbol(),Timeframe,adxperiod,PRICE_CLOSE,MODE_MAIN,0)>adxthreshold )

    )
    {
    bool modif6= OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),Slippage,Red);
    }
    if(TrailingStop>0)
    {
    if((OrderOpenPrice()-Ask)>(MyPoint*TrailingStop))
    {
    if((OrderStopLoss()>(Ask+MyPoint*TrailingStop)) || (OrderStopLoss()==0))
    {
    bool modif4= OrderModify(OrderTicket(),OrderOpenPrice(),Ask+MyPoint*TrailingStop,OrderTakeProfit(),0,Red);
    return(0);
    }
    }
    }
    }
    }
    }
    return(0);
    }

    int TotalOrdersCount()
    {
    int result=0;
    for(int i=0;i<OrdersTotal();i++)
    {
    if(OrderSelect(i,SELECT_BY_POS ,MODE_TRADES)==true)
    if (OrderMagicNumber()==MagicNumber) result++;

    }
    return (result);
    }
    lefeuvr3 a joint une image
    ea-ma-open-close-mtf-rsi-adx-10915
  • lefeuvr3

    Utilisation sur EURUSD 1 minute
    EA sans martingale….moindre gain mais plus securisant
  • lefeuvr3

    Variante du precedent EA avec lots automatiquement ajustes

    //+------------------------------------------------------------------+
    // DO NOT DELETE THIS HEADER
    // DELETING THIS HEADER IS COPYRIGHT INFRIGMENT
    //
    // Copyright ©2011, ForexEAdvisor.com
    // ForexEAdvisor Strategy Builder version 0.2
    // http://www.ForexEAdvisor.com
    //
    // THIS EA CODE HAS BEEN GENERATED USING FOREXEADVISOR STRATEGY BUILDER 0.2
    // on: 6/29/2018 5:57:54 PM
    // Disclaimer: This EA is provided to you "AS-IS", and ForexEAdvisor disclaims any warranty
    // or liability obligations to you of any kind.
    // UNDER NO CIRCUMSTANCES WILL FOREXEADVISOR BE LIABLE TO YOU, OR ANY OTHER PERSON OR ENTITY,
    // FOR ANY LOSS OF USE, REVENUE OR PROFIT, LOST OR DAMAGED DATA, OR OTHER COMMERCIAL OR
    // ECONOMIC LOSS OR FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, STATUTORY, PUNITIVE,
    // EXEMPLARY OR CONSEQUENTIAL DAMAGES WHATSOEVER RELATED TO YOUR USE OF THIS EA OR
    // FOREXEADVISOR STRATEGY BUILDER
    // Because software is inherently complex and may not be completely free of errors, you are
    // advised to verify this EA. Before using this EA, please read the ForexEAdvisor Strategy Builder
    // license for a complete understanding of ForexEAdvisor' disclaimers.
    // USE THIS EA AT YOUR OWN RISK.
    //
    // Before adding this expert advisor to a chart, make sure there are NO
    // open positions.
    // DO NOT DELETE THIS HEADER
    // DELETING THIS HEADER IS COPYRIGHT INFRIGMENT
    //+------------------------------------------------------------------+
    //+------------------------------------------------------------------+
    //| QPG MA MTF +++ RSI ADX LOTS AJUSTES |
    //+------------------------------------------------------------------+
    #property copyright "Copyright 2014, zeshan tayyab malick, June 21st 2014"
    #property link "[email protected]"

    double LotSize; //lotsize
    extern double LotFactor = 4.5; //lotsize factor
    extern int StopLoss=5000; //stop loss
    extern int TakeProfit=70; //take profit
    extern int MagicNumber=1234; //magic
    double pips = 0.00001; //leave as default for 5 digit brokers
    extern int adxthreshold = 27; //adx threshold - must be greater than this to trade
    extern int adxperiod = 14; //adx period
    extern int rsiperiod = 14; //rsi period
    extern int rsiupper = 65; //rsi upper bound, wont buy above this value
    extern int rsilower = 35; //rsi lower bound, wont sell below this value
    extern string Per="periode MM";
    extern int PEROM1=15;
    extern int PERCM1=7;
    extern int PEROM15=14;
    extern int PERCM15=22;
    extern int PEROH1=5;
    extern int PERCH1=5;
    extern int PEROD1=5;
    extern int PERCD1=5;
    extern string mod="Mode MM";
    //
    //MODE_SMA=0
    //Simple Moving Average
    //Equal weight is given to each price over the calculation period. Bias: Smooth (anti-noise)
    //MODE_EMA=1 Exponential Moving Average
    // More weight is given to recent prices in attempt to reduce lag. Bias: Speed (anti-lag)
    //MODE_SMMA=2
    // Smoothed Moving Average
    // Similar to a SMA; however, rather than subtracting the oldest value, the previous smoothed average value is subtracted. Bias: Smooth (anti-noise)
    //MODE_LWMA=3
    //Linear Weighted Moving Average
    //Designed to put more weight on recent data and less weight on past data. Bias: Speed (anti-lag)
    //
    extern int MODEMA=1;
    //+------------------------------------------------------------------+
    //| 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;
    //----
    if(IsNewCandle())
    {
    trenddirection(); //find trend direction
    logic(); //apply indicator logic
    Lot_Volume(); //calc lotsize
    buyorsell(); //trade - buy or sell


    return(0);
    }
    return(0);
    }
    //+------------------------------------------------------------------+
    //+------------------------------------------------------------------+
    //+------------------------------------------------------------------+
    //insuring its a new candle function
    //+------------------------------------------------------------------+
    bool IsNewCandle()
    {
    static int BarsOnChart=0;
    if (Bars == BarsOnChart)
    return (false);
    BarsOnChart = Bars;
    return(true);
    }
    //+------------------------------------------------------------------+
    //identifies the direction of the current trend
    //+------------------------------------------------------------------+
    bool trenddirection()
    {

    //----
    if(iMA(NULL,PERIOD_M1,PEROM1,0,MODEMA,PRICE_OPEN,0)>iMA(NULL,PERIOD_M1,PERCM1,0,MODEMA,PRICE_CLOSE,0)&&iMA(NULL,PERIOD_M1,PEROM1,1,MODEMA,PRICE_OPEN,1)<iMA(NULL,PERIOD_M1,PERCM1,1,MODEMA,PRICE_CLOSE,1)&& // Here is your open buy rule
    iMA(NULL,PERIOD_M15,PEROM15,0,MODEMA,PRICE_OPEN,0)>iMA(NULL,PERIOD_M15,PERCM15,0,MODEMA,PRICE_CLOSE,0)&&iMA(NULL,PERIOD_M15,PEROM15,1,MODEMA,PRICE_OPEN,1)<iMA(NULL,PERIOD_M15,PERCM15,1,MODEMA,PRICE_CLOSE,1)&&// bullish
    iMA(NULL,PERIOD_H1,PEROH1,0,MODEMA,PRICE_OPEN,0)>iMA(NULL,PERIOD_H1,PERCH1,0,MODEMA,PRICE_CLOSE,0)&&iMA(NULL,PERIOD_H1,PEROH1,1,MODEMA,PRICE_OPEN,1)<iMA(NULL,PERIOD_H1,PERCH1,1,MODEMA,PRICE_CLOSE,1)&&// bullish
    iMA(NULL,PERIOD_D1,PEROD1,0,MODEMA,PRICE_OPEN,0)>iMA(NULL,PERIOD_D1,PERCD1,0,MODEMA,PRICE_CLOSE,0)&&iMA(NULL,PERIOD_D1,PEROD1,1,MODEMA,PRICE_OPEN,1)<iMA(NULL,PERIOD_D1,PERCD1,1,MODEMA,PRICE_CLOSE,1))// bullish

    {
    return(true);
    }

    if(iMA(NULL,PERIOD_M1,PEROM1,0,MODEMA,PRICE_OPEN,0)<iMA(NULL,PERIOD_M1,PERCM1,0,MODEMA,PRICE_CLOSE,0)&&iMA(NULL,PERIOD_M1,PEROM1,1,MODEMA,PRICE_OPEN,1)>iMA(NULL,PERIOD_M1,PERCM1,1,MODEMA,PRICE_CLOSE,1)&& // Here is your open Sell rule
    iMA(NULL,PERIOD_M15,PEROM15,0,MODEMA,PRICE_OPEN,0)<iMA(NULL,PERIOD_M15,PERCM15,0,MODEMA,PRICE_CLOSE,0)&&iMA(NULL,PERIOD_M15,PEROM15,1,MODEMA,PRICE_OPEN,1)>iMA(NULL,PERIOD_M15,PERCM15,1,MODEMA,PRICE_CLOSE,1)&&// bearish
    iMA(NULL,PERIOD_H1,PEROH1,0,MODEMA,PRICE_OPEN,0)<iMA(NULL,PERIOD_H1,PERCH1,0,MODEMA,PRICE_CLOSE,0)&&iMA(NULL,PERIOD_H1,PEROH1,1,MODEMA,PRICE_OPEN,1)>iMA(NULL,PERIOD_H1,PERCH1,1,MODEMA,PRICE_CLOSE,1)&&// bearish
    iMA(NULL,PERIOD_D1,PEROD1,0,MODEMA,PRICE_OPEN,0)<iMA(NULL,PERIOD_D1,PERCD1,0,MODEMA,PRICE_CLOSE,0)&&iMA(NULL,PERIOD_D1,PEROD1,1,MODEMA,PRICE_OPEN,1)>iMA(NULL,PERIOD_D1,PERCD1,1,MODEMA,PRICE_CLOSE,1))// bearish
    {
    return(false);
    }
    ////////////////////////////////////////////////////////////////////////////////////////////////////////

    return(0);
    }
    //+------------------------------------------------------------------+
    //applies logic from indicators ADX and RSI to determine if we can trade
    //+------------------------------------------------------------------+
    int logic()
    {
    double adx,rsi;

    adx = iADX(Symbol(),0,adxperiod,PRICE_CLOSE,MODE_MAIN,0);
    rsi = iRSI(Symbol(),0,rsiperiod,PRICE_CLOSE,0);

    if(adx > adxthreshold)
    {

    if(rsi > rsilower && rsi < rsiupper)

    {

    return(1);

    }

    }

    return(0);

    }
    //+------------------------------------------------------------------+
    //opens trades
    //+------------------------------------------------------------------+
    int buyorsell()
    {
    bool trenddirectionx, logicx;
    int TicketNumber;
    trenddirectionx = trenddirection();
    logicx = logic();


    if(OrdersTotal() == 0)
    {
    if(trenddirectionx == true && logicx == 1 )

    {

    //buy

    TicketNumber = OrderSend(Symbol(),OP_BUY,LotSize,Ask,3,Ask-(StopLoss*pips),Ask+(TakeProfit*pips),NULL,MagicNumber,0,Green);

    if( TicketNumber > 0 )
    {
    Print("Order placed # ", TicketNumber);
    }
    else
    {
    Print("Order Send failed, error # ", GetLastError() );
    }


    }
    }
    if(OrdersTotal() == 0)
    {
    if(trenddirectionx == false && logicx == 1 )
    //sell
    {

    TicketNumber = OrderSend(Symbol(),OP_SELL,LotSize,Bid,3,Bid+(StopLoss*pips),Bid-(TakeProfit*pips),NULL,MagicNumber,0,Red);
    if( TicketNumber > 0 )
    {
    Print("Order placed # ", TicketNumber);
    }
    else
    {
    Print("Order Send failed, error # ", GetLastError() );
    }

    }
    }
    return(0);

    }

    //+------------------------------------------------------------------+
    //calculates lot size based on balance and factor
    //+------------------------------------------------------------------+
    double Lot_Volume()
    {
    double lot;

    if (AccountBalance()>=50) lot=0.02;
    if (AccountBalance()>=75) lot=0.03;
    if (AccountBalance()>=100) lot=0.04;
    if (AccountBalance()>=125) lot=0.05;
    if (AccountBalance()>=150) lot=0.06;
    if (AccountBalance()>=175) lot=0.07;
    if (AccountBalance()>=200) lot=0.08;
    if (AccountBalance()>=225) lot=0.09;
    if (AccountBalance()>=250) lot=0.1;
    if (AccountBalance()>=275) lot=0.11;
    if (AccountBalance()>=300) lot=0.12;
    if (AccountBalance()>=325) lot=0.13;
    if (AccountBalance()>=350) lot=0.14;
    if (AccountBalance()>=375) lot=0.15;
    if (AccountBalance()>=400) lot=0.16;
    if (AccountBalance()>=425) lot=0.17;
    if (AccountBalance()>=450) lot=0.18;
    if (AccountBalance()>=475) lot=0.19;
    if (AccountBalance()>=500) lot=0.2;
    if (AccountBalance()>=550) lot=0.24;
    if (AccountBalance()>=600) lot=0.26;
    if (AccountBalance()>=650) lot=0.28;
    if (AccountBalance()>=700) lot=0.3;
    if (AccountBalance()>=750) lot=0.32;
    if (AccountBalance()>=800) lot=0.34;
    if (AccountBalance()>=850) lot=0.36;
    if (AccountBalance()>=900) lot=0.38;
    if (AccountBalance()>=1000) lot=0.4;
    if (AccountBalance()>=1500) lot=0.6;
    if (AccountBalance()>=2000) lot=0.8;
    if (AccountBalance()>=2500) lot=1.0;
    if (AccountBalance()>=3000) lot=1.2;
    if (AccountBalance()>=3500) lot=1.4;
    if (AccountBalance()>=4000) lot=1.6;
    if (AccountBalance()>=4500) lot=1.8;
    if (AccountBalance()>=5000) lot=2.0;
    if (AccountBalance()>=5500) lot=2.2;
    if (AccountBalance()>=6000) lot=2.4;
    if (AccountBalance()>=7000) lot=2.8;
    if (AccountBalance()>=8000) lot=3.2;
    if (AccountBalance()>=9000) lot=3.6;
    if (AccountBalance()>=10000) lot=4.0;
    if (AccountBalance()>=15000) lot=6.0;
    if (AccountBalance()>=20000) lot=8.0;
    if (AccountBalance()>=30000) lot=12;
    if (AccountBalance()>=40000) lot=16;
    if (AccountBalance()>=50000) lot=20;
    if (AccountBalance()>=60000) lot=24;
    if (AccountBalance()>=70000) lot=28;
    if (AccountBalance()>=80000) lot=32;
    if (AccountBalance()>=90000) lot=36;
    if (AccountBalance()>=100000) lot=40;
    if (AccountBalance()>=200000) lot=80;

    LotSize=lot/LotFactor;
    return(LotSize);
    }
    lefeuvr3 a joint une image
    ea-ma-open-close-mtf-rsi-adx-10924
  • AliX

    Essayez d'utiliser les balises [code] [/code ] j'ai quelquefois du mal à le faire pour vous ;)
  • Lebenet

    Bonjour Lefeuvr3,

    Je suis en train de récrire ton EA en LUA (j'utilise la plateforme TSII de FXCM).
    Je voudrais savoir si dans ta 2ème version, tu clôtures un achat dès qu'une vente s'enclenche ?
    Ou bien laisse-tu les ordres vivrent leur vie ?
    Je ne suis pas à l'aise avec le MT4, donc si tu peux m'éclairer ?
    La version LUA me permettra de lancer ton algo sous l'optimizer et donc trouver les meilleurs paramètres.
    Par contre, existe-t-il un outil du même type en MT4 ou bien faut-il backtester un par un en choisissant les paramètres manuellement ?

    Lebenet.
    Modifié le 2018-08-09 07:29:08 par Lebenet
  • lefeuvr3

    Bonjour Alix
    Je vais essayer
  • lefeuvr3

    Lebenet

    Je ne sais pas ce que je fais.
    Mes EA sont des legos
    Je n'ai fait qu'assembler des briques intéressantes prises ça et là dans d'autres EA
    Cela me permet de faire très rapidement un EA
    Pour les back tests j'utilise ma plateforme MT4 qui est très performante pour cela.

    Mon prochain challenge serait de transformer un mauvais EA en une bombe performante :)

    Hier j'ai fait un nouvel EA ,finalise et back teste ...encore plus performant ….j' adore me torturer les meninges :)
    lefeuvr3 a joint une image
    ea-ma-open-close-mtf-rsi-adx-10925
  • Lebenet

    C'est bien de se torturer les méninges, cela ouvre des perspectives :)

    J'ai aussi créé de très nombreuses stratégies (EA) et cela m'a permis de déterminer ce qui était pertinent à utiliser (à mon sens).
    J'en suis à plus de 150 indicateurs et plus de 100 stratégies.
    Certaines sont des daubes tandis que d'autres laissent entrevoir des possibilités.
  • lefeuvr3

    Pour les EA
    Une fois back testés ...je fais comme pour le bon vin ( rappel un verre de vin par jour équivaut a une heure de pratique sportive ) ...je les laisse vieillir pour voir quelques temps apres ce que cela donne sans changer les parametres :)

    En 2012 j'ai réaliser une trentaine de EA mais mon métier trop prenant ma empêché de poursuivre et de tout façon les résultats n'étaient pas à la clé

    J'ai repris depuis peu depuis que je suis a la retraite et mes nouveaux EA sont vraiment bien meilleurs...comme quoi on peut se bonifier avec le temps :)
  • Lebenet

    En effet, le temps est le principal frein ... entre le boulot et la famille, dur dur de trouver le temps de tout faire ;)
    Quand à la retraite, je dois encore patienter ... je n'en suis qu'à la moitié !

    Sinon, cela t'intéresse-t-il d'échanger sur nos EA/stratégies respectives ?
    Si oui, il faudra jongler car j'ai tout développé en LUA sur la Trading Station.
    J'ai même développé des EA en Excel (Visual Basic) ...
    Quand au MT4, je m'y met doucement mais uniquement pour pouvoir échanger avec d'autres personnes.