as i see this you only need to calculate average price and call ClosePos() when it's reached
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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