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

[amibroker] Re: Simple TRIX Crossover system question



PureBytes Links

Trading Reference Links

Hi,

I have modified the TRIX code to use Close price instead of ROC(C).  
I also optimized it.  I don't plan to re-optimize from now on.  I 
plan to use this for verification of a continuation signal (pullback) 
generated from my primary trading system.  I also have a MACD(3,10,9) 
verification.  These two and also 3 or 4 OB/OS De-trended price 
oscillators including LinReg indicator should be sufficient to 
verifiy this continuation signal.  I would not use this as a primary 
trading system for pullbacks, only for verification.  In addition I 
use tight stops for pullbacks.  Thanks for the help.

rgds, Pal
--- In amibroker@xxxxxxxxxxxxxxx, "Gary A. Serkhoshian" 
<serkhoshian777@xxxx> wrote:
> 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("Period 1", 9, 3, 13, 1);
> 
> period2 = Optimize("Period 2", 50, 21, 62,1);
> 
> period3 = Optimize("Period 3",80,62,233,1);
> 
> //C = Foreign("COMPQX", "C");
> 
> //INDICATORS
> 
> Trixline1=TEMA(TEMA(TEMA(ROC(C, 1), period1), period1), period1);
> 
> Trixline2=TEMA(TEMA(TEMA(ROC(C, 1), period2), period2), period2);
> 
> Trixline3=TEMA(TEMA(TEMA(ROC(C, 1), period3), period3), period3);
> 
> //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(BuySTATE,SellSTATE);
> 
> Sell = NOT Buy;
> 
> Short = Flip(ShortSTATE,CoverSTATE);
> 
> Cover = NOT Short;
> 
> //EXREM
> 
> Buy = ExRem(Buy,Sell);
> 
> Sell = ExRem(Sell,Buy);
> 
> Short = ExRem(Short,Cover);
> 
> Cover = ExRem(Cover,Short);
> 
> //STOPS
> 
> ApplyStop( stopTypeProfit, stopModePercent, 30, ExitAtStop = True, 
Volatile = False, ReentryDelay = 0 );
> 
> ApplyStop( stopTypeTrailing, stopModePercent, 20, ExitAtStop = 
True, Volatile = False, ReentryDelay = 0 );
> 
> Equity(1); // THIS EVALUATES STOPS
> 
> //INDICATOR SECTION BEGINS
> 
> Plot(Trixline1, "TRIX", colorBlue, styleHistogram);
> 
> Plot(Trixline2, "TRIX", colorYellow, styleHistogram);
> 
> Plot(Trixline3, "TRIX", colorGreen, styleHistogram);
> 
> PlotShapes(shapeUpArrow * Buy,colorBrightGreen,0,TrixLINE1, -
10); //BUY ARROW
> 
> PlotShapes(shapeDownArrow * Short,colorRed,0,TrixLINE1, 
10); //SHORT ARROW
> 
> Title = Name() + ": " + Date() + " Open " + WriteVal(O,1.4) + " 
Hi " +WriteVal(H,1.4) + 
> 
> " Lo " + WriteVal(L,1.4) + " Close " + WriteVal(C,1.4);
> 
> //INTERPRETATION WINDOW ANALYSIS
> 
> "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";
> 
>  
> 
> 
> palsanand <palsanand@xxxx> wrote:
> 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 stops
> ApplyStop( stopTypeProfit, stopModePercent, 30, ExitAtStop = True, 
> Volatile = False, ReentryDelay = 0 );
> ApplyStop( stopTypeTrailing, stopModePercent, 20, ExitAtStop = 
True, 
> Volatile = False, ReentryDelay = 0 );
> Equity(1); // THIS EVALUATES STOPS
> Title = 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, Pal
> 
> 
> Yahoo! Groups SponsorADVERTISEMENT
> 
> Send BUG REPORTS to bugs@xxxx
> Send SUGGESTIONS to suggest@xxxx
> -----------------------------------------
> 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. 
> 
> 
> ---------------------------------
> Do you Yahoo!?
> Free Pop-Up Blocker - Get it now


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

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 http://docs.yahoo.com/info/terms/