LinReg ATR-TL BreakOut on Close Strategy - Trading system

Vragen en suggesties over handelssystemen en indicatoren

Moderator: Perry

LinReg ATR-TL BreakOut on Close Strategy - Trading system

Berichtdoor JPR » za 08 nov 2003, 16:00

Here's a strategy based on buying or selling when a bar breaks out of a Linear Regression Trendline Channel.
To create the LR Channel ATR's are used. The Tradestation "Lin Reg Line" indicator was modified to create the code. The strategie plot the LR Channel on the screen and Buys or Sells when a bar closes outside of the channel.



inputs:
Length( 20 ),
? ?Mult(2.0),
Color( Yellow ),
ColorTop( Cyan ),
ColorBot( Magenta ),
ExtRight( true ) ;

variables:
LRV( 0 ),
LRVAgo( 0 ),
LRVAgot( 0 ),
LRVAgob( 0 ),
TLLRV( 0 ),
TLLRVt( 0 ),
TLLRVb( 0 ),
Flag( 0 ),
?Dev(0),
? ?BuyPrice( 0 ),
? ?SellPrice( 0 );

if Flag = 0 then begin { Insert 1st LinRegLine; Set Color and ExtRight }
if BarNumber > 2*Length {and LastBarOnChart} then begin
?LRV = LinearRegValue( C, Length, 0 ) ;
?LRVAgo = LinearRegValue( C, Length, Length - 1 ) ;
?Dev = Mult * average(range,Length);
?TLLRV = TL_New( Date[ Length - 1 ], Time[ Length - 1 ], LRVAgo, Date, Time, LRV ) ;
?TLLRVt = TL_New( Date[ Length - 1 ], Time[ Length - 1 ], LRVAgo+Dev, Date, Time, LRV+dev ) ;
?TLLRVb = TL_New( Date[ Length - 1 ], Time[ Length - 1 ], LRVAgo-Dev, Date, Time, LRV-Dev ) ;
?Flag = 1 ;
?TL_SetColor( TLLRV, Color ) ;TL_SetColor( TLLRVt, ColorTop ) ;TL_SetColor( TLLRVb, ColorBot ) ;
?TL_SetExtLeft( TLLRV, false ) ;TL_SetExtLeft( TLLRVt, false ) ;TL_SetExtLeft( TLLRVb, false ) ;
?if ExtRight then begin
? TL_SetExtRight( TLLRV, true );TL_SetExtRight( TLLRVt, true );TL_SetExtRight( TLLRVb, true );
?end else begin
? TL_SetExtRight( TLLRV, false ) ;TL_SetExtRight( TLLRVt, false ) ;TL_SetExtRight( TLLRVb, false ) ;
?end ;
end ;
end
else if Flag = 1 then begin

{ Signals. }
BuyPrice = TL_GetValue( TLLRVt, Date, Time ) ;
SellPrice = TL_GetValue( TLLRVb, Date, Time ) ;
if Close crosses over BuyPrice then
?Buy ( "LR-LE" ) next bar at Market ;
if Close crosses under SellPrice then
?SellShort ( "LR-SE" ) next bar at Market ;

{ Reset the end-points of LRLines ?}
LRV = LinearRegValue( C, Length, 0 ) ;
LRVAgo = LinearRegValue( C, Length, Length - 1 ) ;
Dev = Mult * average(range,Length);
TL_SetBegin( TLLRV, Date[ Length - 1 ], Time[ Length - 1 ], LRVAgo ) ;
TL_SetEnd( TLLRV, Date, Time, LRV ) ;
TL_SetBegin( TLLRVt, Date[ Length - 1 ], Time[ Length - 1 ], LRVAgo+Dev ) ;
TL_SetEnd( TLLRVt, Date, Time, LRV+Dev ) ;
TL_SetBegin( TLLRVb, Date[ Length - 1 ], Time[ Length - 1 ], LRVAgo-Dev ) ;
TL_SetEnd( TLLRVb, Date, Time, LRV-Dev ) ;

end ;


Paul M .... Heb jij een oplossing voor de kleuren & lijnen .... ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Groet, ? ? ?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Paul R ?

(Edited by JPR at 4:28 pm op 8,nov. 2003)
JPR
 
Berichten: 85
Geregistreerd op: wo 03 jul 2002, 18:39

LinReg ATR-TL BreakOut on Close Strategy

Berichtdoor Paul M » za 08 nov 2003, 17:07

Hallo Paul,

Nee, die heb ik niet. Veel van deze functie's zijn nog niet geimplementeerd.

Paul.
Paul M
 
Berichten: 263
Geregistreerd op: vr 13 dec 2002, 23:21


Keer terug naar Handelssystemen + Indicatoren

Wie is er online

Gebruikers op dit forum: Geen geregistreerde gebruikers en 11 gasten

cron