Afl Woodie Cci

20
_SECTION_BEGIN("cci wodie 3"); /////////////////////////////// // CCI Panel for Amibroker // Codded/Added by Dennis, Kris, Wring, Santacs, Yofa (jtoth100) // Last Update: 10/19/2008 /////////////////////////////// // Go to www.woodiescciclub.com to learn everything about this system. // You must be a registered user to see the images and downloads. /////////////////////////////// // Setup Axes and Grid section (right click on chart panel, click on Parameters): // Scaling: Custom , Min=-250 Max=250 // Show Date Axis = Yes , Show Middle Lines = No /////////////////////////////// // To activate the timer properly, make sure the following is set: // click on Tools==>Preferences==>Intraday.... // make sure "Allign minute bars to market hours" is checked... // make sure "Start time of interval" is checked... // make sure "Override: Weekly/monthly bars use day of last trade" is checked. /////////////////////////////// // Tic/PIP values: YM=1.0, ER2=0.10, NQ=0.25, EUR/USD=.0001, USD/JPY=0.01, Stocks=0.01 /////////////////////////////// // Rangebar Settings : // ER2 1.50 // YM 25 // ES 3 // NQ 3.75 // DAX 5 // ZG 1.5 /////////////////////////////// // Discalimer: For educational purposes only. Trade at your own risk. /////////////////////////////// // ************************************************************************************** ****** // Static variable functions used in charts // ************************************************************************************** ****** function StaticName( VarName ) { return Name() + VarName; } procedure StaticSet( VarName, VarValue ) { StaticVarSet(Name() + VarName, VarValue); } function StaticGet( VarName ) {

description

Linkon AFL

Transcript of Afl Woodie Cci

Page 1: Afl Woodie Cci

_SECTION_BEGIN("cci wodie 3"); /////////////////////////////// // CCI Panel for Amibroker // Codded/Added by Dennis, Kris, Wring, Santacs, Yofa (jtoth100) // Last Update: 10/19/2008/////////////////////////////// // Go to www.woodiescciclub.com to learn everything about this system.// You must be a registered user to see the images and downloads./////////////////////////////// // Setup Axes and Grid section (right click on chart panel, click on Parameters):// Scaling: Custom , Min=-250 Max=250// Show Date Axis = Yes , Show Middle Lines = No/////////////////////////////// // To activate the timer properly, make sure the following is set: // click on Tools==>Preferences==>Intraday....// make sure "Allign minute bars to market hours" is checked...// make sure "Start time of interval" is checked...// make sure "Override: Weekly/monthly bars use day of last trade" is checked./////////////////////////////// // Tic/PIP values: YM=1.0, ER2=0.10, NQ=0.25, EUR/USD=.0001, USD/JPY=0.01, Stocks=0.01///////////////////////////////// Rangebar Settings :// ER2 1.50 // YM 25 // ES 3 // NQ 3.75 // DAX 5 // ZG 1.5 /////////////////////////////// // Discalimer: For educational purposes only. Trade at your own risk.///////////////////////////////

// ********************************************************************************************// Static variable functions used in charts// ********************************************************************************************

function StaticName( VarName ){ return Name() + VarName;}

procedure StaticSet( VarName, VarValue ){ StaticVarSet(Name() + VarName, VarValue);} function StaticGet( VarName ){ return Nz(StaticVarGet(Name() + VarName));} procedure StaticSetText( VarName, VarValue ){ StaticVarSetText(Name() + VarName, VarValue);} function StaticGetText( VarName ){ return StaticVarGetText(Name() + VarName);

Page 2: Afl Woodie Cci

}

// ********************************************************************************************// Basic panel setup// ********************************************************************************************

//Disable printing to commentary windowEnableTextOutput(False);

//Version info of the panelRevision = "$Revision: 39 $";

SetChartOptions(0, chartShowDates);SetChartOptions(3, chartLogarithmic, chartGridMiddle | chartGridPercent |chartGridMargins);

//Anything to print at the end of the tooltip for debugging purposesToolTipDebug = "";

// Bar indexes for titles and commentaryLastBarIndex = BarCount-1;CurBarIndex = SelectedValue(BarIndex());if (CurBarIndex > LastBarIndex) //on tick charts SelectedValue(BarIndex()) may point beyond last bar CurBarIndex = LastBarIndex;

// ********************************************************************************************// Low level graphics setup// ********************************************************************************************if (Status("action") == 1) //indicator{ MinY = Status("axisminy"); MaxY = Status("axismaxy"); TotalY = MaxY - MinY;

LastVisibleIndex = Status("lastvisiblebarindex"); FirstVisibleIndex = Status("firstvisiblebarindex"); TotalVisibleBars = LastVisibleIndex - FirstVisibleIndex; PixelWidth = Status("pxwidth"); PixelHeight = Status("pxheight"); ScaleY = PixelHeight / TotalY;}else{ MinY = -300; MaxY = 300; TotalY = MaxY - MinY;

LastVisibleIndex = BarCount -1; FirstVisibleIndex = 0; TotalVisibleBars = LastVisibleIndex - FirstVisibleIndex; PixelWidth = 1; PixelHeight = 1;

Page 3: Afl Woodie Cci

ScaleY = PixelHeight / TotalY;}

FontNameSmall = "Ariel";FontSizeSmall = 8;FontWeightSmall = 300;

FontNameNormal = "MS Sans Serif";FontSizeNormal = 8;FontWeightNormal = 300;

FontNameBig = "MS Sans Serif";FontSizeBig = 10;FontWeightBig=700;

GfxSetOverlayMode(0); //low level graph over chart...GfxSetBkMode(1); //transparentGfxSelectPen( StaticGet("ChartBkColor"), 1, 0); //to clear value areaGfxSelectSolidBrush( StaticGet("ChartBkColor") );GfxSetTextColor( StaticGet("ChartTextColor") );

GfxSetTextAlign(10); //right, buttomGfxSelectFont(FontNameSmall, FontSizeSmall, FontWeightSmall, True, False, 0);GfxTextOut("by Yofa", PixelWidth-2, PixelHeight-12 );GfxTextOut(Revision, PixelWidth-2, PixelHeight );

GfxSetTextAlign(26); //right, baselineGfxSelectFont(FontNameNormal, FontSizeNormal, FontWeightNormal, False, False,0);

function GfxMapYtoPixelY(Y){ return ( TotalY / 2 - Y ) * ScaleY;}

_SECTION_END(); //Woodie CCI - Indicators

// Timer

