PureBytes Links
Trading Reference Links
|
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 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/
|