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%
Просрочено
337
26%
Свободен
2
Разработчик 2
Оценка
(90)
Проекты
159
61%
Арбитраж
40
18% / 63%
Просрочено
70
44%
Свободен
3
Разработчик 3
Оценка
Проекты
0
0%
Арбитраж
1
0% / 100%
Просрочено
0
Свободен
Похожие заказы
I need a simple MT5 Expert Advisor based on Bollinger Bands. Requirements: Platform: MetaTrader 5 / MQL5 Buy when price closes below the lower Bollinger Band Sell when price closes above the upper Bollinger Band Bollinger period configurable, default 20 Deviation configurable, default 2.0 Fixed lot size configurable Stop Loss configurable Take Profit configurable Maximum one open position per symbol Use completed
Platform: MT5 / MQL5 Buy khi RSI < 30 Sell khi RSI > 70 RSI period configurable, default 14 Fixed lot configurable SL/TP configurable Max 1 position per symbol Completed candles only Configurable Magic Number Deliver .mq5 source Compile without errors/warnings No martingale/grid No profitability guarantee
Trading bot ea 30+ USD
yoo i want to make a trading bot i have my strategy in videos and also the rules to if anyone can work it out for me i will be glad welcome your bid and it urget let connect here on mgl5 And if you know you can not do the project without getting paid first please don't bid thanks
MT5 EA make work on zone break and candle confirm. Hi i need one expert person who can make exact what i want. My EA logic very simple.... few hrs market high and low make line then candle body close above or low then candle confirmation then pullback then entry RR1:2 no trail nothing,,,,, the line high low create after few hrs of the day i wll tell you later,,,,then 1hrs no trade if break then no trade for the
Hi, I need an Expert Advisor (EA) for MetaTrader 5, for my IC Markets account. Account MT5, hedging account, type: [Raw Spread / Standard: fill in] Deposit: 100 USD, leverage 1:30, account currency: [USD / EUR: fill in] Instruments Forex (major pairs) and gold (XAUUSD) Strategy and parameters may differ per instrument; each instrument must be tested and optimized separately If an instrument cannot be traded safely
المطلوب موشر لتداول الذهب مجرب وقوية يعطي اشاره قوية فقط مع وقف خساره ومختبر ومجرب في حال الموافقه علي لموشر بعد التجربه لمدة ٣ ايام يتم الشراء دايم مبلغ ٢٠٠ دولار
Hi there I need someone who will create an ea then test it .. the ea should only place order on the bid price of it breakout in 1 point using invisible buy and invisible sell,, example if bid breakout in 1 point up automatically invisible buy active then invisible stop loss at where the ask price was same in sell If the bid breakout in 1 point down automatically invisible sell active then invisible stop loss where
I’m looking for an experienced MT5/MQL5 freelancer to help install and configure several existing EAs on IC Markets MT5 accounts using a Windows VPS. The work will include setting up the EAs on separate demo accounts and later running several together on one account with different risk settings. I also need help with MT5 backtesting and strategy optimisation, including comparing different risk levels and reviewing
I am looking for someone to build me a modular auto trader in Sierra chart and an Innie builder so that I can replicate my current Algas that I already have built. I've sent examples below can you please let me know how much you would charge me. I'm pretty good at building the signals myself but I do not know how to build the ocos order entry and I'm trying to get quotes and go with the person who seems they can help
i need price action and candle logic understand programmer need for this job... first understand logic and interested please message .... first understand logic and interested please message .... 2 types of hedge entry conditions: 1 is candle based 1- when i start point ea hh candle buy entry, after ll made 2- below the previous candle hedge sell order 3- if market goes again hh, if sell order profit book again

Информация о проекте

Бюджет