log in     sign up for free
 
The single most important advice I can give anybody is: Learn from your mistakes. That is the only way to become a successful trader.
David Ryan
 
 
Home
systems (284)
 
 
Special offer: buy AmiBroker and EOD+Real-Time Data
 

Buy

MetaStock

     (special offer)
 
 
 

Buy

EOD data for MetaStock

     (special offer)
 
 
 

Buy

Realtime data for MetaStock

     (special offer)
 
 
 
 
Formula Library
 
AmiBroker
MetaTrader
MetaStock
TradeStation
Wealth-Lab
NinjaTrader
 
add your formula
System Library
 
 
Account login
Your email:
Password:
 
Log in
New to s4t? Sign up.
If you forgot your password click here.
Search the Web
 
Custom Search

TRIX System S&C

System for: TradeStation


 

 

Views:  1653

Added: August 23, 2008
 
Rate this code:  Rate: 1 Rate: 2 Rate: 3 Rate: 4 Rate: 5
This formula has not been rated yet
 
 

email this link

 
 
Tags: TradeStation, system
 
Your Ad Here
The June 1997 issue of STOCKS & COMMODITIES discussed a tried-and-true technique known as TRIX in the article "Playing TRIX: The triple exponential smoothing oscillator." The TRIX indicator and system code below for TradeStation includes alerts and signals based on both the crossing of the zero line and the crossing of the linear regression average. The inputs, aside from the basic parameter adjustments, will also allow you to specify whether you want to generate alerts and signals on the crossing of the zero line, the linear regression average or both.
Before creating the indicator and system, a new TRIX function must be developed. The function, which we'll call NewTRIX, is thus:



Type: Function, Name: NewTRIX
Inputs: Price(NumericSeries), Length(NumericSimple);
Vars: LogP(0), alpha(0), sm1(0), sm2(0), sm3(0);

LogP = Log(Price);

IF CurrentBar = 1 Then Begin
sm1 = LogP;
sm2 = LogP;
sm3 = LogP;
alpha = 2 / (Length + 1);
End Else Begin
sm1 = (LogP - sm1) * alpha + sm1;
sm2 = (sm1 - sm2) * alpha + sm2;
sm3 = (sm2 - sm3) * alpha + sm3;
NewTrix = (sm3 - sm3[1]) * 100;
End;




Continuing on, the entries for the TRIX system code are based on the same premise as the alerts for the indicator code given above. The ZeroCrss and AvgCross inputs are used to determine the basis for the entry signals. If both inputs are set to Y, a zero cross or a linear regression average cross will trigger a long/short entry. If one of the two inputs is set to N, then only the other criteria will be used to generate entry signals.



Type: System, Name: TRIX System S&C

Inputs: Price(Close), TrixLen(3), TSLen(8), ZeroCrss("Y"), AvgCrss("Y");
Vars: TRXval(0), AvgTRX(0), Zero(0);

TRXval = NewTRIX(Price, TRIXLen);
AvgTRX = LinearRegValue(TRXval, TSLen, 0);

IF UpperStr(ZeroCrss) = "Y" Then Begin
IF TRXval Crosses Above Zero Then
Buy ("B_ZCrss") This Bar on Close;
IF TRXval Crosses Below Zero Then
Sell ("S_ZCrss") This Bar on Close;
End;

IF UpperStr(AvgCrss) = "Y" Then Begin
IF TRXval Crosses Above AvgTRX Then
Buy ("B_AvgCrss") This Bar on Close;
IF TRXval Crosses Below AvgTRX Then
Sell ("S_AvgCrssS") This Bar on Close;
End;



 

 



Code:

Type: Function, Name: NewTRIX
Inputs: Price(NumericSeries), Length(NumericSimple);
Vars: LogP(0), alpha(0), sm1(0), sm2(0), sm3(0);

LogP = Log(Price);

IF CurrentBar = 1 Then Begin
sm1 = LogP;
sm2 = LogP;
sm3 = LogP;
alpha = 2 / (Length + 1);
End Else Begin
sm1 = (LogP - sm1) * alpha + sm1;
sm2 = (sm1 - sm2) * alpha + sm2;
sm3 = (sm2 - sm3) * alpha + sm3;
NewTrix = (sm3 - sm3[1]) * 100;
End;






Type: System, Name: TRIX System S&C

Inputs: Price(Close), TrixLen(3), TSLen(8), ZeroCrss("Y"), AvgCrss("Y");
Vars: TRXval(0), AvgTRX(0), Zero(0);

TRXval = NewTRIX(Price, TRIXLen);
AvgTRX = LinearRegValue(TRXval, TSLen, 0);

IF UpperStr(ZeroCrss) = "Y" Then Begin
IF TRXval Crosses Above Zero Then
Buy ("B_ZCrss") This Bar on Close;
IF TRXval Crosses Below Zero Then
Sell ("S_ZCrss") This Bar on Close;
End;

IF UpperStr(AvgCrss) = "Y" Then Begin
IF TRXval Crosses Above AvgTRX Then
Buy ("B_AvgCrss") This Bar on Close;
IF TRXval Crosses Below AvgTRX Then
Sell ("S_AvgCrssS") This Bar on Close;
End;


 





Source: http://www.traders.com

 

View similar:

Volume-Weighted Average
Stuckey 19
Williams 19
One Night Stand
TrueContrarian
His.Vol w/ Patterns
Cooper's System
Mov Avg X 2_20 System
Seasonal Trade
NLR Volatility
...
 
 
all systems for TradeStation
all systems

 

 

Email to friend

Top

 

     
However we try to maintain hiqhest possible level of service - most formulas, oscillators, indicators
and systems are submitted by anonymous users.
Therefore S4T™ does not take any responsibility for it's quality.
If you use any of this information, use it at your own risk. You are responsible for your own trading decisions.
Be sure to verify that any information you see on these pages is correct, and is applicable to your particular trade.
In no case will S4T™ be responsible for your trading gains or losses.
 
Privacy note | (c) copyrights systems4trading.com 2006-2012