![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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 see my failings. Its should be "timePre"=Time[0];
This coding is a very steep learning curve ha. Enjoying it though.
Ok so now i'm completly lost. I cant for the life of me work out why the stoploss keeps moving away when the price keeps moving towards it. It defeats its purpose. I keep getting loads of ordermodify errors. Its meant to find the low of a certain amount of candles and move the SL to it. However it then decides to move it again should price move towards it.
You are comparing the OrderStopLoss to one value, then trying to modify it with a different value.
You don't check whether the new SL value is above the current price (for a Buy) or too close to current price and therefore invalid