- Scale Out with Automatic move of Stop Loss for second lot to Break Even entry point once First Profit Target has been hit for first lot.
- Experts: RoNz Auto SL-TS-TP v.2
- Exits? Take the money or follow the trend
Can change open trade orders with function OrderModify() see MetaEditor help: MQL4 Reference - Trading functions - OrderModify
Also have looksee in MQL4 tutorial book (a Russian -> English translator is in this link)
You can do it in two ways:
1. You open two position one with and one without takeprof. You set a Price_flag and a Modify_flag for instance:
double Modify_Price=TakeProfit;
bool ModifyOrder=false;
bool OrderModified=false;
Because you know where take profit stands, you check first if Ask/Bid is above/bellow this level:
if(Bid> Modify_When)
-> then: if true you set the flag ModifyOrder=true;
-> now this means your position is closed and you have to modify the second position to break even and activate the trailing stop: if(ModifyOrder=true && OrderModified!=true) {modify...and enable trailing stop}
-> After you done {OrderModified=true;}
And so on new order -> new sets the flags to false
2. You can use events.It is done as library. It is easyer but you have to know how to integrate it in your EA. Look this: https://www.mql5.com/en/articles/1399
You can do it in two ways:
1. You open two position one with and one without takeprof. You set a Price_flag and a Modify_flag for instance:
double Modify_Price=TakeProfit;
bool ModifyOrder=false;
bool OrderModified=false;
Because you know where take profit stands, you check first if Ask/Bid is above/bellow this level:
if(Bid> Modify_When)
-> then: if true you set the flag ModifyOrder=true;
-> now this means your position is closed and you have to modify the second position to break even and activate the trailing stop: if(ModifyOrder=true && OrderModified!=true) {modify...and enable trailing stop}
-> After you done {OrderModified=true;}
And so on new order -> new sets the flags to false
2. You can use events.It is done as library. It is easyer but you have to know how to integrate it in your EA. Look this: 'Events in МetaТrader 4'
Thanks this should help and I'll check out the article.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use