Market Trader Forum

Market Trader Forum
das ultimative Expertenforum
 
RegistrierenRegistrieren  LoginLogin

Neues Thema eröffnen   Neue Antwort erstellen    Market Trader Forum Foren-Übersicht -> TradeStation Ecke
Autor
Nachricht
Mercure


Anmeldedatum: 18.03.2006
Beiträge: 183

PolyFit Projekt
Verfasst am: 09.01.2007, 07:53

Ich möchte mit den nachfolgenden Infos auf eine Diskussion im TS-Forum zum PolyFit Projekt aufmerksam machen:

https://www.tradestation.com/Discussions/Topic.aspx?Topic_ID=59250

Mich würde eine Strategie für die Intraday-Anwendung beim FDAX interessieren. Sicher wäre auch ein Vergleich der Ergebnisse mit „MT-ACD“ angebracht. Mit meinen begrenzten Easy Language-Kenntnissen ist das leider nicht möglich.

Vor der Anwendung ist es sinnvoll, die grundlegenden Erläuterungen von Dr. Griffin am Anfang des Threads durchlesen. Die TS8.1-User können die Version aus dem Forum nehmen, für die TS2000i sind jedoch div. Anpassungen erforderlich.

Nachfolgend die txt-Version des PolyFit Indikator, die in der TS 2000i verifiziert wird:
(Da der Text für den Beitrag isgesamt zu lang ist, muß ich ihn in zwei Teile aufsplitten)


{
XCAP_iPolyFitPredict:

Uses a fit to polynomials to create a least squares best fit for a given maximum degree. Extends the fit
forward in time for trading purposes. See reference for more information.

Author: Paul A. Griffin
January 4, 2007
Extrema Capital, 2007

This indicator provides as output the least square best fit to a set of polynomials of maximum power (degree) using
discrete Legendre polynomials. This is accomplished by decomposing the time series into discrete Legendre polynomials
over the interval of orthogonality given by 2 * Width + 1 and discarding the polynomial fits degrees above some maximum degree.
The remaining smoothed series is continued forward in time by following the polynomial fit.

Some Comments:

In this indicator, we are displaying the least squares fit to a low degree set of polynomials and extending that fit
into the future. This as a tool to extend a low order trend into the future.

Some Plots:

All Charts: Daily chart with a width of 126 bars (126*2+1 = 253, about 1 trading year)

For @US (30 year US Treasury Bond Futures), and SPY roughly for year 2006

MaxDegrees: 1, 2, 3

ForwardExtension: 10

ShowLeadingEdge = TRUE

As you move forward along the time series, the fit is generated. What is displayed is the leading, rightmost bar, "", for
each fit.

ShowPredictedEdge = TRUE

As you move forward along the time series, the fit is generated, and then a prediction is made.
What is displayed is the predicted, beyond the rightmost bar, "[-ForwardExtension]", for each fit.

ShowLastFit = TRUE

This displays the entire last fit for just the last bar on the chart, so you will only see an output on the last
2*Width + 1 bars of your chart. It will also display the polynomial extension of the fit forward in time to bar
[-ForwardExtension]

References:

Legendre Polynomial Fits https://www.tradestation.com/Discussions...?Topic_ID=58534

Savitzky Golay https://www.tradestation.com/Discussions...?Topic_ID=59250

http://en.wikipedia.org/wiki/Legendre_polynomials

Peter Seffen, "On Digital Smoothing Filters: A Brief Review of Closed Form Solutions and Two New Filter Approaches",
Circuits Systems Signal Process, Vol. 5, No 2, 1986


}

Mercure
_________________
 
Mercure


Anmeldedatum: 18.03.2006
Beiträge: 183


Verfasst am: 09.01.2007, 07:55

Nachfolgend die txt-Version des Indikators für die TS2000i:

}

Inputs:
TimeSeries((h+l)/2),
Width(55),
MaxDegree(1),
ForwardExtension(5),
ShowLeadingEdge(FALSE),
ShowPredictedEdge(FALSE),
ShowSmTimeSeries(TRUE),
LeadingEdgeColor(Blue),
LEupcolor(green),LEdncolor(red),
PredictedEdgeColor(Magenta),
SmTimeSeriesColor(Red),
FITupcolor(blue),FITdncolor(red),
ExtTimeSeriesColor(Yellow);

