[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [amibroker] Simple TRIX Crossover system question



PureBytes Links

Trading Reference Links




<FONT face=Arial color=#0000ff 
size=2>Gary,
Plot 
trixline3. On DIS I get a value of 0.0752 as of Fridays close. The closing value 
of DIS is 22.58....So buystate and sell state will always be true if the values 
in front of your "AND" statement are true. Short and cover will ALWAYS be false 
unless you are trading penny stocks. Unless I am missing something...Why would 
you want to compare the value of Close to a triple smoothed Rate of change 
value?....
<FONT face=Arial color=#0000ff 
size=2> 
<FONT 
color=#282828>BuySTATE = TrixLINE1 > TrixLINE2 <FONT 
color=#000000>AND 
C<FONT 
color=#282828> > TrixLINE3; SellSTATE = TrixLINE1 < TrixLINE2 
AND <FONT 
color=#000000>C<FONT 
color=#282828> > TrixLINE3; ShortSTATE = TrixLINE1 < TrixLINE2 
AND <FONT 
color=#000000>C<FONT 
color=#282828> < TrixLINE3; CoverSTATE = TrixLINE1 > TrixLINE2 
AND <FONT 
color=#000000>C<FONT 
face="Courier New"> < TrixLINE3; 
 
Regards, 
Jayson 
<FONT face=Tahoma 
size=2>-----Original Message-----From: Gary A. Serkhoshian 
[mailto:serkhoshian777@xxxxxxxxx]Sent: Monday, November 24, 2003 1:47 
AMTo: amibroker@xxxxxxxxxxxxxxxSubject: Re: [amibroker] 
Simple TRIX Crossover system question
Pal,
 
Here's the code to do what you've asked.  Regarding a diversified 
group of futures markets, you'll have to optimize on the markets you want to 
trade.  I've built in the ability to optimize the params.
 
You could via positionscore trade  basket of futures via some scoring 
routine in addition to their respective buy/sell signals.
 
The big problem is you may want to look at the Trixline values.  They 
are all smaller than 1 which means that shorts are impossible with the criteria 
you've listed below.
 
Take a look at get back to us.  It seems like a promising idea, and 
I'll be happy to adjust the code based on what you find.
 
Warmest,
Gary
 
CODE BELOW:
 

//PARAMS
period1 = Optimize<FONT 
size=2>("Period 1", 
9, <FONT 
color=#ff00ff size=2>3, <FONT color=#ff00ff 
size=2>13, 1<FONT 
size=2>);
period2 = Optimize<FONT 
size=2>("Period 2", 
50, <FONT 
color=#ff00ff size=2>21, <FONT color=#ff00ff 
size=2>62,1<FONT 
size=2>);
period3 = Optimize<FONT 
size=2>("Period 3"<FONT 
size=2>,80,<FONT 
color=#ff00ff size=2>62,<FONT color=#ff00ff 
size=2>233,1<FONT 
size=2>);
//C = Foreign("COMPQX", "C");<FONT 
color=#008000 size=2>
//INDICATORS
Trixline1=TEMA<FONT 
size=2>(TEMA(<FONT 
color=#0000ff size=2>TEMA(<FONT color=#0000ff 
size=2>ROC(C, <FONT color=#ff00ff 
size=2>1), period1), period1), period1);
Trixline2=TEMA<FONT 
size=2>(TEMA(<FONT 
color=#0000ff size=2>TEMA(<FONT color=#0000ff 
size=2>ROC(C, <FONT color=#ff00ff 
size=2>1), period2), period2), period2);
Trixline3=TEMA<FONT 
size=2>(TEMA(<FONT 
color=#0000ff size=2>TEMA(<FONT color=#0000ff 
size=2>ROC(C, <FONT color=#ff00ff 
size=2>1), period3), period3), period3);<FONT 
color=#008000 size=2>
//ESTABLISH STATES
BuySTATE = TrixLINE1 > TrixLINE2 AND C > TrixLINE3;
SellSTATE = TrixLINE1 < TrixLINE2 AND C > TrixLINE3; 
ShortSTATE = TrixLINE1 < TrixLINE2 AND C < TrixLINE3;
CoverSTATE = TrixLINE1 > TrixLINE2 AND C < 
TrixLINE3;
//ESTABLISH SIGNALS
Buy = Flip<FONT 
size=2>(BuySTATE,SellSTATE);
Sell = NOT Buy;
Short = Flip<FONT 
size=2>(ShortSTATE,CoverSTATE);
Cover = NOT Short;
//EXREM
Buy = ExRem<FONT 
size=2>(Buy,Sell);
Sell = ExRem<FONT 
size=2>(Sell,Buy);
Short = ExRem<FONT 
size=2>(Short,Cover);
Cover = ExRem<FONT 
size=2>(Cover,Short);
//STOPS
ApplyStop( stopTypeProfit, stopModePercent, 
30, ExitAtStop = 
True, Volatile = False, ReentryDelay = <FONT color=#ff00ff 
size=2>0 );
ApplyStop( stopTypeTrailing, 
stopModePercent, 20<FONT 
size=2>, ExitAtStop = True, Volatile = False, ReentryDelay = 
0 );<FONT 
color=#0000ff size=2>
Equity(1<FONT 
size=2>); // THIS EVALUATES 
STOPS
//INDICATOR SECTION BEGINS
Plot(Trixline1, <FONT color=#ff00ff 
size=2>"TRIX", colorBlue, 
styleHistogram);
Plot(Trixline2, <FONT color=#ff00ff 
size=2>"TRIX", colorYellow, 
styleHistogram);
Plot(Trixline3, <FONT color=#ff00ff 
size=2>"TRIX", colorGreen, 
styleHistogram);
PlotShapes(shapeUpArrow * 
Buy,colorBrightGreen,<FONT color=#ff00ff 
size=2>0,TrixLINE1, -<FONT color=#ff00ff 
size=2>10); //BUY 
ARROW
PlotShapes(shapeDownArrow * 
Short,colorRed,0<FONT 
size=2>,TrixLINE1, 10); 
//SHORT ARROW
Title = Name() + 
": " + <FONT 
color=#0000ff size=2>Date() + <FONT color=#ff00ff 
size=2>" Open " + <FONT color=#0000ff 
size=2>WriteVal(O,<FONT color=#ff00ff 
size=2>1.4) + " Hi 
" +WriteVal<FONT 
size=2>(H,1.4) + 

