Attachments forums

List of attachments posted on this forum.


All files on forums: 135311

Re: TradeStation Indicators

mladen, Sat May 27, 2017 10:49 pm

Mean reversion indicator

Code: Select all

// TASC JAN 2017
// Mean-Reversion Swing Trading
// Ken Calhoun

inputs:
	ChanLength( 20 ),
	MALength( 50 ) ;
	
variables:
	UpperBand( 0 ),
	LowerBand( 0 ),
	MidBand( 0 ),
	LongOK( false ),
	ShortOK( false ),
	LowRef( 0 ),
	HighRef( 0 ),
	TriggerLine( 0 ),
	MAValue( 0 ) ;
	
UpperBand = Highest( High, ChanLength ) ;
LowerBand = Lowest( Low, ChanLength ) ;
MAValue = Average( Close, MALength ) ;

if Low = LowerBand then
	begin
	LowRef = Low ;
	LongOK = false ;
	ShortOK = true ;
	end ;
	
if High = UpperBand then
	begin
	HighRef = High ;
	LongOK = true ;
	ShortOK = false ;
	end ;	

TriggerLine = .5 * ( HighRef + LowRef ) ;
	
Plot1( UpperBand, "UpperBand" ) ;
Plot2( LowerBand, "LowerBand" ) ;
Plot3( TriggerLine, "Trigger" ) ;
Plot4( MAValue, "Mov Avg" ) ;

if LongOK then
	begin
	SetPlotColor( 1, Green ) ;
	SetPlotColor( 2, Green ) ;
	end
else
	begin
	SetPlotColor( 1, Red ) ;
	SetPlotColor( 2, Red ) ;
	end ;	
All files in topic