I would like to modify the existing Heikin ashi indicator to draw an arrow whenever there's a colour change (signifying a change in trend). But it's not working and I cant identify the problem. Please help and thanks in advance!
Files:
hachangedv2.mq4
7 kb
- Detect candle color change on heikin ashi
- Object Trendlines Properties
- Please help with code:)
jaspernjm:
I would like to modify the existing Heikin ashi indicator to draw an arrow whenever there's a colour change (signifying a change in trend). But it's not working and I cant identify the problem. Please help and thanks in advance!
I would like to modify the existing Heikin ashi indicator to draw an arrow whenever there's a colour change (signifying a change in trend). But it's not working and I cant identify the problem. Please help and thanks in advance!
Hi,
I think your counting is wrong:
int counted_bars=IndicatorCounted(); int limit= Bars-counted_bars; for(int k=(Bars-100);k>limit;k--) { //if gray then black if(openb[k+1]<closeb[k+1] && openb[k]>closeb[k]) downarrow[k]=closeb[k]; //else if black then gray else if(openb[k+1]>closeb[k+1] && openb[k]<closeb[k]) uparrow[k]=closeb[k]; }
It works this way:
for (bar=limit; bar>=0 && !IsStopped(); bar--) { if((ExtOpenBuffer[bar-1]<ExtCloseBuffer[bar-1]) && (ExtOpenBuffer[bar]>ExtCloseBuffer[bar])) { downarrow[bar]=MathMax(ExtLowHighBuffer[bar],ExtHighLowBuffer[bar])+(50*Point); uparrow[bar]=EMPTY_VALUE; } if((ExtOpenBuffer[bar-1]>ExtCloseBuffer[bar-1]) && (ExtOpenBuffer[bar]<ExtCloseBuffer[bar])) { uparrow[bar]=MathMin(ExtLowHighBuffer[bar],ExtHighLowBuffer[bar])-(50*Point); downarrow[bar]=EMPTY_VALUE; } }
The arrow alignment is different, too, as you see.
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