TTMperiod = 6; Low_ma = EMA(L, TTMperiod); High_ma = EMA(H, TTMperiod); Low_third = (High_ma - Low_ma) / 3 + Low_ma; High_third = 2 * (High_ma - Low_ma) / 3 + Low_ma; tempnum = Now( 4 ) - TimeNum(); TimeRem = Interval() - ((int(tempnum[BarCount - 1] / 100) * 60) +(tempnum[BarCount - 1] - int(tempnum[BarCount - 1] / 100) * 100)); if (TimeRem[BarCount - 1] < 0) TimeRem = 0; MinuteVar = int(TimeRem / 60); SecondsVar = int(frac(TimeRem / 60) * 60); if (TimeRem[BarCount - 1] > 60) { TitleTimeRem = EncodeColor(colorWhite) + MinuteVar + ":" + WriteIf(SecondsVar >9, "", "0") + SecondsVar; } else if (TimeRem[BarCount - 1] > 20) { TitleTimeRem = EncodeColor(colorYellow) + MinuteVar + ":" + WriteIf(SecondsVar> 9, "", "0") + SecondsVar; } else {

Page 4: Afl Woodie Cci

TitleTimeRem = EncodeColor(colorRed) + MinuteVar + ":" + WriteIf(SecondsVar >9, "", "0") + SecondsVar; }

// Background color

SetChartBkColor(ParamColor("Panel color ",colorBlack));

// CCI colors

zcolor= ParamColor("WCCI color",colorWhite);z6color= ParamColor("TCCI color",colorBlack);patterncolor= ParamColor("Pattern trace color",colorGreen);

// CCI periods

zperiod=Param("WCCI period",20,0,100);z = CCI(zperiod); z6period=Param("TCCI period",6,0,1000);z6 = CCI(z6period);

// Tic/PIP value

TicMult= Param("Tic multiplier(ER2=10,YM=1,ES=4,FOREX=1)",1,0,1000000);TicDiv= Param("Tic or PIP value(ER2=0.1,YM=1,FOREX=1)",1,0,1000000);

// Rangebar interval

rbint= Param("RangebarInterval:(YM=25.0,AB=1.5,NQ=3.75,ES=3.0)",1.0,0.25,1000000);

// Rangebar counter

rbcounter= round(((rbint-(H-L))) * ticmult);rbcounterpercent= round((rbcounter/(rbint * ticmult))*100);

// Timer/counter title

timercode= Param("Timer:(minutes=1,rangebar=2)",1,1,2);timetitle= WriteIf(timercode==1,TitleTimeRem, EncodeColor(colorWhite) +"Countdown " + rbcounter + " (" + rbcounterpercent + "%)");

// Spread

spread= Param("Spread (included in stop)",0,0,1000000);

// Stop value

stopval= Param("Stop above/below entry bar",5,0,1000000);

// Plot grids

// Angle variables

PI = atan(1.00) * 4; periods = 30; HighHigh = HHV(H, periods); LowLow = LLV(L, periods); range = 25 / (HighHigh - LowLow) * LowLow;

// EMA34 Angle

Page 5: Afl Woodie Cci

EMA34 = EMA(C,34);x1_EMA34 = 0; x2_EMA34 = 1; y1_EMA34 = 0; y2_EMA34 = (Ref(EMA34, -1) - EMA34) / Avg * range; c_EMA34 = sqrt((x2_EMA34 - x1_EMA34)*(x2_EMA34 - x1_EMA34) + (y2_EMA34 -y1_EMA34)*(y2_EMA34 - y1_EMA34)); angle_EMA34 = round(180 * acos((x2_EMA34 - x1_EMA34)/c_EMA34) / PI); angle_EMA34 = IIf(y2_EMA34 > 0, - angle_EMA34, angle_EMA34);

// LSMA25 Angle

LSMA25 = LinearReg(C, 25 ); x1_LSMA25 = 0; x2_LSMA25 = 1; y1_LSMA25 = 0; y2_LSMA25 = (Ref(LSMA25, -1) - LSMA25) / Avg * range; c_LSMA25 = sqrt((x2_LSMA25 - x1_LSMA25)*(x2_LSMA25 - x1_LSMA25) + (y2_LSMA25 -y1_LSMA25)*(y2_LSMA25 - y1_LSMA25)); angle_LSMA25 = round(180 * acos((x2_LSMA25 - x1_LSMA25)/c_LSMA25) / PI); angle_LSMA25 = IIf(y2_LSMA25 > 0, - angle_LSMA25, angle_LSMA25);

// Color the bars for Woodies Trend Following

function Consecutive( array ) { return BarsSince( NOT( array ) ); } function Occurrences( array , period ) { return Sum( array, period ); } array = z; HighBars = Consecutive( array > 0 ); LowBars = Consecutive( array < 0 ); UpCondition = BarsSince( HighBars >= 6 AND Occurrences( array > 100 , 5 ) > 0); DnCondition = BarsSince( LowBars >= 6 AND Occurrences( array < -100 , 5 ) > 0); UpTrend = ( array > 0 ) AND ( UpCondition < DnCondition ); DnTrend = ( array < 0 ) AND ( UpCondition > DnCondition ); TrTrend = ( HighBars >= 5 AND NOT UpTrend ) OR ( LowBars >= 5 AND NOT DnTrend); Color = IIf( UpTrend, colorBlue, IIf( DnTrend, colorRed, IIf( TrTrend,colorYellow, colorGrey40 ) ) );

// Plot the Mock CZI on the 100s

ColorANGLE_EMA = IIf(angle_EMA34 >=5,colorTurquoise,IIf(angle_EMA34 <5 AND angle_EMA34 >=3.57,colorDarkGreen,IIf(angle_EMA34 <3.57 AND angle_EMA34 >=2.14,colorPaleGreen,IIf(angle_EMA34 <2.14 AND angle_EMA34 >=.71,colorLime,IIf(angle_EMA34 <=-1*5,colorDarkRed,IIf(angle_EMA34 >-1*5 AND angle_EMA34 <=-1*3.57,colorRed,IIf(angle_EMA34 >-1*3.57 AND angle_EMA34 <=-1*2.14,colorOrange,IIf(angle_EMA34 >-1*2.14 AND angle_EMA34<=-1*.71,colorLightOrange,colorYellow))))))));Plot(100,"", ColorANGLE_EMA , styleLine | styleThick | styleNoLabel); Plot(101,"", ColorANGLE_EMA , styleLine | styleThick | styleNoLabel); Plot(102,"", ColorANGLE_EMA , styleLine | styleThick | styleNoLabel); Plot(103,"", ColorANGLE_EMA , styleLine | styleThick | styleNoLabel); Plot(99,"", ColorANGLE_EMA , styleLine | styleThick | styleNoLabel); Plot(98,"", ColorANGLE_EMA , styleLine | styleThick | styleNoLabel);

Page 6: Afl Woodie Cci

//Plot(50,"", ColorANGLE_EMA , styleLine | styleThick | styleNoLabel); //Plot(-50,"", ColorANGLE_EMA , styleLine | styleThick | styleNoLabel);

Plot(-100,"", ColorANGLE_EMA , styleLine | styleThick | styleNoLabel); Plot(-101,"", ColorANGLE_EMA , styleLine | styleThick | styleNoLabel); Plot(-102,"", ColorANGLE_EMA , styleLine | styleThick | styleNoLabel); Plot(-99,"", ColorANGLE_EMA , styleLine | styleThick | styleNoLabel); Plot(-98,"", ColorANGLE_EMA , styleLine | styleThick | styleNoLabel);

