jota9913: once price gets to a certain distance between the take-profit and the entry.
Your code doesn't modify the order selected. It keeps going and would attempt to modify any random order in position index zero. Move your modify code inside the loop.
tp = OrderTakeProfit();
entry = OrderOpenPrice();
currentSL = OrderStopLoss();
double distance = tp - entry;
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
I have an EA that is supposed to add a stop loss to breakeven (without previously having a stop-loss at all) once price gets to a certain distance between the take-profit and the entry. It comments where its supposed to change the stop-loss, but just changes it for one pair everyday. Here's my code:
openTrade is a boolean I use to identify if there are open orders on the current pair. It sets to true once the method to open trades runs, and to false when it closes the trades.