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
All in all, I have learned a lot of useful things. :)
Sorry again for the late answers. When approximating a trajectory you can never know how much better one approximation describes the trajectory itself, if they are in the same confidence interval. And consequently, all approximations that fall within the confidence interval can be assumed to be equivalent. In principle, this is the case. To make a forecast from a set of possible approximations (usually not one satisfies the selection criteria, because the error bounds are set), it's better to choose the "most" optimal one, so to speak. As I studied the algorithm, I realized one more peculiarity - though the approximations are different, the forecasts are the same in the vast majority of cases. Once again I remind you that the trajectory itself is not needed and I'm not looking for it. Regarding channels - the uniqueness of channels is related to the "degree of detail" (let's call it that) of the structures under study. Thus, if there are trends, we can identify pullback zones and estimate the probabilities of trend ends, breakdowns of reversal zones, etc. Or just to identify the areas of uncertainty, when it is better not to enter the market. Also, you should always remember about sample size limitations, otherwise the result will have too high an uncertainty rate.
Good luck and good trends.
I have a misunderstanding regarding the calculation of the Hurst coefficient.
In the case of linear regression we have 2 variants of S and R calculation.
Variant 1.
S - we can calculate as the sum of deviation differences along the whole length of the linear regression line.
It means:
S=0.0;
for (n=0; n<Period; n++) { S+ = MathPow( Close[n] - (a+b*n) , 2); }
S=MathSqrt( S / Period );
And we can calculate R as the difference between the maximal and minimal deviation along the whole line of the linear regression.
That is:
pMax=0.0; pMin=0.0;
for (n=0; n<Period; n++)
{
dc=Close[n] - (a+b*n);
if ( dc > pMax) pMax = dc;
if ( dc < pMin) pMin = dc
}
R=MathAbs( pMax - pMin);
Option 2.
We can calculate S relative to the last bar using iStdDev( ) from the set of standard technical indicators. But in this case we will have S calculated with respect to the last bar, which is equivalent to calculation of S relative to the value in the middle of a linear regression line.
And R - as the difference between the maximum and minimum values in the horizontal projection:
pMax=High[Highest(NULL,0,MODE_HIGH,Period,i)];
pMin=Low[Lowest(NULL,0,MODE_Low,Period,i)];
which is not quite correct, it would be more correct to use MODE_CLOSE if we initially use Close.
As far as I understand, the second variant is used in your case? Or must I be mistaken?
So my question is: Which variant is more correct for more accurate calculation of Hurst coefficient?
Thank you in advance for your answer - Alexander.
Thank you, Vladislav, I somehow didn't take this point into account. But it's really true. This means that in fact we get not several channels, but a whole range bounded by lines with the maximum and minimum angle.
I'm not quite sure what uncertainty you're talking about. However, the other thing is clear to me. The sample should define a regression channel, and a regression channel is a trend channel. If we lump both the trend and the flat into a sample, such a sample would hardly give us anything useful. Therefore, we face the problem of dividing the market into phases, and, more importantly, of identifying the trend and the flat at the early stages, i.e. in the real market. In my opinion, this is a very nontrivial task.
Kartinka mne napomnila standartnyj indikator kanalov, vot i spomnil svoju razrabotku kokda iskal filter dlia ods4iota kokda na4inajetsia bolshyjje volny Elliota - po Standart Deviation formule:
Vot kod mojevo indikatora:
//+------------------------------------------------------------------+ //| StdDevChan.mq4 | //| Copyright © 2005, Arunas Pranckevicius | //| irc://irc.omnitel.net/forex | //+------------------------------------------------------------------+ #property copyright "Copyright © 2005, Arunas Pranckevicius(T-1000), Lithuania" #property link "irc://irc.omnitel.net/forex" #property indicator_chart_window #property indicator_buffers 3 #property indicator_color1 Red #property indicator_color2 White #property indicator_color3 Blue //---- input parameters extern int PriceBars=350; extern int Shift; extern bool Comments=false; double Support[]; double StdDev[]; double Resistance[]; //---- buffers //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ void SetObject(string ObjName,int ObjType,datetime ObjTime1,double ObjPrice1,datetime ObjTime2=0,double ObjPrice2=0,color ObjColor=Red,int ObjSize=1,int ObjStyle=STYLE_SOLID,datetime ObjTime3=0,double ObjPrice3=0) { if (ObjectFind(ObjName) != -1) ObjectDelete(ObjName); ObjectCreate(ObjName, ObjType, 0,ObjTime1 , ObjPrice1, ObjTime2, ObjPrice2, ObjTime3, ObjPrice3); ObjectSet(ObjName,OBJPROP_COLOR,ObjColor); ObjectSet(ObjName,OBJPROP_STYLE,ObjStyle); ObjectSet(ObjName,OBJPROP_WIDTH,ObjSize); } int init() { //---- indicators IndicatorBuffers(3); SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,Resistance); SetIndexDrawBegin(0,0); SetIndexEmptyValue(0,0); SetIndexShift(0,0); SetIndexLabel(0,"Standart Deviation Support-"); //---- SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,StdDev); SetIndexDrawBegin(1,0); SetIndexEmptyValue(1,0); SetIndexShift(1,0); SetIndexLabel(1,"Standart Deviation"); //---- SetIndexStyle(2,DRAW_LINE); SetIndexBuffer(2,Support); SetIndexDrawBegin(2,0); SetIndexEmptyValue(2,0); SetIndexShift(2,0); SetIndexLabel(2,"Standart Deviation Resistance+"); //---- return(0); } //+------------------------------------------------------------------+ //| Custor indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counter,counter2; double DevAvg=0; double DevPlus1=0; double DevMinus1=0; double DevPlusStart=0; double DevMinusStart=0; double DevAvgStart=0; double DevPlusEnd=0; double DevMinusEnd=0; double DevAvgEnd=0; double DevPlus2=0; double DevMinus2=0; double DevAvg1=0; double DevAvg2=0; double PriceDiff; double deviance,Max,Min; int DrawBegin = Shift; int DrawEnd; int counted_bars=IndicatorCounted(); DrawEnd=Bars-counted_bars; if ( DrawEnd < DrawBegin + PriceBars) DrawEnd = DrawBegin + PriceBars; if (Bars < (PriceBars * 2 + Shift)) return(0); for (counter=DrawBegin-1;counter<=DrawEnd;counter++) { deviance=iMA(Symbol(),Period(),PriceBars,0,MODE_SMA,PRICE_MEDIAN,counter); Max=High [Highest (NULL,0,MODE_HIGH,PriceBars,counter)]; Min=Low [Lowest (NULL,0,MODE_LOW,PriceBars,counter)]; //DevAvg=MathPow((Max + Min + deviance) / 3,2); DevAvg=(Max + Min + deviance) / 3; for (counter2=(PriceBars + counter);counter2 >=counter;counter2--) { PriceDiff = (Max + Min + Open[counter2]) / 3; deviance+= MathPow((PriceDiff - DevAvg),2); } // Calculate average deviation deviance = deviance / (PriceBars + 1); DevAvg = MathSqrt(deviance/Point) * Point; // Calculate deviation channel starting/current average deviation prices DevAvg1 = (DevPlus1 + DevMinus1 + (Max + Min + Open[PriceBars + counter]) / 3) / 3; // Calculate deviation channel +/- starting points DevPlus1 = (Min+Max + Open[PriceBars + counter]) / 3 + DevAvg; DevMinus1 = (Min+Max + Open[PriceBars + counter]) / 3 - DevAvg; // Calculate deviation channel current +/- points DevPlus2 = (Max + DevAvg1) / 2 + DevAvg; DevMinus2 = (Min + DevAvg1) / 2 - DevAvg; DevAvg2 = (DevPlus2 + DevMinus2 + (Max + Min + DevAvg1) / 3) / 3; Resistance[counter]=DevMinus2; Support[counter]=DevPlus2; StdDev[counter]=DevAvg2; //if (counter == DrawEnd && Symbol() == "EURUSD" ) Print ("DevMinus2=",DevMinus2," DevPlus2=",DevPlus2," DevAvg2=",DevAvg2); if (counter == DrawBegin) { DevPlusEnd=Resistance[counter]; DevMinusEnd=Support[counter]; DevAvgEnd=StdDev[counter]; // if (Symbol() == "EURUSD" ) Print ("DrawBegin=",DrawBegin," DrawEnd=",DrawEnd," DevMinus2=",DevMinus2," DevPlus2=",DevPlus2," DevAvg2=",DevAvg2); } if (counter == DrawBegin + PriceBars) { DevPlusStart=Resistance[counter]; DevMinusStart=Support[counter]; DevAvgStart=StdDev[counter]; } } //---- if (Comments) Comment(Symbol()," DevAvg=",DevAvg," DevAvgStart=",DevAvgStart," DevAvgEnd=",DevAvgEnd," DevPlusStart=",DevPlusStart," DevPlusEnd=",DevPlusEnd," DevMinusStart=",DevMinusStart," DevMinusEnd=",DevMinusEnd); //Draw channel SetObject(Symbol()+"_StdDev+",OBJ_TREND,Time[PriceBars + Shift],DevPlusStart,Time[Shift],DevPlusEnd,Blue,1,STYLE_SOLID); ObjectSetText(Symbol()+"_StdDev+","Standart Deviation Resistance", 8, "Arial", Green); SetObject(Symbol()+"_StdDev-",OBJ_TREND,Time[PriceBars + Shift],DevMinusStart,Time[Shift],DevMinusEnd,Red,1,STYLE_SOLID); ObjectSetText(Symbol()+"_StdDev-","Standart Deviation Support", 8, "Arial", Green); SetObject(Symbol()+"_StdDevAvg",OBJ_TREND,Time[PriceBars + Shift],DevAvgStart,Time[Shift],DevAvgEnd,White,1,STYLE_SOLID); ObjectSetText(Symbol()+"_StdDevAvg","Standart Deviation Average", 8, "Arial", Green); return(0); } //+------------------------------------------------------------------+The key here is: if initially counted by Close
2Yurixx Regarding uncertainty - if the number of degrees of freedom in a sample is insufficient, its convergence cannot be reliably estimated, and therefore you can apply statistical analysis methods to a divergent sample that are applicable only to convergent samples. Consequently the result is uncertain.
PS Here the term "sample" was used to mean a distribution. I.e. it would be more correct to say "the number of degrees of freedom of a sample affects the degree of reliability in determining the convergence of a distribution valid for that sample". Methods valid for convergent distributions can be applied to divergent ones (or to distributions with no known fact of convergence).
Good luck and good luck with trends.
Vot po4emu ja dal kod svojevo indikatora - ras4ioty idut po vsem parametram:
Smotrite indikator i probuite na grafik :-D
I have a misunderstanding about the calculation of the Hurst coefficient.
In case of linear regression we have 2 variants of S and R calculation.
Now this is an interesting question :)
Suppose we have a linear regression channel, e.g. ascending one, which satisfies the RMS convergence criterion. On the one hand, if the channel is ascending, then the calculated RMS on the bars included into it will tend to 1.0 (as the shift is evident). On the other hand, if we calculate RMS relatively to the regression line (thus removing the shift), then RMS will tend to 0.5, because the RMS is close to the normal distribution. I think everyone should check this for themselves (it is much more interesting that way).
//+------------------------------------------------------------------+ //| Herst-II.mq4 | //| solandr (обработал напильником Rosh) | //| http://www.metaquotes.ru/forum/6839/page11 | //+------------------------------------------------------------------+ #property copyright "solandr (обработал напильником Rosh)" #property link "http://www.metaquotes.ru/forum/6839/page11" #property show_inputs extern int start_bar=500; extern int end_bar=0; //+------------------------------------------------------------------+ //| script program start function | //+------------------------------------------------------------------+ int start() { double viborka[]; int size_of_array,i; size_of_array=start_bar-end_bar+1; ArrayResize(viborka, size_of_array); for(i=size_of_array-1;i>=0;i--) viborka[i]=Open[i+end_bar]; double S_A=iMAOnArray(viborka,0,size_of_array,0,MODE_SMA,0); Print("Среднее арифметическое выборки = ",DoubleToStr(S_A,8)); double S=iStdDevOnArray(viborka,0,size_of_array,MODE_SMA,0,0); Print("СКО выборки (размах) = ",DoubleToStr(S,8)); double pMax=viborka[ArrayMaximum(viborka)]; double pMin=viborka[ArrayMinimum(viborka)]; double R=pMax-pMin; Print("pMin = ",pMin," pMax = ",pMax, " R = ",R); double Hrst; if( (R>0)&&(S>0)) Hrst = MathLog(R/S)/MathLog(size_of_array*0.5); Print("Хёрст = ",DoubleToStr(Hrst ,8)); return(0); } //+------------------------------------------------------------------+Extremum search is based on raw data, not on positions and breaks.
Therefore the criterion is somewhat different:
2006.05.28 14:53:08 Herst EURUSD,M15: pMin = 1.2691 pMax = 1.2892 R = 0.0201
28 14:53:08 Herst EURUSD,M15: Sampling RMS (spread) = 0.00438062
2006.05.28 14:53:08 Herst EURUSD,M15: Sampling variance = 0.00001919
2006.05.28 14:53:08 Herst EURUSD,M15: Sampling mean = 1.27924631
2006.05.28 14:53:06 Herst EURUSD,M15: loaded successfully
2006.05.28 14:52:59 Herst-II EURUSD,M15: removed
2006.05.28 14:52:59 Herst-II EURUSD,M15: Hurst = 0.26196806
2006.05.28 14:52:59 Herst-II EURUSD,M15: pMin = 1.2696 pMax = 1.2882 R = 0.0186
2006.05.28 14:52:59 Herst-II EURUSD,M15: Sample RMS (spread) = 0.00437625
2006.05.28 14:52:59 Herst-II EURUSD,M15: Sample Mean = 1.27924631
2006.05.28 14:52:59 Herst-II EURUSD,M15: loaded successfully
2006.05.28 14:52:54 Compiling 'Herst-II'
Thank you for your comprehensive reply.