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. - page 2

 
manhha #:

thank you , but  I am not a coder :((:((

but you can read, not coding :

if this condition  if(TrailingStop>0) IS TRUE - in such a case following lines will be executed, otherwise not - does your trading meet this requirement? or didn't you change TrailingStop (input parameter)  to make checking this condition to give TRUE ... Think logically!...

if((OrderOpenPrice()+ (BEStopPips*MyPoint))>Bid) ...-  perhaps additional brackets can help...

perhaps in your MT-build some functions are called differently... nobody has the same trading & soft environment as you, but logically the code seems to be correct at a glance

 
JeeyCi #:

but you can read, not coding :

if this condition  if(TrailingStop>0) IS TRUE - in such a case following lines will be executed, otherwise not - does your trading meet this requirement? or didn't you change TrailingStop (input parameter)  to make checking this condition to give TRUE ... Think logically!...

if((OrderOpenPrice()+ (BEStopPips*MyPoint))>Bid) ...-  perhaps additional brackets can help...

perhaps in your MT-build some functions are called differently... nobody has the same trading & soft environment as you, but logically the code seems to be correct at a glance

thank you

 
manhha #:

thank you

I didn't understand if you've got what you wanted ?...

but the only possible reason for violation in the calculation itself, I can assume, IS double behavior in calculations (testing needed) - some knowledge or even tricks (CompareDoubles)  needed sometimes... the overall logics is normal in the code as I mentioned above...

(as well as you have double OpenPrice & int BEStopPips)

Working with Doubles in MQL4
Working with Doubles in MQL4
  • www.mql5.com
In this note we will consider a typical programming errors, that occurs while working with double numbers in MQL4 programs.