I am trying to get the outputs for the Heiken Ashi indicator on the previous candlestick but I was unable to find a method that was clear to me.
What I am attempting to do is determine a shift in direction, by checking if the current Heiken Ashi candle colour is different from the previous Heiken Ashi candle colour. I am aware that I am I'm actually comparing the values, not the colours but just wanted to put it in laymen terms.
I was hoping there was something similar to the OLHC function (i.e. PrevOpenPrice = Open[1], or CurrentOpenPrice = Open[0]) that I can leverage, but I think it's going to be more complex than that.
This is all I really have as far as defining variables goes:
Hope someone is able to help! Thanks.
I happened to have this function:
const string nameOfHA = "Heiken Ashi"; double GetHA(int bar, int type=PRICE_CLOSE, int tf=0, string symb=NULL) { if (tf==0) tf = Period(); else { int tfs[] = {1,5,15,30,60,240,1440,10080,43200}; int tfIdx = ArrayBsearch(tfs,tf); tf = tfs[tfIdx]; } if (symb==NULL) symb = Symbol(); if (type==PRICE_CLOSE) return (iCustom(symb,tf,nameOfHA,3,bar)); if (type==PRICE_OPEN) return (iCustom(symb,tf,nameOfHA,2,bar)); if (type==PRICE_HIGH || type==PRICE_LOW) { double hl = iCustom(symb,tf,nameOfHA,0,bar); double lh = iCustom(symb,tf,nameOfHA,1,bar); if (type==PRICE_HIGH) return (MathMax(hl,lh)); else return (MathMin(hl,lh)); } return (0); }
So you can just call GetHA(bar,PRICE_CLOSE) for close, GetHA(bar,PRICE_HIGH) for high, etc.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi All,
I am trying to get the outputs for the Heiken Ashi indicator on the previous candlestick but I was unable to find a method that was clear to me.
What I am attempting to do is determine a shift in direction, by checking if the current Heiken Ashi candle colour is different from the previous Heiken Ashi candle colour. I am aware that I am I'm actually comparing the values, not the colours but just wanted to put it in laymen terms.
I was hoping there was something similar to the OLHC function (i.e. PrevOpenPrice = Open[1], or CurrentOpenPrice = Open[0]) that I can leverage, but I think it's going to be more complex than that.
This is all I really have as far as defining variables goes:
Hope someone is able to help! Thanks.