
Play videoPlease edit your post.
For large amounts of code, attach it.
- No one here can read your ex4. Post your code.
- #define INF 0x6FFFFFFF // Not quite infinite, Jul 2029, or 1,879,048,191is from my code but has nothing to do with your question.
Luke1975:
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);
}
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.mq4 | //| Copyright © 2010, Oneday | //| | //+------------------------------------------------------------------+ #property copyright "Copyright © 2010, Oneday" #property link "" #property indicator_chart_window extern int Bar_Period = 24; extern double Set_deviation = 2.0;//added this user input extern color Colour = Red; extern int Line_weight = 1; extern bool Show_Ray = true; datetime TimeCheck; datetime T_1; datetime T_2; //========================================================================================================================================== int init(){ TimeCheck = Time[0]; T_1 = iTime(NULL,0,0);//the second zero refers to the currently open bar. T_2 = iTime(NULL,0,Bar_Period); UDF_Draw_channel(T_1, T_2); return(0); } //========================================================================================================================================== int deinit(){ ObjectDelete("SA SDC"); return(0); } //========================================================================================================================================== int start(){ if(TimeCheck != Time[0]){ ObjectDelete("SA SDC"); T_1 = iTime(NULL,0,0);//the second zero refers to the currently open bar. T_2 = iTime(NULL,0,Bar_Period); UDF_Draw_channel(T_1, T_2); } return(0); } //========================================================================================================================================== //User defined function to draw the channel void UDF_Draw_channel(datetime TimeR, datetime TimeL){ ObjectCreate("SA SDC",OBJ_STDDEVCHANNEL,0,T_2,0,T_1,0); ObjectSet ("SA SDC",OBJPROP_COLOR,Colour); ObjectSet ("SA SDC",OBJPROP_WIDTH,Line_weight); ObjectSet ("SA SDC",OBJPROP_RAY,Show_Ray); ObjectSet ("SA SDC",OBJPROP_DEVIATION,Set_deviation);//allow user to set the deviation via the user input } //==========================================================================================================================================
Files:
saxsdcuii.mq4
3 kb
WHRoeder:
Play videoPlease edit your post.
For large amounts of code, attach it.
- No one here can read your ex4. Post your code.
- #define INF 0x6FFFFFFF // Not quite infinite, Jul 2029, or 1,879,048,191is from my code but has nothing to do with your question.
Thanks WHRoeder,
I appreciate your comments and help.
Kind regards,
Luke
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
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);
}