Variables:
LeadingEdge(0),
PredictedEdge(0),
p(0),j(0),
DataSize((2*Width+1) + ForwardExtension);

Arrays:
Polynomial(0),
Coefficient(0),
SmTimeSeries(0);

if barnumber = 1 then begin

{ Array_SetMaxIndex(Polynomial, DataSize*(MaxDegree+1)+1) ;
Array_SetMaxIndex(SmTimeSeries, DataSize);
Array_SetMaxIndex(Coefficient, MaxDegree+1) ;
}
end;

if ShowLeadingEdge=TRUE or ShowPredictedEdge=TRUE or (LastBarOnChart=TRUE and ShowSmTimeSeries=TRUE ) then begin


for p = 0 to MaxDegree begin

Coefficient[p] = 0;

for j = -Width to +Width begin
Coefficient[p]= Coefficient[p] + Polynomial[p*DataSize+Width+j]*TimeSeries[Width-j] ;
end;
end;



for j = -Width to Width + ForwardExtension begin
SmTimeSeries[Width+j] = 0;

for p = 0 to MaxDegree begin
SmTimeSeries[Width+j] = SmTimeSeries[Width+j] + Coefficient[p]*Polynomial[p*DataSize+Width+j];
end;
end;


LeadingEdge = SmTimeSeries[Width+Width];


PredictedEdge = SmTimeSeries[Width+Width+ForwardExtension];

end;


if ShowLeadingEdge=TRUE and LeadingEdge<>0 then begin
Plot1(LeadingEdge,"LdngEdge",LeadingEdgeColor);
If LeadingEdge > LeadingEdge then begin
plot1(LeadingEdge,"LdngEdge",LEupcolor);
end else begin
plot1(LeadingEdge,"LdngEdge",LEdncolor);
end;
end;

if ShowPredictedEdge=TRUE and PredictedEdge<>0 then Plot2[-ForwardExtension](PredictedEdge,"FwrdEdge",PredictedEdgeColor);

if LastBarOnChart=TRUE and ShowSmTimeSeries=TRUE then begin

for j = -Width to Width begin
plot3[Width-j](SmTimeSeries[Width+j],"Fit",SmTimeSeriesColor);
If SmTimeSeries[Width+j+1] > SmTimeSeries[Width+j] then begin
plot3[Width-j](SmTimeSeries[Width+j],"Fit",fitupcolor);
end else begin
plot3[Width-j](SmTimeSeries[Width+j],"Fit",fitdncolor);
end;
end;

if ForwardExtension > 0 then begin
for j = 1 to ForwardExtension begin
plot4[-j](SmTimeSeries[Width+Width+j],"Prediction",ExtTimeSeriesColor);
end;
end;

end;


{Create the Orthoginal Legendre Polynomials during the first bar, including ForwardExtension data}

if barnumber = 1 then begin


for j = - Width to + Width + ForwardExtension begin
Polynomial[0*DataSize + Width+j] = 1;
end;

if MaxDegree>=1 then begin
for j = -Width to +Width + ForwardExtension begin
Polynomial[1*DataSize + Width+j] = j;
end;
end;

if MaxDegree > 1 then begin
for p = 1 to MaxDegree - 1 begin
for j = -Width to Width + ForwardExtension begin

Value1 = j*(2*p+1)/(p+1);
Value2 = - (p/(p+1))*(2*Width+1+p)*(2*Width+1-p)/4;

Polynomial[(p+1)*DataSize+Width+j]
= Value1 * Polynomial[p*DataSize+Width+j] + Value2 * Polynomial[(p-1)*DataSize+Width+j];
end;
end;
end;

for p = 0 to MaxDegree begin
Value1 = Power(2,-2*p)/(2*p+1);
for j = -p to p begin Value1 = Value1 * (2*Width+1+j); end;
if Value1 > 0 then Value1 = 1/squareroot(Value1);

for j = -Width to +Width + ForwardExtension begin
Polynomial[p*DataSize+Width+j] = Value1 * Polynomial[p*DataSize+Width+j];
end;
end;

end;

Ich hoffe, dass beim Einkopieren der Formel keine Fehler entstanden sind.

Mercure
 
SwingManT


Anmeldedatum: 17.08.2005
Beiträge: 1700
Wohnort: Frankfurt am Main


Verfasst am: 09.01.2007, 08:45

