Page 1 of 1

NEW SLOT MACHINE INDICATOR - _SMAA_TRIX_2Line

Posted: Wed Jul 19, 2006 11:24 am
by TheRumpledOne



Someone on my yahoo board asked for this.

ELD attached.

Code: Select all

{ _SMAA_TRIX_2Line  }
   

{Attn: TradeStation
if this indicator is posted on the TradeStation Forum, I, TheRumpledOne, did NOT post it there,
so I can't be blamed for this indicator having my contact info.}


{MODIFYING Programmer:  Avery T. Horton, Jr.  aka TheRumpledOne,
gifts and donations accepted, PO Box 43575, Tucson, AZ 85733 }

{ © Copyright 2006 Avery T. Horton, Jr.}

{ 2-Line TRIX indicator for Jongseon Kim's TAOSC article
"When and When Not To Trade", TAOSC - Jan. 2004 }

inputs:
   TRIXLength( 5 ),
   SigLineXMALen( 3 ) ;
   
Inputs:
 
iMsgLong("LONG"),

iMsgShort("SHORT"),

iMsgFlat("FLAT"),


iMsgXAbove("XA"),

iMsgXBelow("XB"),

iDecimals(2);
 
 
variables:
   EMA1( 0 ),
   EMA2( 0 ),
   EMA3( 0 ),
   TRIXLine( 0 ),
   SignalLine( 0 ) ;

variables:
 
xPeriods(60),
xInterval(0),

sFirstPass(true),
 
xBars(0),

xInd(0),
tMsg(""),
tAlert("");

variables:
 
FG1(white),
BG1(black),

fg2(white),
bg2(black),

fg3(white),
bg3(black),

fg4(white),
bg4(black);
   



{commentary variables}
variables:
xcomm(0),
oComm1( "" ),    
oComm2( "" ),    
oComm3( "" ),    
oComm4( "" ),    
oComm5( "" ),
oComm6( "" ),
oComm7( "" ),
oComm8( "" ),
oComm9( "" ),    
oComm10( "" );
   

variables:

xDate(0),
xTime(0),         
xOpen(0),   
xClose(0),
xHigh(0),
xLow(0);

   

{first time through}

if sFirstPass
then begin
   
sFirstPass = false;

{bar test}

If bartype = 4
   then xInterval = 94
else
If bartype = 3
   then xInterval = 93
else
If bartype = 2
   then xInterval = 92
else
If bartype = 1
then begin
   xInterval = BarInterval;
end; { If bartype = 1  }

end; {if sFirstPass}


{ INITIALIZE }

FG1 = WHITE;
BG1 = BLACK;

fg2 = WHITE;
bg2 = BLACK;

fg3 = WHITE;
bg3 = BLACK;

fg4 = WHITE;
bg4 = BLACK;

tMsg   = "";
tAlert  = "";

xDate   = Date ;

xTime   = Time ;

xOpen    =  Open;

xClose   =  Close;

xHigh    =  High;

xLow    =  Low;

{ PROCESSING }
 


EMA1 = XAverage( Close, TRIXLength ) ;
EMA2 = XAverage( EMA1, TRIXLength ) ;
EMA3 = XAverage( EMA2, TRIXLength ) ;

if EMA3[1] <> 0
   then TRIXLine = 10 * ( EMA3 - EMA3[1] ) / EMA3[1] ;

SignalLine = XAverage( TRIXLine, SigLineXMALen ) ;


{ Alert criteria }



If TRIXLine CROSSES ABOVE SignalLine
then begin
   xBars = 1;
   Fg3 = BLACK;
   Bg3 = yellow;
   tMsg = iMsgXAbove ;
end
else
If TRIXLine CROSSES below SignalLine
then begin
   xBars = 1;
   Fg3 = red;
   Bg3 = yellow;
   tMsg = iMsgXBelow ;
end
else
If TRIXLine > SignalLine
then begin
   xBars = xBars + 1;
   Fg3 = BLACK;
   Bg3 = green;
   tMsg = iMsgLong ;
end
else
If TRIXLine < SignalLine
then begin
   xBars = xBars + 1;
   Fg3 = BLACK;
   Bg3 = red;
   tMsg = iMsgShort ;
end
else  begin
   xBars = xBars + 1;
   Fg3 = white;
   Bg3 = BLACK;
   tMsg = iMsgFlat;
end;


tAlert = tMsg ;




If TRIXLine CROSSES ABOVE 0
then begin
   Fg1 = BLACK;
   Bg1 = yellow;
end
else
If TRIXLine CROSSES below 0
then begin
   Fg1 = red;
   Bg1 = yellow;
end
else
If TRIXLine > 0
then begin
   Fg1 = BLACK;
   Bg1 = green;
end
else
If TRIXLine < 0
then begin
   Fg1 = BLACK;
   Bg1 = red;
end
else  begin
   Fg1 = white;
   Bg1 = BLACK;
end;



If SignalLine CROSSES ABOVE 0
then begin
   Fg2 = BLACK;
   Bg2 = yellow;
end
else
If SignalLine CROSSES below 0
then begin
   Fg2 = red;
   Bg2 = yellow;
end
else
If SignalLine > 0
then begin
   Fg2 = BLACK;
   Bg2 = green;
end
else
If SignalLine < 0
then begin
   Fg2 = BLACK;
   Bg2 = red;
end
else  begin
   Fg2 = white;
   Bg2 = BLACK;
end;
                



{ Alert }

if tAlert <> ""
and tAlert <> tAlert[1]
   then Alert( tAlert ) ;


{ PLOT }

Plot1( TRIXLine, "TRIXLine", fg1 ) ;
SetPlotBGColor( 1, bg1);


Plot2( SignalLine, "SignalLine" , fg2 ) ;
SetPlotBGColor( 2, bg2);


Plot3( tMsg , "Msg", fg3 ) ;
SetPlotBGColor( 3, bg3 );

Plot4( xBars , "Trend", fg3 ) ;
SetPlotBGColor( 4, bg3 );
 



xComm = _fCommentary(oComm1, oComm2, oComm3, oComm4, oComm5, oComm6, oComm7, oComm8, oComm9, oComm10);

CommentaryCl(oComm1 );

CommentaryCl(oComm2 );
CommentaryCl(oComm3 );
CommentaryCl(oComm4 );
CommentaryCl(oComm5 );
CommentaryCl(oComm6 );
CommentaryCl(oComm7 );
CommentaryCl(oComm8 );
CommentaryCl(oComm9 );
CommentaryCl(oComm10 );

 {
CommentaryCl( "Open_AvgCost: ", NumToStr( Open_AvgCost , iDecimals) );


CommentaryCl( "xInd: ", NumToStr( xInd , iDecimals) );
 

CommentaryCl( "xFreeShares: ", NumToStr( xFreeShares , 0 ) );

}

TRIX2LINE

Posted: Fri Jul 21, 2006 9:32 pm
by sharpshooter
TRO, YOU THE MAN !!!!!!!!!!!!!!!! CAN'T WAIT TO TEST DRIVE.

THANKS AGAIN.
SHARPSHOOTER

trix 2 line

Posted: Tue Jul 25, 2006 5:10 pm
by ph7
hello everyone,
I found this trix 2 line very helpful. thanks TRO. I have a newb question. is it possible to do something similar to the Williams % R indicator? what I mean is to smooth it out like that. maybe it's already been done but I can't find any reference to it. any help will be greatly appreciated. btw, great forum! good trading...

Posted: Wed Jul 26, 2006 12:35 am
by TheRumpledOne
Yes, you could use the code and put the Williams %R in there.

Posted: Thu Jul 27, 2006 4:08 am
by ph7
tried this and it looks good so far. thanks Mr. TRO. another request...does anyone know where I can find a tick countdown in eld format? don't know if that is even possible. i'm not using tradestation but can import eld files. thanks again.

Posted: Tue Oct 03, 2006 9:32 pm
by forest
This is one of my favorite indicators. Was glad to find you have incorporated it into the SlotMachine.

Thanks,
Forest

Posted: Thu Oct 05, 2006 11:48 am
by Ali Son
How does one use this thing? Looking at the above picture, doesn't seem to be doing anything? Is it better on other timeframes? What timeframes do people use it on it? How are you using it...anybody???

Posted: Thu Oct 05, 2006 8:44 pm
by forest
Ali Son wrote:How does one use this thing? Looking at the above picture, doesn't seem to be doing anything? Is it better on other timeframes? What timeframes do people use it on it? How are you using it...anybody???


Trix is a triple smoothed exponential moving average "TRIX". When you have a signal included with it, you look for trade opportunities when they cross.

It is good for eliminating whipsaws and doesn't have too much lag.