The point is the following: I use RSI to buy or sell on EURUSD. Many orders can be opened when conditions are fulfilled. So I can have up to 10 or 20 opened orders, but always on the same side (buy or sell). I would like to calculate the average price for these opened orders, and define the take profit price at 5 pips above or below this TP price. I don't want to place a TP pending order ; I just want to know it and then, when this TP price is reached, The pool of opened orders must be closed.
So the idea is: Order 1: buy 0.2 EURUSD at p1 Order 2: buy 0.2 EURUSD at p2 Order 3: buy 0.2 EURUSD at p3
average price = (p1+p2+p3)/3 TP price = average price + 5 pips
Of course, if sell, TP price is lower than average price.
That also means that average price and the TP price is recalculated each time a new position is opened
When TP price is reached by the market, all the 3 orders are closed at TP price by the EA..
So, is anyone able to help me on that topic???
Thanks in advance
Cyrille
P.S.:
Entrysignal () conditions are already defined
OpenPos() rules are already defined
ClosePos() rules are partially defined - This is probably in the loop that I need to include the code that will take in charge the hereabove request
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Hi hi,
The point is the following:I use RSI to buy or sell on EURUSD.
Many orders can be opened when conditions are fulfilled.
So I can have up to 10 or 20 opened orders, but always on the same side (buy or sell).
I would like to calculate the average price for these opened orders, and define the take profit price at 5 pips above or below this TP price.
I don't want to place a TP pending order ; I just want to know it and then, when this TP price is reached, The pool of opened orders must be closed.
So the idea is:
Order 1: buy 0.2 EURUSD at p1
Order 2: buy 0.2 EURUSD at p2
Order 3: buy 0.2 EURUSD at p3
average price = (p1+p2+p3)/3
TP price = average price + 5 pips
Of course, if sell, TP price is lower than average price.
That also means that average price and the TP price is recalculated each time a new position is opened
When TP price is reached by the market, all the 3 orders are closed at TP price by the EA..
So, is anyone able to help me on that topic???
Thanks in advance
Cyrille
P.S.:
Entrysignal () conditions are already defined
OpenPos() rules are already defined
ClosePos() rules are partially defined - This is probably in the loop that I need to include the code that will take in charge the hereabove request