" Lo "<FONT 
face=Arial size=2> +<FONT 
face=Arial size=2> <FONT color=#0000ff 
size=2>WriteVal(L,<FONT color=#ff00ff 
size=2>1.4) + " Close 
" + WriteVal<FONT 
size=2>(C,1.4<FONT 
size=2>);
//INTERPRETATION WINDOW ANALYSIS
"The bmTRIX is indicating a " + <FONT 
color=#0000ff size=2>WriteIf(Trixline1 > Trixline2 
AND C > TrixLine3, <FONT color=#ff00ff 
size=2>"bullish", <FONT color=#ff00ff 
size=2>"bearish") +
" market environment because it is " + <FONT 
color=#0000ff size=2>WriteIf(TrixLine1 > Trixline2 
AND C < TrixLine3, <FONT color=#ff00ff 
size=2>"above", <FONT color=#ff00ff 
size=2>"below") +
" the zero line.\n";
 
palsanand <palsanand@xxxxxxxxx> wrote:
<BLOCKQUOTE class=replbq 
>1. 
  Start with a simple moving average crossover (nine-day and 50-day) 2. 
  Refinement 1: Add a third moving average (80-day) as a 
  filter.Apply the indicator using the following rules: 1. Go 
  long when 9d > 50d and close > 80d 2. Go flat when 9d < 50d and 
  close > 80d 3. Go short when 9d < 50d and close < 80d 4. Go 
  flat when 9d > 50d and close < 80d 5. Refinement 2: Trade a 
  diversified group of futures markets.How do I modify the code below to 
  adhere to the rules above and how do I get sell signal arrows on the 
  graph?period1 = 9;period2 = 50;period3 = 80;//C = 
  Foreign("COMPQX", "C");Trixline1=TEMA(TEMA(TEMA(ROC(C, 1), period1), 
  period1), period1);Plot(Trixline1, "TRIX", colorBlue, 
  styleHistogram);Trixline2=TEMA(TEMA(TEMA(ROC(C, 1), period2), period2), 
  period2);Plot(Trixline2, "TRIX", colorYellow, 
  styleHistogram);Trixline3=TEMA(TEMA(TEMA(ROC(C, 1), period3), period3), 
  period3);Plot(Trixline3, "TRIX", colorGreen, styleHistogram);Cond1 = C 
  > TrixLine3;Cond2 = C < TrixLine3;"The bmTRIX is indicating a " 
  +WriteIf(Trixline1 > Trixline2 AND C > TrixLine3, "bullish", 
  "bearish") +" market environment because it is " +WriteIf(TrixLine1 
  > Trixline2 AND C < TrixLine3, "above", "below") +" the zero 
  line.\n";Buy = Cover = Cross( TrixLine1,TrixLine2 ) AND (C > 
  TrixLine3);Sell = Short = Cross( TrixLine2,TrixLine1 ) AND (C < 
  TrixLine3);shape = Buy * shapeUpArrow + Sell * 
  shapeDownArrow;PlotShapes(IIf(Buy,shapeUpArrow,shapeNone) 
  ,colorBrightGreen,0,Graph1,-15); 
  PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,Graph1,-15); 
  //PlotShapes(IIf(Buy,shapeUpArrow,shapeNone) 
  ,colorBrightGreen);//PlotShapes(IIf 
  (Sell,shapeDownArrow,shapeNone),colorRed);GraphXSpace=10; //Sell = 
  0 ; // exit only by stopsApplyStop( stopTypeProfit, stopModePercent, 30, 
  ExitAtStop = True, Volatile = False, ReentryDelay = 0 );ApplyStop( 
  stopTypeTrailing, stopModePercent, 20, ExitAtStop = True, Volatile = 
  False, ReentryDelay = 0 );Equity(1); // THIS EVALUATES STOPSTitle = 
  Name() + ": " + Date() + " Open " + WriteVal(O,1.4) + " Hi " 
  +WriteVal(H,1.4) + " Lo "+WriteVal(L,1.4) + "  Close " + 
  WriteVal(C,1.4);//Plot(Sell==4,"ApplyStop 
  Sell",colorRed,1|styleOwnScale);//Plot(Cover==4,"ApplyStop 
  Cover",colorGreen,1|styleOwnScale); rgds, 
  PalSend BUG REPORTS to bugs@xxxxxxxxxxxxxSend 
  SUGGESTIONS to 
  suggest@xxxxxxxxxxxxx-----------------------------------------Post 
  AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
  group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  Your use of Yahoo! Groups is subject to the <A 
  href="">Yahoo! Terms of Service. 



Do you Yahoo!?<A 
href="">Free 
Pop-Up Blocker - Get it now Send 
BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
suggest@xxxxxxxxxxxxx-----------------------------------------Post 
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A 
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
group FAQ at: <A 
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Your use of Yahoo! Groups is subject to the <A 
href="">Yahoo! Terms of Service. 







Yahoo! Groups Sponsor












Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.