// Plot the Mock Sidewinder on the 200s

SW = IIf((abs(angle_EMA34) >= 15) AND (abs(angle_EMA34 + angle_LSMA25) >= 50),IIf(angle_LSMA25 > 0, 2, -2), IIf((abs(angle_EMA34) >= 0) AND (((angle_EMA34 >= 0) AND (angle_LSMA25 >= 0))OR ((angle_EMA34 <= 0) AND (angle_LSMA25 <= 0))) AND (abs(angle_EMA34 +angle_LSMA25) >= 5), IIf(angle_LSMA25 > 0, 1, -1), 0)); ColorSW = IIf(abs(SW) == 2, colorBrightGreen, IIf(abs(SW) == 1, colorYellow, colorRed));

// Zero line 25lsma

Plot(0,"", IIf(C > LSMA25,colorBrightGreen,IIf(C < LSMA25,colorRed,colorTeal)),styleLine | styleThick | styleNoLabel);

// CCI Points

diffCode=ParamToggle("Plot CCI diff ","No|Yes",1); CCipointmove= z-Ref(z,-1);diff_cci = round(CCipointmove*10)/10;CCIpointmovetitle = WriteIf(Ref(z,-1) > Ref(z,-2),EncodeColor(colorBrightGreen),EncodeColor(colorRed))+"Diff Ex : "+Ref(diff_cci,-1) +

WriteIf(z > Ref(z,-1),EncodeColor(colorBrightGreen),EncodeColor(colorRed))+" Now : "+diff_cci +"\n";/*CCIpointmovetitle= WriteIf(diffcode==1 ANDabs(CCipointmove)<15,EncodeColor(colorRed) + "\n" + "DIFF " + abs(round(CCipointmove)) + "\n",WriteIf(diffcode==1 AND abs(CCipointmove)>=15AND abs(CCipointmove)<20,EncodeColor(colorYellow) + "\n" + "DIFF " + abs(round(CCipointmove)) + "\n",WriteIf(diffcode==1 ANDabs(CCIpointmove)>=20,EncodeColor(colorBrightGreen) + "\n" + "DIFF " + abs(round(CCipointmove))+ "\n","")));*/// Price Panel

Lastpricetitlehi= WriteIf(H>Ref(H,-1),EncodeColor(colorBrightGreen) + Ref(H,-1)+ " " + H , EncodeColor(colorWhite)+ Ref(H,-1) + " " + H);Lastpricetitlelo= WriteIf(L<Ref(L,-1),EncodeColor(colorRed) + Ref(L,-1) + " "+ L , EncodeColor(colorWhite) + Ref(L,-1) + " " + L);Closecolor=WriteIf(C==H ANDH>Ref(H,-1),EncodeColor(colorBrightGreen),WriteIf(C==L ANDL<Ref(L,-1),EncodeColor(colorRed),EncodeColor(colorWhite)));

// Pattern codes

Cziquallong= ((angle_EMA34>=5 OR Ref(angle_EMA34,-1)>=5) ANDRef(angle_EMA34,-2)>=5) OR (Ref(angle_EMA34,-1)>=5 AND angle_EMA34>=5);Cziqualshort= ((angle_EMA34<=-5 OR Ref(angle_EMA34,-1)<=-5) ANDRef(angle_EMA34,-2)<=-5) OR (Ref(angle_EMA34,-1)<=-5 AND angle_EMA34<=-5);

Page 7: Afl Woodie Cci

// ZLR Long

Linex_long=Ref(z,-1)>100 AND z<100; barsfromline_long=BarsSince(Linex_long); CCIhook_long=z>Ref(z,-1) AND Ref(z,-1)>-100 AND Ref(z,-1)<Ref(z,-2) ANDRef(z,-2)>-100 AND z>0;SW_trendinglong= sw==1 OR sw==2; zlrlong1= abs(CCipointmove)>=15 AND SW_trendinglong AND z<120 ANDbarsfromline_long<=10 AND CCIhook_long AND UpTrend;zlrnextl= z<120 AND barsfromline_long<10 AND CCIhook_long AND UpTrend;zlrlong= Cziquallong AND (zlrlong1 OR ( NOT Ref(zlrlong1,-1) ANDRef(zlrnextl,-1) AND abs(CCipointmove)>=15 AND z>=Ref(z,-1) AND SW_trendinglongAND z<120 AND UpTrend));

// ZLR Short

Linex_short=Ref(z,-1)<=-100 AND z>=-100; barsfromline_short=BarsSince(Linex_short); CCIhook_short=z<Ref(z,-1) AND Ref(z,-1)<100 AND Ref(z,-1)>Ref(z,-2) ANDRef(z,-2)<100 AND z<0; SW_trendingshort= sw==-1 OR sw==-2;zlrshort1= abs(CCipointmove)>=15 AND SW_trendingshort AND z>-120 ANDbarsfromline_short<=10 AND CCIhook_short AND DnTrend;zlrnexts= z>-120 AND barsfromline_short<10 AND CCIhook_short AND DnTrend;zlrshort= Cziqualshort AND (zlrshort1 OR (NOT Ref(zlrshort1,-1) ANDRef(zlrnexts,-1) AND abs(CCipointmove)>=15 AND z<=Ref(z,-1) AND SW_trendingshortAND z>-120 AND DnTrend));

// Famir Long

FamirLinex_long=Ref(z,-1)<=-100 AND z>-100; Famir_barsfromline_long=BarsSince(FamirLinex_long); Famir_pivotlong= (Ref(z,-2)>Ref(z,-1)AND Ref(z,-1)>=-55 AND Ref(z,-2)>=-55) OR(Ref(z,-3)>Ref(z,-1) AND Ref(z,-1)>=-55 AND Ref(z,-2)>=-55 AND Ref(z,-3)>=-55)OR(Ref(z,-4)>Ref(z,-1) AND Ref(z,-1)>=-55 AND Ref(z,-2)>=-55 AND Ref(z,-3)>=-55);

Famirhook_long=Famir_pivotlong AND z>Ref(HHV(z,Famir_barsfromline_long),-1) AND(z>=-55 AND z<=55); Famirlong= Famir_barsfromline_long<10 AND Famirhook_long AND ((DnTrend ORRef(Dntrend,-BarsSince(z<0))==1) AND NOT UpTrend) AND C>LSMA25;

// Famir Short

FamirLinex_short=Ref(z,-1)>=100 AND z<100; Famir_barsfromline_short=BarsSince(FamirLinex_short); Famir_pivotshort= (Ref(z,-2)<Ref(z,-1)AND Ref(z,-1)<=55 AND Ref(z,-2)<=55) OR(Ref(z,-3)<Ref(z,-1)AND Ref(z,-1)<=55 AND Ref(z,-2)<=55 AND Ref(z,-3)<=55) OR(Ref(z,-4)<Ref(z,-1) AND Ref(z,-1)<=55 AND Ref(z,-2)<=55 AND Ref(z,-3)<=55); Famirhook_short=Famir_pivotshort AND z<Ref(LLV(z,Famir_barsfromline_short),-1)AND (z>=-55 AND z<=55); Famirshort= Famir_barsfromline_short<10 AND Famirhook_short AND ((UpTrend ORRef(Uptrend,-BarsSince(z>0))==1) AND NOT DnTrend) AND C<LSMA25;

