Download MetaTrader 5
To add comments, please log in or register
Share the links to products and make your profit
Jasper Ng Jie Ming
7
Jasper Ng Jie Ming 2015.08.08 16:16 
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:
PomeGranate
553
PomeGranate 2015.08.10 10:49  
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!

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.

/
To add comments, please log in or register