TS TRIX System S&C
Trading System "TRIX System S&C"
Sistema ricavato dall'articolo "Playing TRIX" discusso nel numero di giugno 1997 nella rivista STOCKS & COMMODITIES.
Formula per Tradestation™:
INIZIO FORMULA
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;
FINE FORMULA