Help add ATR to my code for EA


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.

mq5l_edit.mq5  12 kb
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);