Existing EA, integrate ATR trailingstop & bug fixing

MQL5 专家

工作已完成

执行时间17 天
客户反馈
GOOD JOB Recommend him

指定

 

the current code is a break out ea .

 

Stop opening Trades after the first trade. only the first trade after the breakout should be trade.

After that, the ea must wait untill the price breaks out and trade again. every entry must be recognized.

 

Input Variables ( tradehours) where I can put time in, like 08:00 untill 22:00 o'clock. (8 am to 10 pm)

integrate an ATR  trailing stop with enable - disable choice  ( period of ATR must be able to put in.

 

give your price / days 

 //////////////////////////////////////////////////code/////////////////////////////////////////////////////////

void OnTick(){

   double Ask=SymbolInfoDouble(_Symbol, SYMBOL_ASK);

   double Bid=SymbolInfoDouble(_Symbol, SYMBOL_BID);

   double Poin=SymbolInfoDouble(_Symbol, SYMBOL_POINT);

   int Dig=(int)SymbolInfoInteger(_Symbol, SYMBOL_DIGITS);

   int stopLevel=(int)SymbolInfoInteger(_Symbol, SYMBOL_TRADE_STOPS_LEVEL);

      

   MqlRates mrate[];

   CopyRates(_Symbol,_Period,0,4,mrate);


   double close3=mrate[0].close;  // bar 3

   double close2=mrate[1].close;  // bar 2

   double close1=mrate[2].close;  // bar 1

   double close0=mrate[3].close;  // bar 0


   double open3=mrate[0].open;    // bar 3

   double open2=mrate[1].open;    // bar 2

   double open1=mrate[2].open;    // bar 1

   double open0=mrate[3].open;    // bar 0

   

   double low3=mrate[0].low;    // bar 3

   double low2=mrate[1].low;    // bar 2

   double low1=mrate[2].low;    // bar 1

   double low0=mrate[3].low;    // bar 0

   

   double high3=mrate[0].high;    // bar 3

   double high2=mrate[1].high;    // bar 2

   double high1=mrate[2].high;    // bar 1

   double high0=mrate[3].high;    // bar 0

   

   datetime time3=mrate[0].time;

   datetime time2=mrate[1].time;

   datetime time1=mrate[2].time;

   datetime time0=mrate[3].time;


   double  upLine0=0,upLine1=0,upLine2=0, upLine3=0, dnLine0=0,dnLine1=0, dnLine2=0, dnLine3=0 ;

 

   if(ObjectFind(0,levels_sirname+"_UpName")>-1){

      upLine0=ObjectGetValueByTime(0,levels_sirname+"_UpName",time0);

      upLine1=ObjectGetValueByTime(0,levels_sirname+"_UpName",time1);

      upLine2=ObjectGetValueByTime(0,levels_sirname+"_UpName",time2);

      upLine3=ObjectGetValueByTime(0,levels_sirname+"_UpName",time3);

   } 


   if(ObjectFind(0,levels_sirname+"_DnName")>-1){

      dnLine0=ObjectGetValueByTime(0,levels_sirname+"_DnName",time0);

      dnLine1=ObjectGetValueByTime(0,levels_sirname+"_DnName",time1);

      dnLine2=ObjectGetValueByTime(0,levels_sirname+"_DnName",time2);

      dnLine3=ObjectGetValueByTime(0,levels_sirname+"_DnName",time3);

   } 

 

   if (trail_==TRFIX_){

      if (trailStop>0)

         fSimpleTrailing(trailStop);

   }

   

   if (trail_==TRSTOP_)

      fSimpleTrailing(slPp);

    

   if(PositionSelect(_Symbol)==false)

   {

      double sl=0,tp=0;

      if (time0!=lastOrder){

// dont change this settings below, they finde every entry

      if (upLine0>0 && close1>open1 && close0>open0 && low1>upLine1 && low1<low0 && Ask>high1 ){

         sl=low1;

         if ((Ask-sl)/Poin<stopLevel)

            sl=NormalizeDouble(Ask-stopLevel*Poin,Dig);

         slPp=(int)((Ask-sl)/Poin);

         if (tp_==EXITNO_) tp=0;

         if (tp_==EXIT11_) tp=NormalizeDouble(Ask+slPp*Poin,Dig); 

         if (tp_==EXIT12_) tp=NormalizeDouble(Ask+slPp*2*Poin,Dig);

         if (tp_==EXIT13_) tp=NormalizeDouble(Ask+slPp*3*Poin,Dig);

         if (tp_==EXIT14_) tp=NormalizeDouble(Ask+slPp*4*Poin,Dig);

         if (tp_==FIX_) 

            if(takeProfit>0) tp=NormalizeDouble(Ask+takeProfit*Poin,Dig); else sl=0;

         Trade.Buy(NormLot(_Symbol,lots),_Symbol,Ask,sl,tp,"");

         lastOrder=time0;

         return;

      }         

// dont change this settings below, they finde every entry

      if (dnLine0>0 && close1<open1 && close0<open0 && high1<dnLine1 && high1>high0 && Bid<low1  ){

         sl=high1;

         if ((sl-Bid)/Poin<stopLevel)

            sl=NormalizeDouble(Bid+stopLevel*Poin,Dig);

         slPp=(int)((sl-Bid)/Poin);

         if (tp_==EXITNO_) tp=0;

         if (tp_==EXIT11_) tp=NormalizeDouble(Bid-slPp*Poin,Dig); 

         if (tp_==EXIT12_) tp=NormalizeDouble(Bid-slPp*2*Poin,Dig);

         if (tp_==EXIT13_) tp=NormalizeDouble(Bid-slPp*3*Poin,Dig);

         if (tp_==EXIT14_) tp=NormalizeDouble(Bid-slPp*4*Poin,Dig);

         if (tp_==FIX_) 

            if (takeProfit>0) tp=NormalizeDouble(Bid-takeProfit*Poin,Dig); else sl=0;

         Trade.Sell(NormLot(_Symbol,lots),_Symbol,Bid,sl,tp,"");

         lastOrder=time0;

         return;

      }

      }         

   }

}

//+------------------------------------------------------------------+

double NormLot( string symbol, double lot_)

  {

   double LOTSTEP=SymbolInfoDouble(symbol,SYMBOL_VOLUME_STEP);

   double MaxLot=SymbolInfoDouble(symbol,SYMBOL_VOLUME_MAX);

   double MinLot=SymbolInfoDouble(symbol,SYMBOL_VOLUME_MIN);

   if(!LOTSTEP || !MaxLot || !MinLot) return(0);

   double lot=LOTSTEP*MathFloor(lot_/LOTSTEP);

   if(lot<MinLot) lot=MinLot;

   if(lot>MaxLot) lot=MaxLot;

   return(lot);

  }

//+------------------------------------------------------------------+

void fSimpleTrailing(int Trail){

   if(Trail<=0)  return;

   if(!PositionSelect(_Symbol)) return;

   double Ask=SymbolInfoDouble(_Symbol, SYMBOL_ASK);

   double Bid=SymbolInfoDouble(_Symbol, SYMBOL_BID);

   int stopLevel=(int)SymbolInfoInteger(_Symbol, SYMBOL_TRADE_STOPS_LEVEL);

   double nsl,tmsl,psl;  

   switch(Pos.PositionType()){

      case POSITION_TYPE_BUY:

         nsl=NormalizeDouble(Bid-_Point*Trail,_Digits);

            if(nsl>=NormalizeDouble(Pos.PriceOpen(),_Digits)){

               if(nsl>NormalizeDouble(Pos.StopLoss(),_Digits)){

                  tmsl=NormalizeDouble(Bid-_Point*stopLevel,_Digits);

                     if(nsl<tmsl){

                        Trade.PositionModify(_Symbol,nsl,Pos.TakeProfit());

                     }

               }

            }

      break;

      case POSITION_TYPE_SELL:

         nsl=NormalizeDouble(Ask+_Point*Trail,_Digits);

            if(nsl<=NormalizeDouble(Pos.PriceOpen(),_Digits)){

               psl=NormalizeDouble(Pos.StopLoss(),_Digits);

                  if(nsl<psl || psl==0){

                     tmsl=NormalizeDouble(Ask+_Point*stopLevel,_Digits);

                        if(nsl>tmsl){

                           Trade.PositionModify(_Symbol,nsl,Pos.TakeProfit());

                        }

                  }

            }      

      break;

   }

}

 

反馈

1
开发者 1
等级
(647)
项目
1295
67%
仲裁
84
26% / 49%
逾期
338
26%
空闲
2
开发者 2
等级
(90)
项目
159
61%
仲裁
40
18% / 63%
逾期
70
44%
空闲
3
开发者 3
等级
项目
0
0%
仲裁
1
0% / 100%
逾期
0
空闲
相似订单
Hello, I want to make an EA based on SMC and a developer that is familiar with the concept and full understanding of this. Must have done similar jobs before and be able show it. I only want to work with developer that has good track record and is precise. Further information will be handed when contact is made. Developers that has zero rating will not be considered. Listed price is a base point. The project can also
EA DEJA FABRIQUE ? MODIFIER QUELQUE LIGNE POUR LE RENDRE RENTABLE /////////////////////++++++++++++++++++++++++++++++++++ EA AVEC UN SYTEME SIMPLE ; SEULEMENT A MODIFIER %%%%%%%%%%%%%%%%%% SI PERSONNE SACHANT CODER CORRECTEMENT , CE TRAVAIL EST POUR TOI
Trade methodology based on Red and Green lines entering Overbought / Oversold zone. Using confluence of Higher time frame, Moving Average a trade can enter when there is a strong slope angle. Market Base Line is used to determine overall market sentiment. This is designed to be an established trend scalping strategy on lower time frames. To be used initially on demo then real account when settings have been fine
There are six conditions in total . source code from an existing expert will be provided to aid the completion of this job . - Install the following by the Panel (copy paste form my existing Expert ) 1. Pips Lost : number of pips lost ( monthly reset ) 2. Pips Gained : number of pips gained ( monthly reset ) 3. Have a black background to avoid the
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: function (A) Add Transform combine the 4 Expert Advisors into just 1 Expert Advisor, maintaining the individuality of each one Leave in extern (false) or (true)
Description: I am seeking an experienced MQL5 developer to create a custom Expert Advisor (EA) for MetaTrader 5 based on a specific trend-following strategy. The strategy includes precise risk management, advanced trade management features, and additional risk management tools. The EA should be adaptable to any timeframe on which it is attached. Below are the detailed requirements and parameters for the EA: Strategy
I need an EA trading frequently (HFT or something like), and it sould have some features below: 1、Have a clear trading logic 2、Have a good backtest result 3、Have a demonstrated benefitable result in a live account trading 4、Can avoid the news time period or not sensitive to news
Tenho um EA mql4 que está com funcionalidades funcionando e outras com funcionalidades sem funcionar. Tenho um vídeo do EA funcionando como deve funcionar perfeitamente. O meu não consegue seguir o mesmo programa pois quando coloca os pontos de parada e retirada são bem diferentes. Não tenho pressa para tempo, só queria que conseguisse renovar o EA. O arquivo do grafico anexo é como ele se encontra agora. O certo é
New york session based strategy 9:30 open Price takes out buy side or sell side liquidity Usually using 15min high and lows 5m entry Price takes out that high/low and price must close strongly back into the zone Is price is above price we have a sell bias vis versa for buys Sl is at the high or low with option for “offset” for cushion Tp is usually the opposite High or low. Would like the option for set pips-points &
Hello, I am looking for a skilled developer to create an Expert Advisor (EA) for MT4. The EA should close an open trade automatically when a Golden or Death Cross occurs in the Alligator Indicator. Please let me know if you have experience with similar projects and how we can discuss the details further

项目信息

预算