a trading strategy based on Elliott Wave Theory - page 287

 
to olyakish


Good evening all.
Could you please tell the children of this algorithm?

Thank you in advance


I am telling you.

We apply a multiple median filter to the price curve. What is it? We take an odd-sized (>=3) window and run it through all values of the original curve. At every current point, sort by value the points included in the window. The current point is assigned an average value (in the sense that it is situated in the middle of the array) from the sorted array. Once again we apply the same filter to the result obtained. We repeat it many times (usually 20-30 times is enough).
To get the resistance levels we invert the price curve upside down and do the same. Then we flip the obtained result backwards.
That is all!
...



A quick question.
Suppose we have a history of 1000 reports (bars)
window 3
we don't calculate results for 1000,999 windows and perform the first calculation when we get to the 998th report (we have data from 998,999 and 1000 reports)
our first pass gives us 998 results
for the second pass, we get to 996 report using the array formed during the previous run
in the third run, we get 994 ...
and so on ...
That is, if we ran 30 times, we got an array of 960 values

Maybe i didn't understand you correctly ?
 
to olyakish

<br/ translate="no"> A quick question
Suppose we took a history of 1000 reports (bars)
window 3
it turns out that for 1000,999 we don't count because it's smaller than the window and the first calculation we do only when we get to 998 report (we have data from 998,999 and 1000 reports)
we get the first pass with 998 results
the second pass we get to 996 report already formed by the previous run of the array
the third run we get to 994 ...
and so on ...
i.e. if you ran 30 times, you got an array of 960 values

Maybe I misunderstood you?



Not exactly. Technically it's done a little differently. Before you apply a filter, you expand the original array by half the width of the filter window in both directions. You fill in empty spaces in the new array with either a constant, i.e. the last value from the edge of the original array, or symmetrically with the extreme values of the original array. In this case you will get 1000 points again after applying the filter to the original array of 1000 points. The next time you filter, everything repeats.
Of course, in this case distortions may occur at the edges. But this cannot be avoided because any window filter (and any filter at all) has a phase delay, including median one. In general - that's the way nature works.
We can do it the way you describe, but then we won't get to the edge of the original array; or we can use an extension, but then we won't get to the edge of the result.
This is the bad news.
The good news is that the median filter is not as sensitive to edge effects as linear filters. The few examples that I have had time to look at show that edge distortions are either small or, in some cases, absent altogether.

PS. Yes... Another idea came to my mind just now. The filter could be applied recursively. I don't know what it would do, I haven't tried it, but it would count faster.
 
Andre69, I implemented the median filter algorithm you suggested. It turns out that after the third run, the shape of the smoothed curve does not change. Tested this effect in a wide range of window sizes (up to 10000 samples).
As far as applications in trading are concerned, it is correct to use "left window" when the current point is assigned a value from the centre of the window located FULL to the left of the current value. Of course, this introduces a phase delay (lag), but that's the way of the world:-)
 
to Neutron

Andre69, I implemented the median filter algorithm you suggested. It turns out that after the third run, the shape of the smoothed curve does not change. I checked this effect in a wide range of window sizes (up to 10000 samples). <br/ translate="no"> As for applications in trading, it is correct to use the "left window" when the current point is assigned a value from the centre of the window that is FULLY to the left of the current value. Of course, this introduces a phase delay (lag), but that's the way of the world:-)


