Standard Deviation Channel Automated

 

Does anyone know of an indicator like this? Apparently used by hedge funds.

It is a standard deviation channel that automatically draws the channel in from the most recent extreme high/low to the most recent extreme low/high over the last (x) periods.

It is exactly like the indicator attached but instead of just a set bar period it replaces it with the extreme high and low.

If the following code is inserted into the indicator somewhere would that work?

Any help muchly appreciated. Thanks.

//+------------------------------------------------------------------+

//| Find local extrema |

//+------------------------------------------------------------------+

double LEPrice(int length, int iBeg, double d=EMPTY_VALUE, int ePrice=EMPTY){

double prcLE = FindMax(length, iBeg, d, ePrice, true); return(prcLE);

}

double FindMax (int length, int& iMax, double d, int ePrice, bool LE){

//double DIR // Import from SetDIR

//#define INF 0x6FFFFFFF // Not quite infinite, Jul 2029, or 1,879,048,191

if (d == EMPTY_VALUE) d = DIR;

if (ePrice == EMPTY) ePrice = IfI(PRICE_HIGH, PRICE_LOW, d);

double prcMax = -d * INF;

int nBars = GetBars(),

iLimit = MathMinI(nBars, iMax + length);

for (int iBar = iMax; iBar < iLimit; iBar++){

double value = GetPrice(iBar, ePrice);

if ((prcMax - value)*d < 0.){

prcMax = value; iMax = iBar;

if (LE) iLimit = MathMinI(nBars, iMax+length);

} }

return(prcMax);

}

sa_sdc_ii.mq4sa_sdc_ii.ex4

Files: