int limit = rates_total - prev_calculated; if (prev_calculated > 0) limit++; bool previousIsBearish = Open[i + 1] > Close[i + 1]; // PROBLEM IS HEREYour lookback is one.
How to do your lookbacks correctly #9 — #14 & #19
Great, thank you sorted.

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'm new to indicators. I'd need to find the open/close of the previous candle on my indicator.
It's basically an indicator that shows buy/sell arrows on the chart.
I want to check 2 previous candles and if there is an engulfing candle I highlight with an arrow:
I'm using this code but it errors that "array out of range":
Here is my indicator: