remix919:
you cannot find a swing, unless you exactly express, what you consider to be a swing.
Pretty much as the title states, how can I find the first swing high and swing low of a bigger range?
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<Bars; shift++){ int LE = LocalExtreme(WS, shift, TF, d); if (LE >= shift+2) return (LE); } return(Bars-1); }
WHRoeder:
Think about
Thanks WHRoeder, I'll play around with this and see if I can figure it out :)
Think about
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
Pretty much as the title states, how can I find the first swing high and swing low of a bigger range?