// HFE

HFEshort=(Ref(z,-1)>200 AND z<200); HFElong=(Ref(z,-1)<-200 AND z>-200); HFE= HFEshort OR HFElong;

// VT Long

vtLinex_long=Ref(z,-1)<=-200 AND z>-200;

Page 8: Afl Woodie Cci

vt_barsfromline_long=BarsSince(vtLinex_long); vtlong_A = z<-200; vtlong_B = Ref(z,-1)<=Ref(z,-2) OR Ref(z,-2)<=Ref(z,-3) OR Ref(z,-3)<=Ref(z,-4) OR Ref(z,-4)<=Ref(z,-5) OR Ref(z,-5)<=Ref(z,-6) OR Ref(z,-6)<=Ref(z,-7) OR Ref(z,-7)<=Ref(z,-8); vtlong_bs_A = BarsSince(vtlong_A); vtlong_bs_B = BarsSince(vtlong_b); Vtlong_bars = vtlong_bs_A>=5 AND vtlong_bs_B<=0; vt_pivotlong= Vtlong_bars; swinghibars=BarsSince(z>Ref(HHV(z,vt_barsfromline_long),-1)); vthook_long= vt_pivotlong AND z>Ref(HHV(z,vt_barsfromline_long),-1); vtlong= z<100 AND vt_barsfromline_long<=11 AND(Ref(HHV(z,vt_barsfromline_long),-1)<0 OR HHV(z,vt_barsfromline_long)<=0) ANDvthook_long AND C>Lsma25 AND Ref(swinghibars>=2,-1) AND z>-100;

// VT Short

vtLinex_short=Ref(z,-1)>=200 AND z<200; vt_barsfromline_short=BarsSince(vtLinex_short); vtshort_A = z>200 ; vtshort_B =Ref(z,-1)>=Ref(z,-2) OR Ref(z,-2)>=Ref(z,-3) OR Ref(z,-3)>=Ref(z,-4) OR Ref(z,-4)>=Ref(z,-5) OR Ref(z,-5)>=Ref(z,-6) OR Ref(z,-6)>=Ref(z,-7) OR Ref(z,-7)>=Ref(z,-8); vtshort_bs_A = BarsSince(vtshort_A); vtshort_bs_B = BarsSince(vtshort_b); Vtshort_bars = vtshort_bs_A>=5 AND vtshort_bs_B<=0; vt_pivotshort= Vtshort_bars; swinglowbars= BarsSince(z<Ref(LLV(z,vt_barsfromline_short),-1)); vthook_short= vt_pivotshort AND z<Ref(LLV(z,vt_barsfromline_short),-1); vtshort= z>-100 AND vt_barsfromline_short<=11 AND(Ref(LLV(z,vt_barsfromline_short),-1)>0 OR LLV(z,vt_barsfromline_short)>0) ANDvthook_short AND C<Lsma25 AND Ref(swinglowbars>=2,-1) AND z<100;

// GB 100 Long

Linex_longGB=Ref(z,-1)>100 AND z<100; barsfromline_longGB=BarsSince(Linex_longGB); CCIhook_longGB= Ref(z,-1)<-100 AND z>-100; GB100long= z<100 AND barsfromline_longGB<=12 AND Cziquallong AND CCIhook_longGBAND (Ref(UpTrend,-BarsSince(z>0))==1 AND NOT DnTrend);

// GB100 Short

Linex_shortGB=Ref(z,-1)<-100 AND z>-100; barsfromline_shortGB=BarsSince(Linex_shortGB); CCIhook_shortGB=Ref(z,-1)>100 AND z<100; Gb100short= z>-100 AND barsfromline_shortGB<=12 AND Cziqualshort ANDCCIhook_shortGB AND (Ref(DnTrend,-BarsSince(z<0))==1 AND NOT UpTrend);

// TT Long

Minuszero=BarsSince(Ref(z,-1)>0) + 1;TTCCIhook_long= z>Ref(z,-1) AND z>0; TTlong= Cziquallong AND z<100 AND Ref(UpTrend,-Minuszero)==1 ANDLLV(Ref(z,-1),BarsSince(Ref(z,-1)>=100))>-100 AND

Page 9: Afl Woodie Cci

HHV(Ref(z,-1),BarsSince(Ref(z,-1)< 0))>=100 AND TTCCIhook_long ANDRef(LowBars,-1)>=4 AND Ref(LowBars,-1)<=9;

// TT Short

Pluszero=BarsSince(Ref(z,-1)<0) + 1;TTCCIhook_short=z<Ref(z,-1) AND z<0; TTshort= Cziqualshort AND z>-100 AND Ref(DnTrend,-Pluszero)==1 ANDHHV(Ref(z,-1),BarsSince(Ref(z,-1)<=-100))<100 ANDLLV(Ref(z,-1),BarsSince(Ref(z,-1)>0))<=-100 AND TTCCIhook_short ANDRef(HighBars,-1)>=4 AND Ref(HighBars,-1)<=9;

// PT Long

Phook_long1= Ref(z,-1)>=Ref(z,-2) AND Ref(z,-2)<Ref(z,-3) AND Ref(z,-3)>0; Phook_long2= Ref(z,-3)>-100 AND Ref(z,-1)>Ref(z,-2) AND Ref(z,-2)<Ref(z,-3) ANDRef(z,-3)<Ref(z,-4) AND Ref(z,-4)>0;Ptlong= Cziquallong AND (Phook_long1 OR Phook_long2) AND (z>0 AND Ref(z,-1)<0AND z<120 AND Ref(z,-1)>-100 AND Ref(z,-2)>-100 AND z>Ref(z,-1) AND UpTrend);

// PT Short

Phook_short1= Ref(z,-1)<=Ref(z,-2) AND Ref(z,-2)>Ref(z,-3) AND Ref(z,-3)<0; Phook_short2= Ref(z,-3)<100 AND Ref(z,-1)<Ref(z,-2) AND Ref(z,-2)>Ref(z,-3) ANDRef(z,-3)> Ref(z,-4) AND Ref(z,-4)<0;Ptshort= Cziqualshort AND (Phook_short1 OR Phook_short2) AND (z<0 ANDRef(z,-1)>0 AND z>-120 AND Ref(z,-1)<100 AND Ref(z,-2)<100 AND z<Ref(z,-1) ANDDnTrend);

// Ghosts (6)GhostBarIndex = LastBarIndex;if (LastBarIndex != CurBarIndex) GhostBarIndex = CurBarIndex;

