PureBytes Links
Trading Reference Links
|
Added a visual Trend Line for Selected BAR on graph to help visualize
the current Trend Line source peaks and extension. The could be used
for any indicator.
/* CCI Trend Line Break system - Jack Kinsey 3-8-05
Added visual Trend LIne (YELLOW) for Selected BAR on Graph ..
This TLB could work for any Indicator - Just replace CCI(20);
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); // You Could replace CCI(20) with any indicator
/* 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;
x22 = SelectedValue(x2) ;
y22 = SelectedValue(y2);
x33 = SelectedValue(x3);
y33 = SelectedValue(y3);
Line = LineArray( x22, y22, x33, y33, 1, 1);
Plot( Line, "Trend line", colorYellow, styleLine);
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 --------------------~-->
What would our lives be like without music, dance, and theater?
Donate or volunteer in the arts today at Network for Good!
http://us.click.yahoo.com/Tcy2bD/SOnJAA/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/
|