if (HA>HAPrev) { signal ="Buy"; } if (HA<HAPrev) { signal ="Sell"; }
double HA = iCustom (NULL, 0, "Examples\\Heikin Ashi", 0, 1);Verify that you actually have a "<dataFolder>\MQL4\Indicator\Examples\Heiken Ashi.ex4" There won't be unless you put it there.
Data Structure in MetaTrader 4 Build 600 and Higher - MQL4 Articles 2014.02.03
William Roeder:
Verify that you actually have a "<dataFolder>\MQL4\Indicator\Examples\Heiken Ashi.ex4" There won't be unless you put it there.
Data Structure in MetaTrader 4 Build 600 and Higher - MQL4 Articles 2014.02.03
Thank you for your reply. The file pathway was indeed incorrect. I corrected it and there is no change in running the code.
Verify that you actually have a "<dataFolder>\MQL4\Indicator\Examples\Heiken Ashi.ex4" There won't be unless you put it there.
Data Structure in MetaTrader 4 Build 600 and Higher - MQL4 Articles 2014.02.03
paul selvan:
Not sure if I'm missing something? Did you change my code? Can't see any difference.
double HA = iCustom (NULL, 0, "Examples\\Heikin Ashi", 0, 1); double HAPrev = iCustom (NULL, 0, "Examples\\Heikin Ashi", 0, 2);You want the close price. Buffer zero is not. Always encapsulate your iCustom calls.
take candle color hekin ashi - Inflation - MQL4 and MetaTrader 4 - MQL4 programming forum
William Roeder:
You want the close price. Buffer zero is not. Always encapsulate your iCustom calls.
take candle color hekin ashi - Inflation - MQL4 and MetaTrader 4 - MQL4 programming forum
Buffer zero is not the close price? I will go and study what encapsulation means now. It turns out that programming is hard.
Thank you again for your replies.
You want the close price. Buffer zero is not. Always encapsulate your iCustom calls.
take candle color hekin ashi - Inflation - MQL4 and MetaTrader 4 - MQL4 programming forum

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 am at my wits end trying to figure this out.
I want to generate a buy or sell signal based on the close price of the last Heiken ashi bar. If the most recent bar close is higher than the previous bar, I want to generate a comment that says "buy", and a "sell" comment for the inverse.
I am using the iCustom function. I think I am specifying the correct index buffer in the parameters.
When I run the code the comment never changes from "Sell". I assume that is because my "sell" comment is the last line of code in my EA.
My suspicion is that my code does not specify the bar close and my if statements aren't doing anything.
Any help would be greatly appreciated.