log in     sign up for free
 
When I became a winner I went from 'I figured it out, therefore it can't be wrong' to 'I figured it out, but if I'm wrong, I'm getting the hell out, because I want to save my money and go on to the next trade.'
Marty Schwartz
 
 
Home
systems (284)
 
Special offer: buy AmiBroker and EOD+Real-Time Data
 
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 Indicator S&C

Formula for: TradeStation

indicator


 

 

Views:  2113

Added: August 13, 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, indicator
 
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;




The TRIX indicator will plot a total of three lines: the TRIX value, the linear regression average of TRIX, and a zero line. The ZeroCrss (zero cross) and AvgCrss (linear regression cross) inputs determine the basis of the alerts (if alerts are enabled). If both are set to Y, then either occurrence will trigger an alert. If N is used as the input value for either, then an alert won't be triggered for that event. The indicator should be scaled to "screen."



Type: Indicator , Name: TRIX Indicator S&C

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

Condition1 = False;
Condition2 = False;
TRXval = NewTRIX(Price, TRIXLen);
AvgTRX = LinearRegValue(TRXval, TSLen, 0);
Plot1(TRXval, "TRIX");
Plot2(AvgTRX, "TRIX_LR");
Plot3(0, "Zero");
IF UpperStr(ZeroCrss) = "Y" Then Begin
IF Plot1 Crosses Above Plot3 OR Plot1 Crosses Below Plot3 Then
Condition1 = True;
End;

IF UpperStr(AvgCrss) = "Y" Then Begin
IF Plot1 Crosses Above Plot2 OR Plot1 Crosses Below Plot2 Then
Condition2 = True;
End;

IF CheckAlert AND (Condition1 OR Condition2) Then
Alert = True;

 

 



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: Indicator , Name: TRIX Indicator S&C

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

Condition1 = False;
Condition2 = False;
TRXval = NewTRIX(Price, TRIXLen);
AvgTRX = LinearRegValue(TRXval, TSLen, 0);
Plot1(TRXval, "TRIX");
Plot2(AvgTRX, "TRIX_LR");
Plot3(0, "Zero");
IF UpperStr(ZeroCrss) = "Y" Then Begin
IF Plot1 Crosses Above Plot3 OR Plot1 Crosses Below Plot3 Then
Condition1 = True;
End;

IF UpperStr(AvgCrss) = "Y" Then Begin
IF Plot1 Crosses Above Plot2 OR Plot1 Crosses Below Plot2 Then
Condition2 = True;
End;

IF CheckAlert AND (Condition1 OR Condition2) Then
Alert = True;


 





Source: http://www.traders.com

 

View similar (indicator for TradeStation):

Moving Averages with Resistance and Support
LMS Predictor
Buy/Sell Pressure
Double Smoothed Exponential Moving Average
Trades After the Fact
VIDYA
Pivot Point Average
MACD (DEMA)
Pretty Weird Late Night Stuff
$%B I
...
 
 
all formulas for TradeStation
all formulas

 

 

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