C14GhostChange = Param("Ghost - Min WCCI change %", 8, 0, 50);GhostCciShift=300;C14GhostChange = Param("Ghost - Min WCCI change %", 8, 0, 50);GhostCciChange=C14GhostChange / 2; //CCI values are shifted up 300 ponts (-300 - + 300 -> 0 - 600)C14GhostSteepCompToZL=Param("Ghost - Max trend line slope to ZL(CCI/bar)", 8,0, 30, 1);C14GhostSteepCompFromZL=Param("Ghost - Max trend line slope from ZL(CCI/bar)",4, 0, 30, 1);

// Ghost Long (6)C14Shifted = -Z + GhostCciShift;C14Shifted = IIf(C14Shifted < 0, 0, C14Shifted);C14Shifted = IIf(C14Shifted > 600, 600, C14Shifted);

GhostLongLeft = -Peak(C14Shifted, GhostCciChange, 3) + GhostCciShift; GhostLongHead = -Peak(C14Shifted, GhostCciChange, 2) + GhostCciShift; GhostLongRight = -Peak(Ref(C14Shifted,-1), GhostCciChange, 1) + GhostCciShift;

GhostLongRightDip = -Ref(Trough(C14Shifted, GhostCciChange, 1), -1) +GhostCciShift;GhostLongRightDipIndex = BarIndex() - Ref(TroughBars(C14Shifted,GhostCciChange, 1), -1)-1;GhostLongLeftDip = -Ref(Trough(C14Shifted, GhostCciChange, 2), -1) +GhostCciShift; GhostLongLeftDipIndex = BarIndex() - Ref(TroughBars(C14Shifted, GhostCciChange,2), -1) -1;GhostLongHeadWidth = GhostLongRightDipIndex - GhostLongLeftDipIndex;GhostLongRightWidth = BarIndex() - GhostLongRightDipIndex;

Page 10: Afl Woodie Cci

