Hey;)
You just declared the ATR Buffer and ATR Handle but didn't assigned any value to the Buffer. You need to do add this for the ATR too:
ArraySetAsSeries(atr_buffer, true); CopyBuffer(atr_handle, 0, 0, 5, atr_buffer);

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 , I am trying to add in ATR to my code. I have RSI, ADX and Choppiness working on the backtest strategy for MT5. When I test with mt5 no trades happen although there says there is no errors with the code on mql5. How do I fix the below code so that the ATR calculates the SL automatically for each trade.