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

[EquisMetaStock Group] Re: from amibroker formula language



PureBytes Links

Trading Reference Links

Guppy is one who has helped generate interest in Parabolic Trends.
http://www.guppytraders-essentials.com/GE_TBFE.htm

Given that there are other Guppy oriented toolboxes available for 
free (at least to MSTT subscribers, Umit's Trend Toolbox may have 
more application.

http://www.traderhelp.net/products/ttbox.html 

>>Polynomial function can draw up to10th order polynomial curves as 
well as linear regression and parabolic regression trend lines. It 
can be used for data fitting, which is mathematical analysis of a 
data set in order to analyze trends in the data values by finding a 
mathematical model that fits data set. This involves linear or non-
linear regression analysis of these data points, in order to define a 
set of parameter values that best characterize the relationship 
between the data points and an underlying theoretical model.

You can use 1st order polynomial to get linear regression slope : y
(x) = ax + b screenshot

Parabolic regression can be obtained with 2nd degree polynomial : y
(x) = a x2 + b x + c screenshot

Nth order polynomial can be interpreted as: y(x) = c0*x0 + c1*x1 + 
c2*x2 + c3*x3 + ... cn*xn and can be used for smoothing data or other 
purposes. You can access a screenshot here and another one here. 

A limited shareware version is available.

Regards,
Ron





--- In equismetastock@xxxxxxxxxxxxxxx, pumrysh <no_reply@xxx> wrote:
>
> Claudio,
> 
> Thats not something I would like to tackle. You may benefit from a 
> search of the archived messages and look for "Parabolic Trend".
> From what I see you will need an add-on DLL to accomplish what you 
> would like. There is one and right off the top of my head I don't 
> remember who offers it but I know it is discussed in the messages.
> 
> Hope this helps,
> 
> Preston
> 
> 
> 
> --- In equismetastock@xxxxxxxxxxxxxxx, "Claudio" <bastaromeo@> 
> wrote:
> >
> > Thanks Preston for your last research, i've founded this formula 
on
> > amibroker site and i think that this may help me for best-fit
> > research, do you can to translate it in metastock language? again
> > thanks of all.
> > 
> > ---------------------- START -----------------------------
> > // *********************************************************
> > // *
> > // * AFL Function for nth Order Polynomial Fit
> > // *     Calls Gaussian_Elimination ( VBS )
> > // *
> > // *     Y      = The array to Fit 
> > // *     BegBar = Beg Bar in range to fit
> > // *     EndBar = End Bar in range to fit
> > // *     Order  = 1 - 8 = Order of Poly Fit (Integer)
> > // *     ExtraB = Number of Bars to Extrapolate (Backward)
> > // *     ExtraF = Number of Bars to Extrapolate (Forward)
> > // *
> > // *********************************************************
> >  
> > function PolyFit(GE_Y, GE_BegBar, GE_EndBar, GE_Order, GE_ExtraB,
> > GE_ExtraF)
> > {
> >     BI        = BarIndex();
> > 
> >     GE_N      = GE_EndBar - GE_BegBar + 1;
> >     GE_XBegin = -(GE_N - 1) / 2;
> >     GE_X      = IIf(BI < GE_BegBar, 0, IIf(BI > GE_EndBar, 0,
> > (GE_XBegin + BI - GE_BegBar)));
> > 
> >     GE_X_Max  = LastValue(Highest(GE_X));
> > 
> >     GE_X      = GE_X / GE_X_Max;
> > 
> >     X1 = GE_X;
> >     AddColumn(X1, "X1", 1.9);
> > 
> >     GE_Y      = IIf(BI < GE_BegBar, 0, IIf(BI > GE_EndBar, 0, 
> GE_Y));
> > 
> >     GE_SumXn  = Cum(0);
> >                                  GE_SumXn[1]   = LastValue(Cum
> (GE_X)); 
> >     GE_X2     = GE_X * GE_X;     GE_SumXn[2]   = LastValue(Cum
> (GE_X2));
> >     GE_X3     = GE_X * GE_X2;    GE_SumXn[3]   = LastValue(Cum
> (GE_X3)); 
> >     GE_X4     = GE_X * GE_X3;    GE_SumXn[4]   = LastValue(Cum
> (GE_X4)); 
> >     GE_X5     = GE_X * GE_X4;    GE_SumXn[5]   = LastValue(Cum
> (GE_X5)); 
> >     GE_X6     = GE_X * GE_X5;    GE_SumXn[6]   = LastValue(Cum
> (GE_X6)); 
> >     GE_X7     = GE_X * GE_X6;    GE_SumXn[7]   = LastValue(Cum
> (GE_X7)); 
> >     GE_X8     = GE_X * GE_X7;    GE_SumXn[8]   = LastValue(Cum
> (GE_X8)); 
> >     GE_X9     = GE_X * GE_X8;    GE_SumXn[9]   = LastValue(Cum
> (GE_X9)); 
> >     GE_X10    = GE_X * GE_X9;    GE_SumXn[10]  = LastValue(Cum
> (GE_X10)); 
> >     GE_X11    = GE_X * GE_X10;   GE_SumXn[11]  = LastValue(Cum
> (GE_X11)); 
> >     GE_X12    = GE_X * GE_X11;   GE_SumXn[12]  = LastValue(Cum
> (GE_X12)); 
> >     GE_X13    = GE_X * GE_X12;   GE_SumXn[13]  = LastValue(Cum
> (GE_X13)); 
> >     GE_X14    = GE_X * GE_X13;   GE_SumXn[14]  = LastValue(Cum
> (GE_X14)); 
> >     GE_X15    = GE_X * GE_X14;   GE_SumXn[15]  = LastValue(Cum
> (GE_X15)); 
> >     GE_X16    = GE_X * GE_X15;   GE_SumXn[16]  = LastValue(Cum
> (GE_X16)); 
> > 
> >     GE_SumYXn = Cum(0);
> >                                  GE_SumYXn[1]  = LastValue(Cum
> (GE_Y));
> >     GE_YX     = GE_Y    * GE_X;  GE_SumYXn[2]  = LastValue(Cum
> (GE_YX));
> >     GE_YX2    = GE_YX   * GE_X;  GE_SumYXn[3]  = LastValue(Cum
> (GE_YX2)); 
> >     GE_YX3    = GE_YX2  * GE_X;  GE_SumYXn[4]  = LastValue(Cum
> (GE_YX3));
> >     GE_YX4    = GE_YX3  * GE_X;  GE_SumYXn[5]  = LastValue(Cum
> (GE_YX4));
> >     GE_YX5    = GE_YX4  * GE_X;  GE_SumYXn[6]  = LastValue(Cum
> (GE_YX5));
> >     GE_YX6    = GE_YX5  * GE_X;  GE_SumYXn[7]  = LastValue(Cum
> (GE_YX6));
> >     GE_YX7    = GE_YX6  * GE_X;  GE_SumYXn[8]  = LastValue(Cum
> (GE_YX7));
> >     GE_YX8    = GE_YX7  * GE_X;  GE_SumYXn[9]  = LastValue(Cum
> (GE_YX8));
> > 
> >     GE_Coeff  = Cum(0);
> > 
> >     GE_VBS    = GetScriptObject();
> >     GE_Coeff  = GE_VBS.Gaussian_Elimination(GE_Order, GE_N, 
> GE_SumXn,
> > GE_SumYXn);
> > 
> >     for (i = 1; i <= GE_Order + 1; i++)
> >         printf(NumToStr(i, 1.0) + " = " + NumToStr(GE_Coeff[i], 
> 1.9) +
> > "\n");
> > 
> >     GE_X   = IIf(BI < GE_BegBar - GE_ExtraB - GE_ExtraF, 0, IIf
(BI 
> >
> > GE_EndBar, 0, (GE_XBegin + BI - GE_BegBar + GE_ExtraF) / 
> GE_X_Max));
> > 
> >     GE_X2  = GE_X   * GE_X; GE_X3  = GE_X2  * GE_X; GE_X4  = 
> GE_X3  *
> > GE_X; GE_X5  = GE_X4  * GE_X; GE_X6  = GE_X5  * GE_X;
> >     GE_X7  = GE_X6  * GE_X; GE_X8  = GE_X7  * GE_X; GE_X9  = 
> GE_X8  *
> > GE_X; GE_X10 = GE_X9  * GE_X; GE_X11 = GE_X10 * GE_X; 
> >     GE_X12 = GE_X11 * GE_X; GE_X13 = GE_X12 * GE_X; GE_X14 = 
> GE_X13 *
> > GE_X; GE_X15 = GE_X14 * GE_X; GE_X16 = GE_X15 * GE_X; 
> > 
> >     GE_Yn = IIf(BI < GE_BegBar - GE_ExtraB - GE_ExtraF, -1e10, IIf
> (BI
> > > GE_EndBar, -1e10, 
> >             GE_Coeff[1]  + 
> >             GE_Coeff[2]  * GE_X   + GE_Coeff[3]  * GE_X2  +
> > GE_Coeff[4]  * GE_X3  + GE_Coeff[5]  * GE_X4  + GE_Coeff[6]  * 
> GE_X5  +
> >             GE_Coeff[7]  * GE_X6  + GE_Coeff[8]  * GE_X7  +
> > GE_Coeff[9]  * GE_X8));
> > 
> >     return GE_Yn;
> > }
> > 
> > // *********************************************************
> > // *
> > // * Demo AFL to use PolyFit
> > // *
> > // *********************************************************
> > 
> > Filter = 1;
> > 
> > BI        = BarIndex();
> > PF_BegBar = BeginValue(BI);
> > PF_EndBar = EndValue(BI);
> > PF_Y      = (H + L) / 2;
> > PF_Order  = Param("nth Order",             6, 1,  15, 1);
> > PF_ExtraB = Param("Extrapolate Backwards", 20, 0, 50, 1);
> > PF_ExtraF = Param("Extrapolate Forwards",  20, 0, 50, 1);
> > 
> > Yn = PolyFit(PF_Y, PF_BegBar, PF_EndBar, PF_Order, PF_ExtraB, 
> PF_ExtraF);
> >  
> > GraphXSpace = 10;
> > 
> > Plot(Yn, "nth Order Polynomial Fit - " + NumToStr(PF_Order, 1.0),
> > IIf(BI > PF_EndBar - PF_ExtraF, colorWhite, IIf(BI < PF_BegBar -
> > PF_ExtraF, colorWhite, colorBrightGreen)), styleThick, Null, Null,
> > PF_ExtraF);
> > PlotOHLC(O, H, L, C, "Close", colorLightGrey, styleCandle);
> > 
> > ----------------------  END  -----------------------------
> >
>




 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/equismetastock/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/equismetastock/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:equismetastock-digest@xxxxxxxxxxxxxxx 
    mailto:equismetastock-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    equismetastock-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/