GhostLongComp = (GhostLongRightDip - GhostLongLeftDip) / GhostLongHeadWidth;GhostLongBar = ( (GhostLongLeft > GhostLongHead AND GhostLongRight >GhostLongHead AND GhostLongHead <= -100 ) //Ghost OR (GhostLongLeft < GhostLongHead AND GhostLongRight <GhostLongHead AND GhostLongLeft <= -100)) //MGhost AND GhostLongLeftDip <= 0 AND GhostLongRightDip <= 0 AND (GhostLongRightDip + GhostLongComp*GhostLongRightWidth <= Z ORZ>0)//WCCI returned above neckline AND GhostLongHeadWidth < 25 AND GhostLongRightWidth > 1 AND GhostLongRightWidth < 12;GhostLong = GhostLongBar AND NOT Ref(GhostLongBar,-1) AND Z < 120 AND GhostLongComp >= -C14GhostSteepCompFromZL AND GhostLongComp <=C14GhostSteepCompToZL;

GhostLongRef = BarsSince(GhostLong);

if ( GhostLongRef[GhostBarIndex] <= 5 ){ GhostLongIndex = GhostBarIndex - GhostLongRef[GhostBarIndex]; GhostLine = LineArray( GhostLongLeftDipIndex[GhostLongIndex], GhostLongLeftDip[GhostLongIndex], GhostLongRightDipIndex[GhostLongIndex] + 10, GhostLongRightDip[GhostLongIndex] +GhostLongComp[GhostLongIndex] * 10, 0, False); Plot(GhostLine, "", colorWhite, styleThick | styleNoLabel | styleNoTitle);}//DEBUG//Plot(-120, "GhostLongBar", IIf(GhostLongBar, colorGreen, colorRed));//GhostLine = LineArray( GhostLongLeftDipIndex[CurBarIndex],// GhostLongLeftDip[CurBarIndex],// GhostLongRightDipIndex[CurBarIndex] + 10,// GhostLongLeftDip[CurBarIndex] + GhostLongComp[CurBarIndex]*(GhostLongHeadWidth[CurBarIndex]+10),// 0, False);//Plot(GhostLine, "", colorGreen, styleThick);

// Ghost Short (6)C14Shifted = Z + GhostCciShift;C14Shifted = IIf(C14Shifted < 0, 0, C14Shifted);C14Shifted = IIf(C14Shifted > 600, 600, C14Shifted);

GhostShortLeft = Peak(C14Shifted, GhostCciChange, 3) - GhostCciShift; GhostShortHead = Peak(C14Shifted, GhostCciChange, 2) - GhostCciShift; GhostShortRight = Peak(C14Shifted, GhostCciChange, 1) - GhostCciShift; GhostShortRightDip = Ref(Trough(C14Shifted, GhostCciChange, 1), -1) -GhostCciShift;GhostShortRightDipIndex = BarIndex() - Ref(TroughBars(C14Shifted,GhostCciChange, 1), -1) -1;GhostShortLeftDip = Ref(Trough(C14Shifted, GhostCciChange, 2), -1) -GhostCciShift; GhostShortLeftDipIndex = BarIndex() - Ref(TroughBars(C14Shifted,GhostCciChange, 2), -1) -1;GhostShortHeadWidth = GhostShortRightDipIndex - GhostShortLeftDipIndex;GhostShortRightWidth = BarIndex() - GhostShortRightDipIndex;GhostShortComp = (GhostShortRightDip - GhostShortLeftDip) /GhostShortHeadWidth;GhostShortBar = ( (GhostShortLeft < GhostShortHead AND GhostShortRight <GhostShortHead AND GhostShortHead >= 100) //Ghost OR (GhostShortLeft > GhostShortHead AND GhostShortRight >GhostShortHead AND GhostShortLeft >= 100)) //MGhost

Page 11: Afl Woodie Cci

AND GhostShortLeftDip >= 0 AND GhostShortRightDip >=0 AND (GhostShortRightDip + GhostShortComp*GhostShortRightWidth >= ZOR Z<0) //WCCI returned below neckline AND GhostShortHeadWidth < 25 AND GhostShortRightWidth > 1 AND GhostShortRightWidth < 12;GhostShort = GhostShortBar AND NOT Ref(GhostShortBar,-1) AND Z > -120 AND GhostShortComp <= C14GhostSteepCompFromZL AND GhostShortComp >=-C14GhostSteepCompToZL;

GhostShortRef = BarsSince(GhostShort);

if ( GhostShortRef[GhostBarIndex] <= 5 ){ GhostShortIndex = GhostBarIndex - GhostShortRef[GhostBarIndex]; GhostLine = LineArray( GhostShortLeftDipIndex[GhostShortIndex], GhostShortLeftDip[GhostShortIndex], GhostShortRightDipIndex[GhostShortIndex] + 10, GhostShortRightDip[GhostShortIndex] +GhostShortComp[GhostShortIndex] * 10, 0, False); Plot(GhostLine, "", colorWhite, styleThick | styleNoLabel | styleNoTitle);}//DEBUG//Plot(120, "GhostShortBar", IIf(GhostShortBar, colorGreen, colorRed));//GhostLine = LineArray( GhostShortLeftDipIndex[CurBarIndex], GhostShortLeftDip[CurBarIndex], GhostShortRightDipIndex[CurBarIndex] + 10,// GhostShortLeftDip[CurBarIndex] + GhostShortComp[CurBarIndex]*(GhostShortHeadWidth[CurBarIndex]+10),// 0, False);//Plot(GhostLine, "", colorRed, styleThick);

// Signal Title

Buy = zlrlong OR VTlong OR GB100long OR GhostLong;Short = zlrshort OR VTshort OR Gb100short OR GhostShort;Filter=Buy OR Short;AddColumn( IIf(Buy,1,IIf(Short,-1,0)) ,"BS",1.0,colorBlack,IIf(Buy,colorGreen,IIf(Short,colorRed,colorBlack)));AddColumn( IIf(zlrlong,1,IIf(zlrshort,-1,0)) ,"ZLR",1.0,colorWhite,IIf(zlrlong,colorGreen,IIf(zlrshort,colorRed,colorBlack))); AddColumn( IIf(VTlong,1,IIf(VTshort,-1,0)) ,"VT",1.0,colorWhite,IIf(zlrlong,colorGreen,IIf(zlrshort,colorRed,colorBlack))); AddColumn( IIf(GB100long,1,IIf(gb100short,-1,0)) ,"GB100",1.0,colorWhite,IIf(zlrlong,colorGreen,IIf(zlrshort,colorRed,colorBlack))); AddColumn( IIf(Ghostlong,1,IIf(Ghostshort,-1,0)) ,"Ghost",1.0,colorWhite,IIf(zlrlong,colorGreen,IIf(zlrshort,colorRed,colorBlack)));

PatCode1=ParamToggle("Plot ZLR (1)","No|Yes",1); PatCode2=ParamToggle("Plot FAMIR (2)","No|Yes",1); PatCode3=ParamToggle("Plot VT (3)","No|Yes",1); PatCode4=ParamToggle("Plot GB100 (4)","No|Yes",1); PatCode5=ParamToggle("Plot TT (5)","No|Yes",1); PatCode6=ParamToggle("Plot GHOST (6)","No|Yes",1);

Page 12: Afl Woodie Cci

PatCode7=ParamToggle("Plot HFE","No|Yes",1);

Signaltitle= WriteIf(PatCode1==1 AND zlrlong,EncodeColor(colorDarkRed) + "\n" +"*** ALERT -- ZLR ***" + "\n",WriteIf(PatCode1==1 AND zlrshort,EncodeColor(colorDarkRed) + "\n" + "*** ALERT-- ZLR ***" + "\n", WriteIf(PatCode2==1 AND Famirshort,EncodeColor(colorDarkRed) + "\n" + "***ALERT -- FAMIR ***" + "\n", WriteIf(PatCode2==1 AND Famirlong,EncodeColor(colorDarkRed) + "\n" + "***ALERT -- FAMIR ***" + "\n", WriteIf(PatCode3==1 AND VTlong AND NOT famirlong,EncodeColor(colorDarkRed) +"\n" + "*** ALERT -- VT ***" + "\n", WriteIf(PatCode3==1 AND VTshort AND NOT famirshort,EncodeColor(colorDarkRed) +"\n" + "*** ALERT -- VT ***" + "\n", WriteIf(PatCode4==1 AND GB100long,EncodeColor(colorDarkRed) + "\n" + "***ALERT -- GB100 ***" + "\n",WriteIf(PatCode4==1 AND Gb100short,EncodeColor(colorDarkRed) + "\n" + "***ALERT -- GB100 ***" + "\n", WriteIf(PatCode5==1 AND TTLong,EncodeColor(colorDarkRed) + "\n" + "*** ALERT-- TT ***" + "\n", WriteIf(PatCode5==1 AND TTShort,EncodeColor(colorDarkRed) + "\n" + "*** ALERT-- TT ***" + "\n",WriteIf(PatCode6==1 AND GhostLong,EncodeColor(colorDarkRed) + "\n" + "***ALERT -- GHOST ***" + "\n", WriteIf(PatCode6==1 AND GhostShort,EncodeColor(colorDarkRed) + "\n" + "***ALERT -- GHOST ***" + "\n",WriteIf(PatCode7==1 AND HFE,EncodeColor(colorDarkRed) + "\n" + "*** ALERT --HFE ***" + "\n","")))))))))))));

// Pattern signal codes

PlotShapes(IIf(PatCode1==1 ANDzlrlong,shapeDigit1,shapeNone),colorBlue,0,Min(z,0),-15); PlotShapes(IIf(PatCode1==1 AND zlrshort,shapeDigit1+shapePositionAbove,shapeNone),colorRed,0,Max(z,0),-15);PlotShapes(IIf(PatCode2==1 ANDfamirlong,shapeDigit2,shapeNone),colorBlue,0,Min(z,0),-15); PlotShapes(IIf(PatCode2==1 AND famirShort ,shapeDigit2+shapePositionAbove,shapeNone),colorRed,0,Max(z,0),-15) ;PlotShapes(IIf(PatCode3==1 AND vtlong AND NOTfamirlong,shapeDigit3,shapeNone),colorBlue,0,Min(z,0),-47); PlotShapes(IIf(PatCode3==1 AND vtshort AND NOT famirshort,shapeDigit3+shapePositionAbove,shapeNone),colorRed,0,Max(z,0),-47);PlotShapes(IIf(PatCode4==1 ANDGB100long,shapeDigit4,shapeNone),colorBlue,0,Min(z,0),-60); PlotShapes(IIf(PatCode4==1 AND GB100short,shapeDigit4+shapePositionAbove,shapeNone),colorRed,0,Max(z,0),-60); PlotShapes(IIf(PatCode5==1 ANDttlong,shapeDigit5,shapeNone),colorBlue,0,Min(z,0),-50); PlotShapes(IIf(PatCode5==1 AND ttshort,shapeDigit5+shapePositionAbove,shapeNone),colorRed,0,Max(z,0),-50);PlotShapes(IIf(PatCode6==1 ANDGhostLong,shapeDigit6,shapeNone),colorBlue,0,Min(z,0),-50); PlotShapes(IIf(PatCode6==1 AND GhostShort,shapeDigit6+shapePositionAbove,shapeNone),colorRed,0,Max(z,0),-50);PlotShapes(IIf(PatCode7==1 AND HFEshort,shapeCircle,shapeNone),IIf(PatCode7==1AND HFEshort,colorYellow,shapeNone),0,200,10); PlotShapes(IIf(PatCode7==1 AND HFElong,shapeCircle,shapeNone),IIf(PatCode7==1AND HFElong,colorYellow,shapeNone),0,-200,-10) ;

// CCI hook ExitHookExitLong= z<=Ref(z,-1);HookExitShort= z>=Ref(z,-1);

Page 13: Afl Woodie Cci

// 100 Line Cross Exit ConservativeCross100longC= z<=Ref(z,-1) AND z<100;Cross100shortC= z>=Ref(z,-1) AND z>-100;

// 100 Line Cross Exit AggressiveCross100longA= Ref(z,-1)>100 AND z<100;Cross100shortA= Ref(z,-1)<-100 AND z>-100;

// Mplay Exit

MplayExitLong= z<Ref(z,-1) AND Ref(z,-1)<Ref(z,-2) AND C<O; MplayExitShort= z>Ref(z,-1) AND Ref(z,-1)>Ref(z,-2) AND C>O;

// Heikin-Ashi Exit

HaClose =EMA((O+H+L+C)/4,3); HaOpen = AMA( Ref( HaClose, -1 ), 0.5 ); HaHigh = Max( H, Max( HaClose, HaOpen ) ); HaLow = Min( L, Min( HaClose, HaOpen ) );HExitConLong= HaLow < HaOpen;HExitConShort= HaHigh > HaOpen;

// Exit codeExitCode=Param("Exits:Hook=1,100xConservative=2,100xAggressive=3,Mplay=4,H-Ashi=5",1,1,5);ExitCodeTitleLong=IIf(ExitCode==1,HookExitLong,IIf(Exitcode==2,Cross100longC,IIf(Exitcode==3,Cross100longA,IIf(Exitcode==4,MplayExitLong,IIf(Exitcode==5,HExitConLong,0)))));ExitCodeTitleShort=IIf(ExitCode==1,HookExitShort,IIf(Exitcode==2,Cross100shortC,IIf(Exitcode==3,Cross100shortA,IIf(Exitcode==4,MplayExitShort,IIf(Exitcode==5,HExitConShort,0)))));AllPatterns =(zlrlong AND patcode1==1) OR (famirlong AND patcode2==1) OR(Vtlong AND patcode3==1) OR (gb100long AND patcode4==1) OR (ttlong ANDpatcode5==1) OR (GhostLong AND patcode6==1) OR (Hfelong AND patcode7==1)OR (zlrshort AND patcode1==1) OR (famirshort AND patcode2==1) OR (Vtshort ANDpatcode3==1) OR (gb100short AND patcode4==1) OR (ttshort AND patcode5==1) OR(GhostShort AND patcode6==1) OR (Hfeshort AND patcode7==1);BuyPattern = (zlrlong AND patcode1==1) OR (famirlong AND patcode2==1) OR(Vtlong AND patcode3==1) OR (gb100long AND patcode4==1) OR (ttlong ANDpatcode5==1) OR (GhostLong AND patcode6==1) OR (Hfelong AND patcode7==1);SellPattern= ExitCodeTitleLong;ShortPattern = (zlrshort AND patcode1==1) OR (famirshort AND patcode2==1) OR(Vtshort AND patcode3==1) OR (gb100short AND patcode4==1) OR (ttshort ANDpatcode5==1) OR (GhostShort AND patcode6==1) OR (Hfeshort AND patcode7==1);CoverPattern = ExitCodeTitleShort;

//Plot Sell/Cover Arrows

Sell1=ExRem(SellPattern,BuyPattern); Cover1=ExRem(CoverPattern,ShortPattern); SellCode=ParamToggle("Plot sell/cover arrows ","No|Yes",1); PlotShapes(IIf(Sell1 ANDSellCode==1,shapeHollowDownArrow,shapeNone),colorBlue,0,200,10); PlotShapes(IIf(Cover1 ANDSellCode==1,shapeHollowDownArrow,shapeNone),colorRed,0,200,10);

// Calculate pattern hilites

// Long

Page 14: Afl Woodie Cci

AsellL= BuyPattern;BsellL= Sell1;bs_AsellL= BarsSince(AsellL);bs_BsellL= BarsSince(BsellL);bars_sellL= IIf(bs_ASellL<= bs_BsellL,bs_AsellL,0);

//ShortAsellS= ShortPattern;BsellS= Cover1;bs_AsellS= BarsSince(AsellS);bs_BsellS= BarsSince(BsellS);bars_sellS= IIf(bs_ASellS<= bs_BsellS,bs_AsellS,0);hilitecode=ParamToggle("Hi-lite patterns","No|Yes",1);

// CCI Line

CCIcolor= IIf(((bars_sellL OR bars_sellS) OR AllPAtterns) ANDhilitecode==1,patterncolor,zcolor);Plot(round(z),"WCCI", CCIcolor , styleLine | styleThick);

// Turbo CCI

Plot(round(z6),"TCCI", z6color, styleLine);

// CCI Histogram

Plot( array, "", colorDefault, styleLine | styleThick | styleNoLabel); Plot( array, "", Color, styleHistogram | styleThick| styleNoLabel);

// BackTest Long

LastPatLong= BuyPattern;LastPatBarLong= BarsSince(LastPatLong);DDL=IIf((((LLV(L,LastPatBarLong)-Ref(C,-LastPatBarLong))))/ticdiv>=0,0,(((LLV(L,LastPatBarLong)-Ref(C,-LastPatBarLong))))/ticdiv);BTExitLong= (((C-Ref(C,-LastPatBarLong))))/ticdiv; PeakLong=IIf((((HHV(H,LastPatBarLong)-Ref(C,-LastPatBarLong))))/ticdiv<=0,0,(((HHV(H,LastPatBarLong)-Ref(C,-LastPatBarLong))))/ticdiv);StopLong1= Ref(C,-LastPatBarLong) - (Ref(L,-LastPatBarLong) - (stopval*ticdiv)- (spread*ticdiv));stoplong= (((StopLong1)))/ticdiv;BackTestLongTitle= WriteIf(Sell1,EncodeColor(colorBlue) + "\n" +"Stop " + (Ref(C,-LastPatBarLong) - (round(stoplong)*ticdiv)) + " " +round(stoplong) + "\n" +"DD " + (Ref(C,-LastPatBarLong) + (round(DDL)*ticdiv)) + " " + round(DDL) + "\n" + "Exit " + (Ref(C,-LastPatBarLong) + (round(BTExitLong)*ticdiv)) + " " +round(BTExitLong) + "\n" +"Peak " + (Ref(C,-LastPatBarLong) + (round(PeakLong)*ticdiv)) + " " +round(PeakLong) + "\n",EncodeColor(colorBlue) + "\n" +"Stop " + (Ref(C,-LastPatBarLong) - (round(stoplong)*ticdiv)) + " " +round(stoplong) + "\n" +"DD " + (Ref(C,-LastPatBarLong) + (round(DDL)*ticdiv)) + " " + round(DDL) + "\n" + "Exit " + (Ref(C,-LastPatBarLong) + (round(BTExitLong)*ticdiv)) + " " +round(BTExitLong) + "\n" +"Peak " + (Ref(C,-LastPatBarLong) + (round(PeakLong)*ticdiv)) + " " +round(PeakLong) + "\n");

// BackTest Short

LastPatShort= ShortPattern;LastPatBarShort= BarsSince(LastPatShort);

Page 15: Afl Woodie Cci

DDS=IIf((((Ref(C,-LastPatBarShort)-HHV(H,LastPatBarShort))))/ticdiv>=0,0,(((Ref(C,-LastPatBarShort)-HHV(H,LastPatBarShort))))/ticdiv);BTExitShort= (((Ref(C,-LastPatBarShort)-C)))/ticdiv; PeakShort=IIf((((Ref(C,-LastPatBarShort)-LLV(L,LastPatBarShort))))/ticdiv<=0,0,(((Ref(C,-LastPatBarShort)-LLV(L,LastPatBarShort))))/ticdiv);StopShort1= (Ref(H,-LastPatBarShort) + (Stopval*ticdiv) + (spread*ticdiv)) -Ref(C,-LastPatBarShort);StopShort= (((StopShort1)))/ticdiv;BackTestShortTitle= WriteIf(Cover1,EncodeColor(colorRed) + "\n" +"Stop " + (Ref(C,-LastPatBarShort) + (round(stopshort)*ticdiv)) + " " +round(stopshort) + "\n" +"DD " + (Ref(C,-LastPatBarShort) + abs(round(DDS)*ticdiv)) + " " + round(DDS) + "\n" + "Exit " + (Ref(C,-LastPatBarShort) - (round(BTExitShort)*ticdiv)) + " "+ round(BTExitShort) + "\n" +"Peak " + (Ref(C,-LastPatBarShort) - (round(PeakShort)*ticdiv)) + " " + round(PeakShort) + "\n",EncodeColor(colorRed)+ "\n" + "Stop " + (Ref(C,-LastPatBarShort) + (round(stopshort)*ticdiv)) + " " +round(stopshort) + "\n" +"DD " + (Ref(C,-LastPatBarShort) + abs(round(DDS)*ticdiv)) + " " + round(DDS) + "\n" + "Exit " + (Ref(C,-LastPatBarShort) - (round(BTExitShort)*ticdiv)) + " "+ round(BTExitShort) + "\n" + "Peak " + (Ref(C,-LastPatBarShort) - (round(PeakShort)*ticdiv)) + " " + round(PeakShort) + "\n");

// Backtest title

BackTestCode= ParamToggle("Display Stop,DD,Peak,Exit stats","No|Yes",1); BackTestTitle= WriteIf((bars_sellL>0 OR Sell1) ANDBackTestCode==1,BackTestLongTitle ,WriteIf((bars_sellS>0 OR Cover1 )ANDBackTestCode==1,BackTestShortTitle ,""));

// Stop in

Longbar= L+rbint;Shortbar= H-rbint;sstoptitle=WriteIf(timercode==2, EncodeColor(colorBlue) + "\n" + "Stop In Long " + Longbar + EncodeColor(colorRed) + "\n" + "Stop In Short " + Shortbar +"\n","");

// Stop out

stopCode=ParamToggle("Display stop-out ","No|Yes",1); StopLong1= C -(L - (stopval*ticdiv) - (spread*ticdiv));stoplong1c=C-stoplong1;stoplong= round(StopLong1/ticdiv);StopShort1= (H + (stopval*ticdiv) + (spread*ticdiv)) - C;stopshortc= C+StopShort1;StopShort= round(StopShort1/ticdiv);stoptitle= WriteIf(stopcode==1,EncodeColor(colorRed) + "Stop Out Short " + stopshortc + " " + stopshort +EncodeColor(colorBrightGreen) + "\n" + "Stop Out Long " + stoplong1c + " " +stoplong + "\n","");

// Titlefilt = 2;CCIpointmovetitle = WriteIf(Ref(z,-1) > Ref(z,-2),EncodeColor(colorBrightGreen),EncodeColor(colorRed))+"Diff Ex : "+Ref(diff_cci,-1) +

Page 16: Afl Woodie Cci

WriteIf(z > Ref(z,-1),EncodeColor(colorBrightGreen),EncodeColor(colorRed))+" Now : "+diff_cci +"\n";

Cc89 = CCI(120);Title =WriteIf(z > 100,EncodeColor(colorLightBlue),WriteIf(z < -100,EncodeColor(colorCustom12),WriteIf((z - Ref(z,-1)) > 15, EncodeColor(colorBrightGreen),WriteIf((z - Ref(z,-1)) < -15, EncodeColor(colorRed),WriteIf(z > Ref(z,-1), EncodeColor(colorDarkGreen),EncodeColor(colorDarkRed))))))+

"CCI : " + round(z)+ " - " +WriteIf(BarsSince(Color == colorRed) > BarsSince(Color == colorBlue), EncodeColor(colorBrightGreen)+ "TRENDING for " + BarsSince(Color == colorRed)+ " bars", EncodeColor(colorRed)+ "TRENDING for " + BarsSince(Color == colorBlue)+ " bars")+

"\n" + CCIpointmovetitle +

"\n" +

EncodeColor(colorWhite)+"CCI Cycle " +

WriteIf(Color == colorBlue, EncodeColor(colorGreen)+ " UP trend ",WriteIf(Color == colorRed, EncodeColor(colorRed)+ " DN trend ",WriteIf(Color == colorYellow, EncodeColor(colorYellow)+ " Change in Trend ",WriteIf(Color == colorGrey40, EncodeColor(colorGrey40)+ " Wait mode ",""))))+

EncodeColor(colorWhite)+ "\nCZ " +

WriteIf(ColorANGLE_EMA == colorTurquoise, EncodeColor(colorGreen)+ " UP trend ",WriteIf(ColorANGLE_EMA == colorDarkRed, EncodeColor(colorRed)+ " DN trend ", EncodeColor(colorGrey40)+ " Wait mode "))+

EncodeColor(colorWhite)+"\nSW " +

WriteIf(ColorSW == colorBrightGreen, EncodeColor(colorAqua)+ " Strong Trend ",WriteIf(ColorSW == colorYellow, EncodeColor(colorYellow)+ "Weak trend ", EncodeColor(colorGrey40)+ " Sideways "))+

//timetitle + "\n" + "\n" + //Lastpricetitlehi + "\n" + Closecolor + C + "\n" + //Lastpricetitlelo + "\n" //CCIpointmovetitle //+ wptitle + HiDayTitle + LoDayTitle//+ RangeTitle1 + BackTestTitle //+ Signaltitle //+ sstoptitle //+ stoptitle

Page 17: Afl Woodie Cci

+WriteIf(C > Lsma25, EncodeColor(colorBrightGreen),EncodeColor(colorRed))+"LSMA = "+ Lsma25+ WriteIf(C > Lsma25, EncodeColor(colorBrightGreen)+ "\nLong allowed",EncodeColor(colorRed)+"\nShort Allowed")+"\n"+"\n"+WriteIf(Cc89 > 100, EncodeColor( colorBrightGreen) + "Very strong Up trend \nHold and add longs \navoid shorts",WriteIf(Cc89 > 50, EncodeColor( colorBrightGreen) + "Up trend \n avoid Adds",WriteIf(Cc89 < -100, EncodeColor( colorRed) + "Very strong DN trend \nhold and add shorts \navoid longs",WriteIf(Cc89 < -50, EncodeColor( colorRed) + "DN trend \n Avoid Adds",EncodeColor( colorYellow)+"Neutral market : \nwait for direction"))))

;_SECTION_END();