[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Optimal Detrending by John F. Ehlers



PureBytes Links

Trading Reference Links

Hermann,

I had this code in my old "archives", it was in mstock code

OEF:=(0.13785*((2*P)-Ref(P,-1)))
+ (0.0007*((2*Ref(P,-1))-Ref(P,-2)))
+ (0.13785*((2*Ref(P,-2))-Ref(P,-3)))
+ (1.2103*PREV)
- (0.4867*Ref(PREV,-1));
OEF


stephane
> Hi hermann,
> I don't understand the Ama2 myself, but why don't you write it in 
a 
> plugin, are you sure of the formula?
> 
> stephane
> 
> AmiVar VDetrending( int NumArgs, AmiVar *ArgsTable )
> {
> int i;
> AmiVar DeTrend;
> DeTrend= gSite.AllocArrayResult();
> 
> int nSize = gSite.GetArraySize();
> 
> float *Price = ArgsTable[ 0 ].array;
> 
> double S1 = 0.13785;
> double S2 = 0.0007;
> double S3 = 0.13785;
> double S4 = 1.2103;
> double S5 = 0.4867;
> 
> for( i = 3; i < nSize; i++ )
> {
> DeTrend.array[i]= ((float)S1* (2*Price[i]-Price[i-
> 1]))
> 
> + ((float)S2* (2*Price[i-1]-Price[i-2])) 
> 
> + ((float)S3 * (2*Price[i-2]-Price[i-3])) 
> 
> + ((float)S4 * (DeTrend.array[i-1] - (float)
> S5*DeTrend.array[i-2]));
> }
> return DeTrend;
> }
> > Re: http://store.traders.com/traderscom/v12029opdetb.html
> > 
> > Hello,
> > 
> > Has anybody succeeded in coding the Optimum Detrending/Smoothing
> > function/oscillator published in TASC (July, 2000, p20) in AFL?
> > 
> > This appears an application for the AMA or AMA2 but I still have 
no
> > intuitive appreciation of their use :-( I still dream of a more 
> intuitive
> > AFL syntax equivalent for "Prev" - but faster :-)
> > 
> > The EasyLanguage formula is given as:
> > 
> > S1 = 0.13785;
> > S2 = 0.0007;
> > S3 = 0.13785;
> > S4 = 1.2103;
> > S5 = 0.4867;
> > Price = (H+L)/2;
> > 
> > Smooth = S1 * (2*Price-Price[1]) +
> > S2 * (2*Price[1]-Price[2]) +
> > S3 * (2*Price[2]-Price[3]) +
> > S4 * (Smooth[1]-S5*Smooth[2]);
> > 
> > Any help would be much appreciated!
> > 
> > Have a great day,
> > Herman.