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
Good afternoon, community members.
I am developing an EA that exclusively trades the EURUSD pair. The strategy involves opening a new position to average the price whenever the price moves against the current position. This part is working perfectly.
However, I am facing difficulties with the function that sets the take profits at a single level. To illustrate better, let me describe a scenario:
Suppose I have open buy positions at the following prices:
These positions have the following lot sizes:
The function I am developing (below) should adjust the take profit of these positions so that, when the target is reached, the profit is X times greater than the sum of the losses of the negative positions. The way the function is currently, it returns the error [invalid stops].
Unfortunately, my function is not achieving this goal. Therefore, I am reaching out to you for help in adjusting the logic to ensure this goal is met.
Thank you all in advance for your assistance.
Regards!