so the error is at:
Think about the variable i and what it's values are. What happens when i = 1? You are trying to find the open[-1] and close[-1]. That's not going to fly.
A quick fix is:
if (i > 1 && open[i-2] > close[i-2]){ Comment ("Bearish"); }
Anthony Garot:
Thank you Very much!! so simple.
Think about the variable i and what it's values are. What happens when i = 1? You are trying to find the open[-1] and close[-1]. That's not going to fly.
A quick fix is:
Do your lookbacks correctly.
![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,
First a confession... I am not good at programming :-)
I hope that someone can / will help me.
I have some code to make Heiken Ashi Candles, now I would like to put a condition for 2 candles back. But I can't seem to get it right.
Here is the Code:
so the error is at:
I have tried to add to rates_total, but no success.
How could I acomplish this?
Thank you in advance for your help.
Kind Regards