Yes... That doesn't add up. Started checking. Finally looked into my code, which I use for median filtering. I wrote it N years ago (N>5) for one small graph output program. Now I've started to use this program as a polygon for all sorts of research. It's handy, and I haven't even looked into the old parts of the code. It's all working and well... Now I'm looking at it... and suddenly discovered that the function I thought was median filtering - it doesn't do exactly that! Wildly sorry for the involuntary misinformation! I bow my guilty head.
Why and why I did so at the time - God forbid I don't remember.
The classic median is when the central value of a sorted array is taken. In this particular case I took the average between the central value and the one before it. Perhaps I needed it a long time ago for some reason. I also got a non-linear filter, though, of course, it was not the median in the strict sense. When I went back to the classic version, it turned out the way you described. In my variant the curve changes every time the filter is applied and eventually tends to be straight (after several hundred filterings). The larger the filter window, the faster it happens.
To avoid further ambiguity, I am providing a piece of code in C.
It's simple, I hope anyone can figure it out.
//---------------------------------------------------------------------------
void __fastcall TPlotForm2D_WL::FilterCurveMedian(int Flen)
{
 //количество точек кривой
 int NN=Chart1->Series[IndexUpDown->Position-1]->Count();
 
 //объявляем временные массивы и выделяем память под них
 double* TempArray=new double[NN+(Flen/2)*2];
 double* ResultArray= new double[NN];
 double* XArray=new double[NN];
 double* MedArray=new double[Flen];

 //заполняем массив значений Х точками текущей кривой
 for(int i=0;i<NN;++i)
  XArray[i]=Chart1->Series[IndexUpDown->Position-1]->
                           XValues->Value[i];

 double Start=2*Chart1->Series[IndexUpDown->Position-1]->
                                YValues->Value[0];
 double End=2*Chart1->Series[IndexUpDown->Position-1]->
                                YValues->Value[NN-1];

 int k=0;

 //заполняем временный массив значениями Y точками текущей кривой
 for(int i=Flen/2;i>0;--i) //симметричное расширение влево
  TempArray[k++]=Start-Chart1->Series[IndexUpDown->Position-1]->
                                      YValues->Value[i];
 for(int i=0;i<NN;++i)
  TempArray[k++]=Chart1->Series[IndexUpDown->Position-1]->
                                YValues->Value[i];
 for(int i=NN-1;i>=NN-Flen/2;--i)//симметричное расширение вправо
  TempArray[k++]=End-Chart1->Series[IndexUpDown->Position-1]->
                                YValues->Value[i];

 //собственно фильтрация
 for(int i=Flen/2;i<NN+Flen/2;++i)
  {
   for(int j=-Flen/2;j<=Flen/2;++j)
    MedArray[j+Flen/2]=TempArray[i+j];
   ::sort(MedArray,MedArray+Flen);
   //Это то, что я написал когда-то. Уже не помню, почему так.
   //Но это работает!!!!!!!!!!
   ResultArray[i-Flen/2]=(MedArray[Flen/2]+MedArray[Flen/2-1])/2;
   //А эта строчка - классический медианный фильтр.
   //И это не работает, так как хотелось бы. ???? Sorry
   //ResultArray[i-Flen/2]=MedArray[Flen/2];
  }


 //дальше вывод и удаление временных массивов
 AddFastLine();

 for(int i=0;i<NN;++i)
  Chart1->Series[Chart1->SeriesCount()-1]->
          AddXY(XArray[i],ResultArray[i],"",clBlue);

 SwitchOnCurve(PlotForm2D_WL->Chart1->SeriesCount()-1);

 delete [] TempArray;
 delete [] ResultArray;
 delete [] XArray;
 delete [] MedArray;

 if(PlotForm2D_WL->Visible)
  PlotForm2D_WL->Visible = false;
 PlotForm2D_WL->Show();

}
//---------------------------------------------------------------------------



About the "left window" - all true, I agree. But for now, I think it's details.

Once again, my apologies.

 
to Northwind
...But if you are seriously interested in obtaining this research paper, write to us (info@disserr.ru) and we will deliver the requested work from the archive if possible...


Maybe there is some news about this work?
 
to Северный Ветер
...But if you are seriously interested in obtaining this research paper, write to us (info@disserr.ru) and we will deliver the requested work from the archive if possible...


Has there been any news on this work?

I did not take any further steps after the publication of their response.
I just showed you a way to try to find the thesis material.
I warn you that the material may have to be paid for.
 
2 Andre69

Doing some heavy positional battles with MatLab.
For a start I decided to just look at the wavelet decomposition of a series of price and a series of indicator values. For DWT I didn't find any surprises, everything is more or less understandable.
For CWT the indicator decomposition was also quite clear. However, the price series has produced the following picture:


The structure of this picture generally speaking differs significantly from, for example, the picture in Andre69's post on 28.06.07 20:43 on page. 141. I would like to understand why.
On the other hand it has too regular structure. Why?
This analysis was performed for a series of 1024 samples.
Scale settings: Min=1, Step=1, Max=512. DMeyer wavelet

PS By the way, the above post was the last in an endless series about wavelets. :-)
I would like to know about continuation. Should ?
 
to Yurixx
The structure of this picture in general is quite different from, for example, the picture in the post Andre69 28.06.07 20:43 on page 141. 141. I would like to understand why.
On the other hand it has too regular structure. Why ?


Yura, such a regular structure is inherent in the nature of edge effects that inevitably occur at the ends of the BP being studied. It is impossible to avoid such effects. But if allowed by the condition of the problem to be solved, you can leave a few terms of the series from each end of the VR (the number of terms equal to the sample window width) that will take part in the calculations, but will not be used in the visualization. After this procedure the picture will be adequate and isotropic.
 
<br / translate="no"> But if the condition of the problem to be solved allows, you can leave a few row members at each end of the BP, which will take part in the calculations, but will not be used in the visualization. After this procedure the picture will be adequate and isotropic.


Thanks, Sergey, for the clarification. All that remains is to figure out how to do what you write about.
Parsing Wavelet Toolbox I didn't find such features there. Maybe I have overlooked something or it can only be done manually?
 
This effect can be minimized by fulfilling the condition: n/N<<1, where n is window size (in your case, as I understand, n = Max), N is the number of BP members (1024). Assuming 0.01<<1, we have Mach<10 for the available series.
In this case the presented results will look correct.