![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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 all. I 'm going to try DRAW_COLOR_CANDLES in my indicator. I've written following which works correctly in coloring Engulf candles:
Now, if i change small piece of code -as follows- i get strange behavior form indicator. It plots some vertical lines in my chart filling form top to down of monitor.
double open_pre = open[i-1]; bool StrongEngulf_Up = close[i]>open[i] && close[i-1]<=open_pre; bool StrongEngulf_Down = close[i]<open[i] && close[i-1]>=open_pre;
In fact, thr code is more sophisticated. I've simplified it to show the exact problem.
Q1: Why this occurs?
Q1: Why should i use index "i-1" to refer to previous candle?
Thanks in advance for your help