First, correct your main mistake: you create an indicator handle at every tick.
Remember: in MQL5, the indicator handle is created ONCE! And this is done in OnInit !!!

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
GREETINGS
So should the price hit our Stoploss, we lose 2% of our equity
The formula to calculating the proper lot size is Equity*Risk/Stoploss
Now our Stoploss is going to be 2*ATR Value
I've been trying to turn all this into an MQL5 code
PROBLEM: When I set the SL to a number (e.g. 50), the EA works perfectly fine; however when I try setting the ATR value as the SL, it doesn't work (no issue with compiling the file).
ANY IDEAS?