Storing highest & Lowest from Zigzag and check condition

To add comments, please log in or register
aryan116
24
aryan116  

Hi,

I am trying to store highest and lowest values of a wave ( from zig zag) and copy into buffers. I am then comparing if it is a highest high and highest low from its previous then alert will display that it is an up trend but problem when I compare them I am not getting any alert, I think I am not able to check highest high or lowest low conditions.

Please advise how to write correct condition for checking.

Thanks.

luisaoisdead
38
luisaoisdead  
aryan116:
Any advise. Thanks.

If you want to learn... i recomen you to see https://www.youtube.com/watch?v=nszw6WCrvHA&list=PLV8YK-9p3TcM1gb106qDgzvwPExB5Fxra.

if you only want what you are asking for... the condition its a litle tricky.

trend is easily view with EMA more than High o Low.

tell me a litle more about what you want.

luisaoisdead
38
luisaoisdead  
aryan116:

Hi luisaoisdead, thanks for the reply. I want to get highest and lowest values of wave which are stored in buffers and then compare them.. like higher high and higher low to confirm an up trend.

My first step is how to get information from buffer and compare current highest with the previous highest. I know it is very tricky but if you or any one guide me it will help me. Thanks.Ok

Ok. this might help.

First you have to know that:

iLow

Returns Low price value for the bar of indicated symbol with timeframe and shift.

iHigh

Returns High price value for the bar of specified symbol with timeframe and shift.

Once you know this, is going to be easier.

This is an example.

//---- indicator parameters
extern int periods=20;
   
//---- indicator buffers
double     upper;
double     lower;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+

int start()
  {
   int limit;
   int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;

//---- calculate values
      upper=iHigh(Symbol(),Period(),iHighest(Symbol(),Period(),MODE_HIGH,periods,0));
      lower=iLow(Symbol(),Period(),iLowest(Symbol(),Period(),MODE_LOW,periods,0));
   Comment("Upper: ",upper,"\nLower: ",lower);
   
   return(0);
  }


To add comments, please log in or register