Phoebe Hj:
You put an extra closing brace } on line 85, remove it and it'll compile.
This indicator is similar to the RSI. The idea is to calculate net_profit / [sum(positive returns) + abs(sum(negative returns))] in a rolling window.
But after I changed the code in the main loop, the terminal says: 'for' expressions are not allowed on a global scope
The similar part works for the official RSI. I don't understand this error.
The file is attached below.
Thank you.

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
This indicator is similar to the RSI. The idea is to calculate net_profit / [sum(positive returns) + abs(sum(negative returns))] in a rolling window.
But after I changed the code in the main loop, the terminal says: 'for' expressions are not allowed on a global scope
The similar part works for the official RSI. I don't understand this error.
The file is attached below.
Thank you.
Update:
I got this warning. But the code is modified from the official RSI and the terminal is up to date.