Can you modify this EA to move SL to Breakeven+5pips (lock 5 pips after BE) when it get 20 pips in profit? Thank you.
If someone helps you on this thread so it will be fine.
If not so you may need to consider to use Freelance service for example.
----------------
It is standard reply which I am posting on such the requests (because I am not a coder sorry) -
And this is my other suggestion (which came from tsd 2010 and from tsd 2008):
Coders (any coder) are coding for free -
- if it is interesting for them personally, or
- if it is interesting for many members of this forum.
and Freelance section of the forum should be used in most of the cases.
Can you modify this EA to move SL to Breakeven+5pips (lock 5 pips after BE) when it get 20 pips in profit?
Thank you.
//+------------------------------------------------------------------+ // DO NOT DELETE THIS HEADER // DELETING THIS HEADER IS COPYRIGHT INFRIGMENT //+------------------------------------------------------------------+ extern int MagicNumber=10001; extern double Lots =0.01; extern double StopLoss=30; extern double TakeProfit=0; extern int TrailingStop=0; extern int Slippage=3; extern int BEStopPips=30; extern int BEStopAddPips=5; //+------------------------------------------------------------------+ // expert start function //+------------------------------------------------------------------+ int start() { double MyPoint=Point; if(Digits==3 || Digits==5) MyPoint=Point*10; bool OrderResult; double TheStopLoss=0; double TheTakeProfit=0; if( TotalOrdersCount()==0 ) { int result=0; if((Close[1]>iMA(NULL,0,150,0,MODE_SMA,PRICE_CLOSE,1))&&(iMACD(NULL,0,36,78,27,PRICE_CLOSE,MODE_MAIN,1)<0)&&(iMACD(NULL,0,36,78,27,PRICE_CLOSE,MODE_MAIN,1)>iMACD(NULL,0,36,78,27,PRICE_CLOSE,MODE_MAIN,2))) // Here is your open buy rule { 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; OrderResult=OrderSelect(result,SELECT_BY_TICKET); OrderResult=OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(TheStopLoss,Digits),NormalizeDouble(TheTakeProfit,Digits),0,Green); } return(0); } if((Close[1]<iMA(NULL,0,150,0,MODE_SMA,PRICE_CLOSE,1))&&(iMACD(NULL,0,36,78,27,PRICE_CLOSE,MODE_MAIN,1)>0)&&(iMACD(NULL,0,36,78,27,PRICE_CLOSE,MODE_MAIN,1)<iMACD(NULL,0,36,78,27,PRICE_CLOSE,MODE_MAIN,2))) // Here is your open Sell rule { 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; OrderResult=OrderSelect(result,SELECT_BY_TICKET); OrderResult=OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(TheStopLoss,Digits),NormalizeDouble(TheTakeProfit,Digits),0,Green); } return(0); } } for(int cnt=0;cnt<OrdersTotal();cnt++) { OrderResult=OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); if(OrderType()<=OP_SELL && OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber ) { if(OrderType()==OP_BUY) { if((Close[1]<iMA(NULL,0,150,0,MODE_SMA,PRICE_CLOSE,1))&&(iMACD(NULL,0,36,78,27,PRICE_CLOSE,MODE_MAIN,1)>0)&&(iMACD(NULL,0,36,78,27,PRICE_CLOSE,MODE_MAIN,1)<iMACD(NULL,0,36,78,27,PRICE_CLOSE,MODE_MAIN,2))) //here is your close buy rule { OrderResult= OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),Slippage,Red); } if(TrailingStop>0) { if((OrderOpenPrice()+ BEStopPips*MyPoint)>Bid) { OrderResult= OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble((OrderOpenPrice()+BEStopAddPips*MyPoint),Digits),OrderTakeProfit(),0,Green); return(0); } } } else { if((Close[1]>iMA(NULL,0,150,0,MODE_SMA,PRICE_CLOSE,1))&&(iMACD(NULL,0,36,78,27,PRICE_CLOSE,MODE_MAIN,1)<0)&&(iMACD(NULL,0,36,78,27,PRICE_CLOSE,MODE_MAIN,1)>iMACD(NULL,0,36,78,27,PRICE_CLOSE,MODE_MAIN,2))) // here is your close sell rule { OrderResult= OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),Slippage,Red); } if(TrailingStop>0) { if((OrderOpenPrice()- BEStopPips*MyPoint)<Ask) { OrderResult= OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble((OrderOpenPrice()-BEStopAddPips*MyPoint),Digits),OrderTakeProfit(),0,Green); return(0); } } } } } return(0); } int TotalOrdersCount() { int result=0; for(int i=0;i<OrdersTotal();i++) { result=OrderSelect(i,SELECT_BY_POS ,MODE_TRADES); if (OrderMagicNumber()==MagicNumber) result++; } return (result); }
I fixed the warning messages in your code. In fact, this is the code I sent you.
It should not give error and warning messages when compiled.
after test: result
- old : full open/close buy/sell
- mod : miss some open/close buy/sell + working but when profit is less than 20 pips EA MOD converted SL to Breakeven + 5pips (5 pips lock after BE) (i need EA to move SL to Breakeven+5pips (lock 5 pips after BE) when it get (ABOVE) 20 pips in profit )
please fix error
but when profit is less than 20 pips EA MOD converted SL to Breakeven + 5pips (5 pips lock after BE) (i need EA to move SL to Breakeven+5pips (lock 5 pips after BE) when it get (ABOVE) 20 pips in profit )
please fix error
you can do it yourself -
you define variables here
extern int BEStopPips=30; extern int BEStopAddPips=5;
& here you use them as condition for BUY_OP
if((OrderOpenPrice()+ BEStopPips*MyPoint)>Bid) { OrderResult= OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble((OrderOpenPrice()+BEStopAddPips*MyPoint),Digits),OrderTakeProfit(),0,Green); return(0); }
& below a little bit different logics for SELL_OP... try to read Logics & adopt your variables as you need... if you do not try yourself, there will be no usefulness for you from this topic... you can even adopt the Logics of OrderModify if you desire...
- www.mql5.com
you can do it yourself -
you define variables here
& here you use them as condition for BUY_OP
& below a little bit different logics for SELL_OP... try to read Logics & adopt your variables as you need... if you do not try yourself, there will be no usefulness for you from this topic... you can even adopt the Logics of OrderModify if you desire...
thank you , but I am not a coder :((:((
can you help me please- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Can you modify this EA to move SL to Breakeven+5pips (lock 5 pips after BE) when it get 20 pips in profit?
Thank you.