English

## How to find the first swing high and low of a range

 29 remix919 2016.01.09 22:53   Pretty much as the title states, how can I find the first swing high and swing low of a bigger range?
 1123 Ovo 2016.01.10 07:46 #   remix919: Pretty much as the title states, how can I find the first swing high and swing low of a bigger range?    you cannot find a swing, unless you exactly express, what you consider to be a swing.
 13122 WHRoeder 2016.01.10 14:09 #   Think about```//+------------------------------------------------------------------+ //| Find a local extreme bar value                                   | //+------------------------------------------------------------------+ int MaximalBar(int length, int start=0, int TF=0, double d=INF){    if (d>=INF) d=DIR;    if (Bars-start < length)   length = Bars - start;    if (d>0)    return( Highest(NULL, TF, MODE_HIGH, length, start) );    else     return(  Lowest(NULL, TF, MODE_LOW,  length, start) ); } int LocalExtreme(int WS, int first=0, int TF=0, double d=INF){    while(true){                                             int       firstPrev   = first;       first    = MaximalBar(WS, first, TF, d);       if (first == firstPrev)    return(first);    }    /*NOTREACHED*/ }  // LocalExtreme double LastFractal(int WS, int TF=0, double d=INF){    for (int shift=1; shift= shift+2)   return (LE);    }    return(Bars-1); } ```
 29 remix919 2016.01.10 14:46 #   Ovo: you cannot find a swing, unless you exactly express, what you consider to be a swing.The FIRST swing high and swing low in this case would simply be the first high and low fractal within a range.
 29 remix919 2016.01.10 14:47 #   WHRoeder: Think aboutThanks WHRoeder, I'll play around with this and see if I can figure it out :)