@Mercure

Poste bitte auch ein paar Bilder aus dem Beitrag, sie sind sehr schön, und nicht jeder hat Zugriff auf dem TS Forum.

Ähnliche Berechnungen habe ich vor ein paar Monate gemacht, muß den Thread aufmerksam durchlesen.
Bei Interesse könnte ich eine Umsetzung in VisualChart versuchen.
 
Mercure


Anmeldedatum: 18.03.2006
Beiträge: 183


Verfasst am: 09.01.2007, 09:01

@Swingman,

der erste Chart zeigt den Indikator, der zweite die Intraday-Signale von gestern.

Mercure



 
SwingManT


Anmeldedatum: 17.08.2005
Beiträge: 1700
Wohnort: Frankfurt am Main


Verfasst am: 09.01.2007, 11:23

@Mercure

Das Interessante an der Geschichte ist daß die Kurven sich dynamisch ändern, so daß man eigentlich kein Backtesting machen kann!

Im Thread hat man das auch diskutiert:


    It seems to be a little bit difficult to evaluate the reliableness of this indicator, in cause of the big difference between live trading/watching and "backtesting" / watching after market is closed.
    Or am I wrong regarding this point?


    Posted - 01/08/2007 19:46:29
    The major difference is that we are used to viewing static Plots as opposed to these dynamic plots.

    In most of the other indicators, the values of the plots you've experienced end up with a single value per each bar and that value doesn't change as a new bar is painted. Thus static.

    This indicator calculates the "best fit" for the data width as it streams in and plots it immediately. Thus dynamic.

    That is why I set it up to watch it in real time.

    The end-of-session snapshot does a very poor job of letting you know what was going on at the time I placed the arrows. But you can tell that, with the exception of the arrow on the 14:50 candle, the timing was good. Often in that last hour of an "up" day, there is a final push to try and take it higher. But even if you had taken that short at that time and closed your position at the close, you would have won.

    I encourage all of you to set up your favorite chart, put some thought into widths and MaxDegree settings and see what it will do for you.

    Not too bad as a discretionary-trader tool.

    This has certainly given me all kinds of ideas to pursue toward the "strategy" side of trading.

 
GBoos




Anmeldedatum: 24.10.2005
Beiträge: 434


Verfasst am: 09.01.2007, 12:15

Also sieht es im "Nachhinein" auch immer gut aus. Ich halte davon auf den ersten Blick rein gar nichts. Muss aber sagen das ich nur auf dem Thema geschwommen und noch nicht in das Thema eingetaucht bin.

Eine reine optische Auswertung ist auch problematisch (deswegen sieht der Chart immer gut aus), weil die Linien erst mit einem Timeleg von 2 Bars die "Richtung" anzeigen.

Wie auch immer .... man kann sich mit 100 Sachen beschäftigen. Ich bleibe beim Pattern-/BreakOut-Trading -> Indikatoren lügen nunmal .

Gruss GBoos
_________________


 
Mercure


Anmeldedatum: 18.03.2006
Beiträge: 183


Verfasst am: 09.01.2007, 14:33


Ich würde die Intraday-Signale, die der Indiaktor gibt, gerne mal "live" verfolgen, um mir eine eigene Meinung bilden zu können. Vor allem wie sich der "dynamische" Teil des Ganzen verändert.
Leider kann ich das monentan nicht, da ich auf längere Zeit nicht am PC zu Hause bin - deswegen wäre ich an einem Test durch andere TS-User interessiert.

Mercure
 
Neues Thema eröffnen   Neue Antwort erstellen    Market Trader Forum Foren-Übersicht -> TradeStation Ecke

Tags: trading, indicator, futures, ts2000i, least, forum

 
 Verwandte Themen   Aufrufe   Letzter Beitrag 
Keine neuen Beiträge Chart 2037 28.08.2008, 13:28
Keine neuen Beiträge Visual Chart + Ross 741 16.04.2007, 15:52
Keine neuen Beiträge Visual Chart? 858 18.05.2006, 17:38
Keine neuen Beiträge Chart Programm Tai Pan EOD 770 25.01.2006, 13:12
Keine neuen Beiträge Unterer Chart 630 05.11.2005, 17:55
 



[ Time: 0.2869s ][ Queries: 135 (0.0244s) ][ GZIP on - Debug on ]