Trix indicator - Heeft iemand deze indicator in Vestics?

Moderator: Perry

Trix indicator - Heeft iemand deze indicator in Vestics?

Berichtdoor kharmsen » zo 01 sep 2002, 19:58

Ik wil in Vestics aan de slag met de Trix indicator, maar deze is nog niet in de software aanwezig. Heeft iemand deze indicator al zelf geprogrammeerd?
Zou je mij de code dan willen mailen, dat scheelt mij een hoop werk!
kharmsen
 
Berichten: 1
Geregistreerd op: zo 01 sep 2002, 19:53
Woonplaats: De Meern

Trix indicator

Berichtdoor FM » zo 01 sep 2002, 20:33

Dit is een kopie van een artikel uit Stocks & Commodities. Het beschijft verschillende TRIX versies gemaakt voor Tradestation (EasyLanguage).

Meer (bruikbare) voorbeelden van indicators zijn te vinden middels de search functie op www.traders.com (sectie Traders Tips). Let op. Controleer eerst de functie op de correcte code in Vestics. Kleine aanpassingen zullen soms nodig zijn.

Succes,

Frans Manders.

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;
?

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;
FM
 
Berichten: 113
Geregistreerd op: do 15 aug 2002, 12:58

Trix indicator

Berichtdoor FM » zo 01 sep 2002, 20:48

Ik zie dat mijn Copy Paste actie vrolijk lachende gezichtjes heeft opgeleverd. Ieder gezichtje veranderen in een ) en het probleem is opgelost.

met groet,

Frans Manders.
FM
 
Berichten: 113
Geregistreerd op: do 15 aug 2002, 12:58


Keer terug naar Suggesties en vragen

Wie is er online

Gebruikers op dit forum: Geen geregistreerde gebruikers en 18 gasten

cron