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

[amibroker] CCI Trend Line Break - based on the code of many in this group



PureBytes Links

Trading Reference Links


Here is my 1st pass at a Trend Line Break system. Please pass on any
constructive suggestions to better this system. 

Settings that I have run this on are posted at
http://www.pvtnetworks.net/jkinsey/JKWeb/SystemSettings.html
To summerize - EOD data, Trades Next day Open, 4% Stop Loss, 12%
Profit Gain. Those are the Only SELL triggers, BUY  is a TLB.

I got about a 40% CAR running this against the S&P 2-15-02 till
2-25-05. I haven't really looked into all the stats yet, I did see a
large Draw Down, Ouch !! Too much for me <G>. Do not trade this
system. It is untested, you must test and modify it yourself..


/*  CCI Trend Line Break system - Jack Kinsey 3-6-05

  Original code by Bob Johnson and Gordon Sutherland May 2004 MSG# 79014.
  This code was modified to simply look at the CCI Resistance side
(LONGS).

  My apologies forgetting who wrote the CCI Plotting code, Thanks..

  The GREEN line Shows the EXTENSION of Trend from the Last 2 CCI PEAKS.
*/

WCCI = CCI(20);

/* CATEGORY 3 RESISTANCE BREAKOUT TRIGGER FOR LONGS: */
// HH_3_6 = Ref(WCCI,-6) < Ref(WCCI,-1);
// HH_3_5 = Ref(WCCI,-5) < Ref(WCCI,-1);
// HH_3_4 = Ref(WCCI,-4) < Ref(WCCI,-1);
HH_3_2 = Ref(WCCI,-2) < Ref(WCCI,-1);
HH_3_1 = Ref(WCCI,-1) < Ref(WCCI,-1);
HH_3_0 = WCCI < Ref(WCCI,-1);
Cat3Res = HH_3_2 AND HH_3_0;

y2=ValueWhen(Cat3Res,Ref(WCCI,-1),2);
y3=ValueWhen(Cat3Res,Ref(WCCI,-1),1);
x2=ValueWhen(Cat3Res,BarIndex(),2)-1;
x3=ValueWhen(Cat3Res,BarIndex(),1)-1;

// another look into the future.
xrf=ValueWhen(Cat3Res,BarIndex(),0)-1;

mr = (y3 - y2)/(x3 - x2);  // simple slope of resistance
extr=BarsSince(Cat3Res);
resline=y3 + mr * ( 1 + extr);
Plot(resline,"Cat3Res",colorGreen,styleLine);

// Long term CCI;
PeriodTrend = Param("PeriodTrend", 5, 2, 10, 1);
// B & D arrays for when CCI crossed Zero line
B=Cross(WCCI,0); 	
D=Cross(0,WCCI);
//	Set Color & PLOT CCI Histogram
COL=IIf(BarsSince(B)>PeriodTrend AND
WCCI>0,colorBrightGreen,IIf(BarsSince(D)>PeriodTrend 
AND WCCI<0,colorRed,colorLightGrey)) ;
Plot(WCCI," ",COL,styleHistogram+styleThick);
Plot(WCCI,"",colorLightGrey ,styleLine);

// Plot range lines
Plot(200,"",colorRed);
Plot(-200,"",colorRed);
Plot(100,"",colorGreen);
Plot(-100,"",colorGreen);
Plot(50, "", colorLightGrey);
Plot(-50, "", colorLightGrey);
Plot(0,"", colorBlack ,styleLine);

//	Calculate if Positive, Negative or Trendless. (Same as Color Calc)..
Ptrend = IIf(BarsSince(B)>PeriodTrend AND WCCI>0, 1, 0);
Ntrend = IIf(BarsSince(D)>PeriodTrend AND WCCI<0, 1, 0);
Trendless = IIf(Ptrend == 0 AND Ntrend == 0, 1, 0);

//	Display data points as Title, also shows in Guru
AvgP = (O + H +L + C ) /4;
Title = Name () + " " + FullName() + " "
 + "   CCI - " + WCCI + "  ResLine - " + Resline +
"\nAvg-" + AvgP + ",  O-" + O + ",  H-" + H + ",  L-" + L + ",  C-" +
C +    // for Referance only
"\nx2 - " + x2 + "   y2 - " + y2 + "   x3  -" + x3 + "   y3 - " + y3 +
EncodeColor(colorWhite) + "       " + Date() ;

Buy=Cross(WCCI, ResLine) ;

/*PlotShapes(IIf(Sell,shapeHollowDownArrow,shapeNone),colorRed,0,H,-10); 
PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorGreen,0,L,-10); */

// EXPLORATION AND SYSTEM TEST REPORTS AREA
//////////////////////////////////////////////////

 Sell = 0; Cover = 0;
Filter = Buy OR Sell;
AddTextColumn(FullName(),"Full name",77,colorPlum, IIf(Close <
1.00,colorYellow,colorDefault ) );
Result = WriteIf(Buy,"Buy","Sell");
AddTextColumn(Result,"Trade", formatChar,
IIf(Buy,colorDarkGreen,colorRed ), IIf                               
                                                                     
                                                                     
  (Sell,colorPink,colorLime));
AddColumn(Ref(Close,-1),"Y-Close",1.4, IIf( ROC(Ref(C,-1),1)>=
0,colorDarkGreen, colorRed ),50 );
AddColumn(Open,"Open",1.4,IIf( ROC(Open, 1 ) >= 0, colorDarkGreen,
colorRed ) );
AddColumn(High,"High",1.4,IIf( ROC(High, 1 ) >= 0, colorDarkGreen,
colorRed ) );
AddColumn(Low,"Low",1.4,IIf( ROC(Low, 1 ) >= 0, colorDarkGreen,
colorRed ) );
AddColumn( Close, "Close", 1.4, IIf( ROC(C, 1 ) >= 0, colorDarkGreen,
colorRed ),50 );
AddColumn( ROC( Close, 1 ), "ROC(1)", 1.2, IIf( ROC(C, 1 ) >= 0,
colorDarkGreen, colorRed));
AddColumn( Volume, "Volume", 10.0, IIf( ROC(V, 1 ) >= 0,
colorDarkGreen, colorRed ) );
AddColumn( resline, "Break L", 10.4, colorDarkBlue,37 );
AddColumn( ((Close-resline)/resline)*100, "L %", 10.2, colorDarkBlue,37 );






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Has someone you know been affected by illness or disease?
Network for Good is THE place to support health awareness efforts!
http://us.click.yahoo.com/Rcy2bD/UOnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/