Linkon's DB-BB system...!

How effective is the system...?


  • Total voters
    94

linkon7

Well-Known Member
#1
This is a continuation of this thread...

http://www.traderji.com/day-trading/36391-trading-nifty-camarilla-pivots.html

The whole thread took some time to shape into a nice system and it has undergone plenty of tweaks and adjustment. I will summarize the whole system here with the rules of entry / exit / stoploss etc so that it becomes more focused.

The DB-BB system is basically a 2 faced system. It caters to both flat market and the trending phase of the market. It consist of a boilinger band (20,2.25) and boilinger band(20,1) plotted together on price.

We look at the floor-roof indicator to tell us, if Nifty is trending or flat.

We then use CCI-14 and CCI-6 plotted together and this acts as our confirmation or entry.

We use camarilla pivots to ensure we get into the higher probability trades only.
 
Last edited:

linkon7

Well-Known Member
#2
Afl used...!

afl for the price...


Code:
_SECTION_BEGIN("ADX"); 
Col_bar = IIf(EMA(CCI(14),2) > Ref(EMA(CCI(14),2),-1),colorBrightGreen,colorRed);
Plot(Close,"price",col_bar,styleCandle);

_SECTION_END();

_SECTION_BEGIN("BB");
bb2top = BBandTop(Close,20,2.25);
bb1top = BBandTop(Close,20,1);
bb2bot = BBandBot(Close,20,2.25);
bb1bot = BBandBot(Close,20,1);
//PlotOHLC( Cc,Cc,80,Cc, "", IIf( Cc > 0, colorGreen, colorRed ), styleCloud | styleClipMinMax, -80, 80 ); 
Plot (bb2top,"",IIf(bb2top > Ref(bb2top,-1) AND bb2bot < Ref(bb2bot,-1),colorBlue,colorGrey40),styleNoLabel);
Plot (bb2bot,"",IIf(bb2top > Ref(bb2top,-1) AND bb2bot < Ref(bb2bot,-1),colorBlue,colorGrey40),styleNoLabel);
//Col_action = IIf(Close >bb1top AND PDI(range) > MDI(range),colorBrightGreen,IIf(Close <bb1bot AND PDI(range) < MDI(range),colorRed,colorBlack));  
//Plot(2, "", IIf(ADX(range) > Ref(ADX(range),-1),colorBlue,colorBlack), styleOwnScale| styleArea|styleNoLabel,-0.5,100);

//Plot(5, "", Col_action, styleOwnScale| styleArea|styleNoLabel,-0.5,100);

_SECTION_END();

//PlotOHLC(EMA( Close, 19 ),IIf(EMA( Close, 19 ) > EMA( Close, 21 ),EMA( Close, 19 ),EMA( Close, 21 )),IIf(EMA( Close, 19 )<EMA( Close, 21 ),EMA( Close, 19 ),EMA( Close, 21 )),EMA( Close, 20 ),"",IIf(EMA( Close, 20 ) > MA(EMA( Close, 20 ),3),colorDarkGreen,colorDarkRed),styleCloud); 

_SECTION_END();



_SECTION_BEGIN("SIMPLE_D-CAMS_SHOW");
//---- pivot points 

DayH = TimeFrameGetPrice("H", inDaily, -1);// yesterdays high 
DayL = TimeFrameGetPrice("L", inDaily, -1);//low 
DayC = TimeFrameGetPrice("C", inDaily, -1);//close 
DayO = TimeFrameGetPrice("O", inDaily);// current day open 
HiDay = TimeFrameGetPrice("H", inDaily); 
LoDay = TimeFrameGetPrice("L", inDaily);


TimeFrameSet( inDaily );

R6 = (DayH / DayL) * DayC * 1.002;
R5 = (DayH / DayL) * DayC;
R4 = (((DayH / DayL) + 0.83) / 1.83) * DayC;
R3 = ( ( (DayH / DayL) + 2.66) / 3.66) * DayC;
R2 = ( ( (DayH / DayL) + 4.5) / 5.5) * DayC;
R1 = ( ( (DayH / DayL) + 10) / 11) * DayC;
 
S1 = (2- ( ( (DayH / DayL) + 10) / 11)) * DayC;
S2 = (2-( (DayH / DayL) + 4.5) / 5.5) * DayC;
S3 = (2-(( DayH / DayL) + 2.66) / 3.66) * DayC;
S4 = (2-( (DayH / DayL) + 0.83) / 1.83) * DayC;
S5 = (2-( DayH / DayL)) * DayC;
S6 = (2-( DayH / DayL)) * DayC * 0.998;


ShowR5 = ParamToggle("R5", "No|Yes");
R5Color=ParamColor( "R5Color", colorGold );
ShowR4 = ParamToggle("R4", "yes|no");
R4Color=ParamColor( "R4Color", colorOrange );
ShowR3 = ParamToggle("R3", "yes|no");
R3Color=ParamColor( "R3Color", colorOrange );
ShowR2 = ParamToggle("R2", "No|Yes");
R2Color=ParamColor( "R2Color", colorDarkRed );
ShowR1 = ParamToggle("R1", "No|Yes");
R1Color=ParamColor( "R1Color", colorRed );

ShowS1 = ParamToggle("S1", "No|Yes");
S1Color=ParamColor( "S1Color", colorGreen );
ShowS2 = ParamToggle("S2", "No|Yes");
S2Color=ParamColor( "S2Color", colorBrightGreen );
ShowS3 = ParamToggle("S3", "yes|no");
S3Color=ParamColor( "S3Color", colorDarkGreen );
ShowS4 = ParamToggle("S4", "yes|no");
S4Color=ParamColor( "S4Color", colorDarkGreen );
ShowS5 = ParamToggle("S5", "No|Yes");
S5Color=ParamColor( "S5Color", colorAqua );

//Shadowcolor = ParamColor("Shadow",ColorRGB(40,30,20));
//Shadowcolor1 = ParamColor("Shadow1",ColorRGB(20,30,20));
//Shadowcolor2 = ParamColor("Shadow2",ColorRGB(30,40,0));

//style = styleDots | styleThick + styleNoRescale ; 
style = styleLine + styleNoRescale ; 

if(ShowR5 == True)
Plot(R5, "R5",R5Color,style);
if(ShowR4 == False) 
Plot(R4, "R4",R4Color,Style);
if(ShowR3 == False)
Plot(R3, "R3",R3Color,style);
if(ShowR2 == True) 
Plot(R2, "R2",R2Color,styleLine);
if(ShowR1 == True)
Plot(R1, "R1",R1Color,styleLine);

if(ShowS1 == True)
Plot(S1, "S1",S1Color,styleLine);
if(ShowS2 == True)
Plot(S2, "S2",S2Color,styleLine);
if(ShowS3 == False)
Plot(S3, "S3",S3Color,style);
if(ShowS4 == False) 
Plot(S4, "S4",S4Color,style);
if(ShowS5 == True) 
Plot(S5, "S5",S5Color,style); 

ToolTip=StrFormat("Open: %g\nHigh: %g\nLow: %g\nClose: %g (%.1f%%)\nVolume: "+NumToStr( V, 1 ), O, H, L, C, SelectedValue( ROC( C, 1)));
TimeFrameRestore();
_SECTION_END();

PlotOHLC(bb2top,bb2top,bb1top,bb1top,"",colorDarkGrey,styleCloud); 
  PlotOHLC(bb1bot,bb1bot,bb2bot,bb1bot,"",colorDarkGrey,styleCloud);



_SECTION_BEGIN("Fibo for all bars");

TimeFrameSet( in15Minute*2 ); 
DH=Ref(H,-1); 
DL=Ref(L,-1);
DC=Ref(C,-1);


pd = (O+ DH+ DL + DC )/4;
sd1 = (2*pd)-DH;
sd2 = pd -(DH - DL);
sd3 = Sd1 - (DH-DL); 
rd1 = (2*pd)-DL;
rd2 = pd +(DH -DL);
rd3 = rd1 +(DH-DL);



//Plot (pd,"Pivot",colorBlue,styleDots);
//Plot (rd1," R1 ",35,styleDots);
//Plot (rd2," R2 ",35,styleDots);
//Plot (rd3," R3 ",35,styleDots);

//Plot (sd1," S1 ",4,styleDots);
//Plot (Sd2," S2 ",4,styleDots);
//Plot (Sd3," S3 ",4,8+16);
/*
style = IIf(ParamList("Chart style", "styleCandle|styleBar")=="styleCandle",64,128+4);
Plot (C,Date ()+" close",1,style); //ENABLE THIS TO HAVE CANDLES AS WELL
*/
TimeFrameRestore();


Title = EncodeColor(colorWhite)+ "LINKON'S PIVOT TRADING SYSTEM" + " - " +  Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
 "  - " + Date() +" - "
//+ WriteIf(Col_action==colorGreen, EncodeColor(colorGreen)+"stay LONG","")+ WriteIf(Col_action==colorRed, EncodeColor(colorRed)+"stay SHORT","")+  WriteIf(Col_action==colorBlack, EncodeColor(colorYellow)+"No Trend","")+"\n"
+ "Vol= "+ WriteVal(V) +WriteIf ( V > MA(V,26) ,EncodeColor(colorGreen)+"  UP "+ (V/MA(V,26))*100 + " %", EncodeColor(colorRed)+"  DOWN "+ (V/MA(V,26))*100 + " %")
+ EncodeColor(colorGreen)+   "\n R3 : "+ EncodeColor(colorWhite)+RD3
+ EncodeColor(colorGreen)+   "\n R2 : "+ EncodeColor(colorWhite)+RD2
+ EncodeColor(colorGreen)+   "\n R1 : "+ EncodeColor(colorWhite)+RD1+ EncodeColor(colorGreen)+   "`            Hi: "+ EncodeColor(colorWhite)+H
+ EncodeColor(colorBlue)+   "\n Pivot : "+ EncodeColor(colorWhite)+pd + EncodeColor(colorYellow)+   "`   Op: "+ EncodeColor(colorWhite)+O+ EncodeColor(colorAqua)+   "Cl: "+ EncodeColor(colorBrightGreen)+C
+ EncodeColor(colorRed)+   "\n S1 : "+ EncodeColor(colorWhite)+SD1+ EncodeColor(colorRed)+   "`            Lo: "+ EncodeColor(colorWhite)+L
+ EncodeColor(colorRed)+   "\n S2 : "+ EncodeColor(colorWhite)+SD2
+ EncodeColor(colorRed)+   "\n S3 : "+ EncodeColor(colorWhite)+SD3
;

_SECTION_END();
Afl for CCI panel

Code:
_SECTION_BEGIN("CCI Panel for Amibroker"); 
/////////////////////////////// 
// CCI Panel for Amibroker
// Codded/Added by Dennis, Kris, Wring, Santacs 
// Last Update: 1/02/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.
/////////////////////////////// 

// 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 
{ 
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",colorYellow);

// CCI periods

zperiod=Param("WCCI period",14,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("Rangebar interval:(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",2,0,1000000); 

// Plot grids

PlotTheGrids = ParamToggle("Plot grids","No|Yes",0); 
if (PlotTheGrids ==1) 
{ 
PlotGrid(0); 
PlotGrid(-100); 
PlotGrid(100);
PlotGrid(-200); 
PlotGrid(200); 
} 

// Angle variables

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

// EMA34 Angle

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 ) ) );  

// CCI Line 

//Plot(round(z),"WCCI", zcolor, styleLine | styleThick);

// Turbo CCI 


d=0.03;
z6t=z6+HHV(z6,100)*d;
z6b=z6-HHV(z6,100)*d;

Plot(round(z6),"TCCI", z6color, styleThick);
//PlotOHLC(z6t,z6t,z6b,z6b,"",z6color,styleCloud,styleNoLabel);

d=0.02;
zt=z+HHV(z,100)*d;
zb=z-HHV(z,100)*d;
 
//PlotOHLC(zt,zt,zb,zb,"",zcolor,styleCloud,styleNoLabel);


periods = Param( "Periods", 20, 1, 200, 1 );
K1smooth = Param( "%K1 avg", 4, 1, 200, 1 );

periods = Param( "Periods", 20, 1, 200, 1 );
K1smooth = Param( "%K1 avg", 4, 1, 200, 1 );
D1smooth = Param( "%D1 avg", 2, 1, 200, 1 );
 
A = StochK( periods , K1smooth);
B = StochD( periods , K1smooth, D1Smooth );


periods = Param( "Periods", 8, 1, 200, 1 );
K2smooth = Param( "%K1 avg", 3, 1, 200, 1 );
D2smooth = Param( "%D1 avg", 3, 1, 200, 1 );

M = StochK( periods , K2smooth);
N = StochD( periods , K2smooth, D2Smooth );

ColorK=IIf(A>B,colorBrightGreen,colorRed);


PlotOHLC(zt,zt,zb,zb,"",zcolor,styleCloud,styleNoLabel);

//PlotOHLC(zt,zt,zb,zb,"",ColorK,styleCloud,styleNoLabel);

Z42=CCI(42); 
//Plot(Z42,"", colorCustom12, styleLine | styleThick); 










// CCI Histogram 

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

// Zero line 25lsma 

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

// 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(99,"", ColorANGLE_EMA , styleLine | styleThick | styleNoLabel); 
Plot(98,"", ColorANGLE_EMA , styleLine | styleThick | styleNoLabel); 

Plot(-100,"", ColorANGLE_EMA , styleLine | styleThick | styleNoLabel); 
Plot(-101,"", ColorANGLE_EMA , styleLine | styleThick | styleNoLabel); 
Plot(-99,"", ColorANGLE_EMA , styleLine | styleThick | styleNoLabel); 
Plot(-102,"", 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, colorBlue, 
IIf(abs(SW) == 1, colorGrey40, colorBlack)); 
Plot(200,"", ColorSW, styleLine | styleThick | styleNoLabel); 
Plot(-200,"", ColorSW, styleLine | styleThick | styleNoLabel);

// CCI Points

CCipointmove= z-Ref(z,-1);
CCIpointmovetitle= WriteIf(abs(CCipointmove)<15,EncodeColor(colorRed) + "\n"  + "DIFF  " + 
abs(round(CCipointmove)),WriteIf(abs(CCipointmove)>=15 AND abs(CCipointmove)<20,EncodeColor(colorYellow) + "\n"  + "DIFF  " + 
abs(round(CCipointmove)),WriteIf(abs(CCIpointmove)>=20,EncodeColor(colorBrightGreen) + "\n"  + "DIFF  " + 
abs(round(CCipointmove)),"")));

// 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 AND H>Ref(H,-1),EncodeColor(colorBrightGreen),WriteIf(C==L AND L<Ref(L,-1),EncodeColor(colorRed),EncodeColor(colorWhite)));

// 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",0); 
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(colorBlue) + "\n" + "Stop Out Long  " + stoplong1c + "   " + stoplong + "\n" +
EncodeColor(colorRed) + "Stop Out Short  " + stopshortc + "   " + stopshort  + "\n","");

// Title

Title = "\n" + "" + EncodeColor(colorWhite) + Date() + "\n" + "\n" +
timetitle + "\n" + "\n" + Lastpricetitlehi + "\n" + Closecolor + C +   
"\n" + Lastpricetitlelo + "\n" +  CCIpointmovetitle + "\n" + sstoptitle + stoptitle;

Buy=Z42>0 AND (Cross(round(z),-100) OR Cross(round(z),0) OR Cross(round(z),50));
Sell=Z42<0 AND (Cross(100,round(z)) OR Cross(0,round(z)) OR Cross(-50,round(z)));
Filter=Buy OR Sell;

AddColumn( IIf(Buy,1,IIf(Sell,-1,0)) ,"BS",1.0,colorBlack,IIf(Buy,colorGreen,IIf(Sell,colorRed,colorBlack)));

_SECTION_END();





_SECTION_BEGIN("Stochastic_45-4-2_833");

ColorX=colorBlack;
//ColorX=colorWhite;


 
periods = Param( "Periods", 20, 1, 200, 1 );
K1smooth = Param( "%K1 avg", 4, 1, 200, 1 );
//Plot( StochK( periods , K1smooth), _DEFAULT_NAME(), colorCustom3, styleNoLabel  | styleThick | styleDots);


periods = Param( "Periods", 20, 1, 200, 1 );
K1smooth = Param( "%K1 avg", 4, 1, 200, 1 );
D1smooth = Param( "%D1 avg", 2, 1, 200, 1 );
//Plot( StochD( periods , K1smooth, D1Smooth ), _DEFAULT_NAME(), colorCustom3, styleNoLabel  | styleThick | styleDots);



A = StochK( periods , K1smooth);
B = StochD( periods , K1smooth, D1Smooth );



PlotOHLC( 300, 300 , 280 , 280 , "", ColorANGLE_EMA, styleCloud | styleNoLabel);
//PlotOHLC( -280, -280 , -300 , -300 , "", IIf(C > LSMA25,colorBrightGreen,IIf(C < LSMA25,colorRed,colorTeal)), styleCloud | styleNoLabel);

periods = Param( "Periods", 8, 1, 200, 1 );
K1smooth = Param( "%K1 avg", 3, 1, 200, 1 );



periods = Param( "Periods", 8, 1, 200, 1 );
K2smooth = Param( "%K1 avg", 3, 1, 200, 1 );
D2smooth = Param( "%D1 avg", 3, 1, 200, 1 );

M = StochK( periods , K2smooth);
N = StochD( periods , K2smooth, D2Smooth );

ColorK=IIf(A>B,colorBrightGreen,colorRed);

//Plot( M,"StoK", ColorK, styleNoLabel|styleThick);
//Plot( N,"StoD", colorDarkYellow, styleNoLabel|styleDashed);



//PlotOHLC( 0, A , B , B , "Cloud", IIf(A > B ,colorAqua,colorRed), styleCloud | styleNoLabel);


_SECTION_END();
_SECTION_BEGIN("Woodie's CCI  Intraday Panel");
//------------------------------------------------------------------------------
//
//  Formula Name:    Woodie's CCI  Intraday Panel
//  Author/Uploader: Dennis Skoblar 
//  E-mail:          [email protected] 
//  Date/Time Added: 2006-07-22 15:27:37
//  Origin:          woodiescciclub.com
//  Keywords:        Woodie's CCI, CCI
//  Level:           medium
//  Flags:           system,exploration,indicator
//  Formula URL:     http://www.amibroker.com/library/formula.php?id=642
//  Details URL:     http://www.amibroker.com/library/detail.php?id=642
//
//------------------------------------------------------------------------------
//
//  Here is Woodie's CCI Intraday panel which was originally coded by
//  Crasher_FL and Wring. It is a modified Daily CCI Panel with the CCI 14, and
//  CCI 6. It is complete with pattern recognition,backtesting, scanning, and
//  exploration options. The Pattern Recognition helps find the ZLR, HFE,
//  GB100(with a 34ema +/- 15 degree nuance), VT,FAMIR,MR and Choppy (Chop mode
//  being defined as the CCI bars inbetween the 100's for 10 or more bars. The
//  reset out of chop is when the CCI hooks from extreme at the 200's). . The
//  pattern recognition is located at the top left corner next to "Signal: ".
//
//  1=zlr
//
//  2-famir
//
//  3=vt
//
//  4=gb100
//
//  5=momentum reversal
//
//  This version has the Mplay Exit Indicator in it. The MPLAY exit is a CCI
//  hook to the oposite direction followed by another with the price closing in
//  the oposite direction of the trade. I have coded the MPLAY Indicator with
//  the CCI panel. It is a series of green and red circles just below the +200
//  line. The nearest green circle that appears after a pattern (any pattern,
//  not just the coded ones) is the exit for a long position. The nearest red
//  circle is the exit after a short pattern. Ignore all the ones inbetween.
//  The circles appear after every and any occurance of an MPLAY Exit,
//  regardless if a pattern has appeared or not. Just use the nearest
//  applicable circle to exit a pattern entered.
//
//  I also added the EMA angle colors to the 100's. Turquoise= uptrend,
//  Red=downtrend, Yellow=not trending. This code was originally in the cci
//  panel coded by Crasher, I just tweeked it to be displayed in visual format.
//  It is identical to woodie's modification to the cci panel, which he uses as
//  a chop inicator as well. If there is a constant color, the trend is in that
//  direction. If the colors are mixed, then there is a chop.
//
//  Trade at your own risk, please use your own descretion, for educational
//  purposes only.
//
//  -Dennis
//
//------------------------------------------------------------------------------

/////////////////////////////// 

// CCI Woodies Style - Started by Wring 

// Codded/Added by Kris 

// Added by Dennis and Greg 

// Version: 1.027 

// Last Update: 11/24/2005 

// Additions: 

// timer, EMA angle, LSMA angle, trending indicator, pattern recognition (Choppy, HFE, ZLR, FAMIR, VT, GB100) 

// Amibroker 4.70 

/////////////////////////////// 

Version(4.70); 

//MarketHours = TimeNum()>=63000 AND TimeNum()<=125959; 

//MArketClose= TimeNum()>=125959 AND TimeNum()<=130000; 

z = CCI(14); 

z6 = CCI(6); 

CCI50_var = CCI(50); 

LSMA25 = LinearReg(C, 25 ); 

EMA34 = EMA(C,34); 

PI = atan(1.00) * 4; 

periods = 30; 

HighHigh = HHV(H, periods); 

LowLow = LLV(L, periods); 

range = 25 / (HighHigh - LowLow) * LowLow; 

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; 

TitleTimeRem = EncodeColor(colorBlueGrey) + "Time Remaining: "; 

MinuteVar = int(TimeRem / 60); 

SecondsVar = int(frac(TimeRem / 60) * 60); 

if (TimeRem[BarCount - 1] > 60) 

{ 

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

} 

else if (TimeRem[BarCount - 1] > 20) 

{ 

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

} 

else 

{ 

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

} 

if(SelectedValue(CCI50_var) < 0) 

{ 

CCI50Title = EncodeColor(colorRed); 

} 

else 

{ 

CCI50Title = EncodeColor(colorLime); 

} 

CCI50Title = CCI50Title + "CCI 50 = " + round(CCI50_var) + ", "; 

stop_range = IIf(O < C, IIf((H - O) < (C - L), C - L, H - O), 

IIf((O - L) < (H - C), H - C, O - L)); 

StopTitle = EncodeColor(colorWhite) + "Stop = " + EncodeColor(colorYellow); 

StopTitle = StopTitle + StrToNum(NumToStr(stop_range, 4.4)); 

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); 

TitleAngleEMA34 = EncodeColor(colorWhite) + "\nEMA34 angle = "; 

angle_EMA34 = IIf(y2_EMA34 > 0, - angle_EMA34, angle_EMA34); 

if(SelectedValue(angle_EMA34) >= 25) 

{ 

TitleAngleEMA34 = TitleAngleEMA34 + EncodeColor(colorTurquoise); 

} 

else if(SelectedValue(angle_EMA34) <= -25) 

{ 

TitleAngleEMA34 = TitleAngleEMA34 + EncodeColor(colorRed); 

} 

else if(SelectedValue(angle_EMA34) >= 5) 

{ 

TitleAngleEMA34 = TitleAngleEMA34 + EncodeColor(colorTurquoise); 

} 

else if(SelectedValue(angle_EMA34) <= -5) 

{ 

TitleAngleEMA34 = TitleAngleEMA34 + EncodeColor(colorRed); 

} 

else 

{ 

TitleAngleEMA34 = TitleAngleEMA34 + EncodeColor(colorYellow); 

} 

TitleAngleEMA34 = TitleAngleEMA34 + angle_EMA34; 

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); 

TitleAngleLSMA25 = EncodeColor(colorWhite) + "LSMA25 angle = "; 

angle_LSMA25 = IIf(y2_LSMA25 > 0, - angle_LSMA25, angle_LSMA25); 

if(SelectedValue(angle_LSMA25) >= 25) 

{ 

TitleAngleLSMA25 = TitleAngleLSMA25 + EncodeColor(colorTurquoise); 

} 

else if(abs(SelectedValue(angle_LSMA25)) <= -25) 

{ 

TitleAngleLSMA25 = TitleAngleLSMA25 + EncodeColor(colorRed); 

} 

else if(SelectedValue(angle_LSMA25) >= 5) 

{ 

TitleAngleLSMA25 = TitleAngleLSMA25 + EncodeColor(colorTurquoise); 

} 

else if(SelectedValue(angle_LSMA25) <= -5) 

{ 

TitleAngleLSMA25 = TitleAngleLSMA25 + EncodeColor(colorRed); 

} 

else 

{ 

TitleAngleLSMA25 = TitleAngleLSMA25 + EncodeColor(colorYellow); 

} 

TitleAngleLSMA25 = TitleAngleLSMA25 + angle_LSMA25; 

TitleTrending = WriteIf((abs(angle_EMA34) >= 15) AND (abs(angle_EMA34 + angle_LSMA25) >= 50), EncodeColor(colorWhite) + ", SW = " + EncodeColor(colorLime) + "TRENDING", 

WriteIf((abs(angle_EMA34) >= 5) AND (((angle_EMA34 >= 0) AND (angle_LSMA25 >= 0)) OR ((angle_EMA34 <= 0) AND (angle_LSMA25 <= 0))) AND (abs(angle_EMA34 + angle_LSMA25) >= 30), EncodeColor(colorWhite) + ", SW = " + EncodeColor(colorYellow) + "NORMAL", 

EncodeColor(colorWhite) + ", SW = " + EncodeColor(colorRed) + "FLAT")); 

SW = IIf((abs(angle_EMA34) >= 15) AND (abs(angle_EMA34 + angle_LSMA25) >= 50), IIf(angle_LSMA25 > 0, 2, -2), 

IIf((abs(angle_EMA34) >= 5) AND (((angle_EMA34 >= 0) AND (angle_LSMA25 >= 0)) OR ((angle_EMA34 <= 0) AND (angle_LSMA25 <= 0))) AND (abs(angle_EMA34 + angle_LSMA25) >= 30), IIf(angle_LSMA25 > 0, 1, -1), 0)); 

// Colour the bars for Woodies Trend Following 

Plusbars = BarsSince(z < 0); 

Minusbars = BarsSince(z > 0); 

TrendBarCount = 6; 

Color[0] = colorDefault; 

Trend[0] = 0; 

TTMColor[0] = colorDefault; 

for( i = 1; i < BarCount; i++ ) 

{ 

if (C[i] > High_third[i]) 

{ 

TTMColor[i] = colorDarkGreen; 

} 

else if (C[i] < Low_third[i]) 

{ 

TTMColor[i] = colorDarkRed; 

} 

else 

{ 

TTMColor[i] = TTMColor[i - 1]; 

} 

if (Plusbars[i] >= TrendBarCount) 

{ 

Trend[i] = 1; 

} 

else if (Minusbars[i] >= TrendBarCount) 

{ 

Trend[i] = -1; 

} 

else 

{ 

Trend[i] = Trend[i - 1]; 

} 

if (Trend[i] == 1) 

{ 

if (Minusbars[i] == TrendBarCount - 1) 

{ 

Color[i] = colorYellow; 

} 

else if (z[i] < 0) 

{ 

Color[i] = colorLightGrey; 

} 

else 

{ 

Color[i] = colorLime; 

} 

} 

else if (Trend[i] == -1) 

{ 

if (Plusbars[i] == TrendBarCount - 1) 

{ 

Color[i] = colorYellow; 

} 

else if (z[i] >= 0) 

{ 

Color[i] = colorLightGrey; 

} 

else 

{ 

Color[i] = colorRed; 

} 

} 

else 

{ 

Color[i] = colorDefault; 

} 

} 

// CCI Line 

//Plot(z,"CCI 14", colorSkyblue, styleLine | styleThick); 

// Turbo CCI 

//Plot(z6,"CCI 6", colorLightOrange, styleLine | styleNoLabel); 

// zero line 25lsma 

//Plot(0,"", IIf(C > LSMA25,colorGreen,IIf(C<LSMA25,colorRed,colorTeal)), styleDots | styleNoLine | styleThick | styleNoLabel); 

// CCI Histogram 

//Plot(z,"", Color, styleHistogram | styleNoLabel); 

// CCI 50 

//Plot(CCI50_var,"CCI 50", IIf(CCI50_var < 0, colorDarkRed,colorDarkGreen), styleLine | styleNoLabel); 

// Set up color for the 100s, green if 34ema above red if below 

//Color = IIf(C > EMA34, colorGreen, 

// IIf(C == EMA34, colorTeal, colorRed)); 

//Set Color for the SW 

ColorSW = IIf(abs(SW) == 2, colorGreen, 

IIf(abs(SW) == 1, colorYellow, colorRed)); 

Color=colorWhite; 

// Plot the 100s 

//Plot(100,"",Color,styleDashed|styleNoLabel); 

//Plot(-100,"",Color,styleDashed|styleNoLabel); 

ColorANGLE_EMA = IIf(angle_EMA34 >=5, colorTurquoise, 

IIf(angle_EMA34 <=-5, colorRed, colorYellow)); 

//ColorANGLE_EMA1 = IIf(angle_EMA34 >=25, colorTurquoise, 

// IIf(angle_EMA34 <=-25, colorRed, colorBlack)); 

//ColorANGLE_EMA = IIf(abs(angle_EMA34) >=25, colorGreen, 

// IIf(abs(angle_EMA34) >=15, colorYellow, colorRed)); 

//Plot(100,"", ColorANGLE_EMA , styleDashed | styleThick | styleNoLabel); 

//Plot(-100,"", ColorANGLE_EMA , styleDashed | styleThick | styleNoLabel); 

// Plot the 50s 

//Plot(50,"", colorDarkGrey, styleDashed | styleNoLabel); 

//Plot(-50,"", colorDarkGrey , styleDashed | styleNoLabel); 

//Plot(50,"", TTMColor, styleDots | styleNoLine | styleNoLabel); 

//Plot(-50,"", TTMColor, styleDots | styleNoLine | styleNoLabel); 

// Plot the 200s 

//Plot(200,"", ColorSW, styleThick | styleNoLabel); 

//Plot(-200,"", ColorSW, styleThick | styleNoLabel); /

// Plot the grids 

//PlotGrid(0); 

//PlotGrid(50); 

//PlotGrid(-50); 

//PlotGrid(-100); 

//PlotGrid(100); 

//PlotGrid(-200); 

///PlotGrid(200); 

//// choppy 

A= (HHV(z,10)<=100 AND LLV(z,10)>=-100); 

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

bs_a=BarsSince(A); 

bs_b=BarsSince(B); 

bars = IIf( bs_A < Bs_B, bs_a, 0); 

// ZLR Long 

uptrend_a=BarsSince(z<0); 

uptrend_b=BarsSince(z>0); 

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) AND Ref(z,-2)>-100 AND z>0; 

SW_trendinglong= sw==1 OR sw==2; 

zlrlong= (Ref(angle_ema34,-2)>=5 AND Ref(angle_ema34,-1)>=5 AND angle_ema34>=5) AND SW_trendinglong AND z<100 AND barsfromline_long<10 AND CCIhook_long AND (uptrend_a>=6 AND z>-100 OR 

(uptrend_b<6 AND LLV(z,uptrend_b)>-100 AND z>-100 AND (Ref(uptrend_a,-6)>=6 AND z>-100 OR Ref(uptrend_a,-5)>=6 AND z>-100 OR Ref(uptrend_a,-4)>=6 AND z>-100 OR Ref(uptrend_a,-3)>=6 AND z>-100 OR 

Ref(uptrend_a,-2)>=6 AND z>-100 OR Ref(uptrend_a,-1)>=6 AND z>-100))); 

PlotShapes(IIf(zlrlong,shapeDigit1,shapeNone),colorLime,0,0,-15); 

// ZLR Short 

downtrend_a=BarsSince(z>0); 

downtrend_b=BarsSince(z<0); 

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) AND Ref(z,-2)<100 AND z<0; 

SW_trendingshort= sw==-1 OR sw==-2; 

zlrshort= (Ref(angle_ema34,-2)<=-5 AND Ref(angle_ema34,-1)<=-5 AND angle_ema34<=-5) AND SW_trendingshort AND z>-100 AND barsfromline_short<10 AND CCIhook_short AND (downtrend_a>=6 AND z<100 OR 

(downtrend_b<6 AND HHV(z,downtrend_b)<100 AND z<100 AND (Ref(downtrend_a,-6)>=6 AND z<100 OR Ref(downtrend_a,-5)>=6 AND z<100 OR Ref(downtrend_a,-4)>=6 AND z<100 OR 

Ref(downtrend_a,-3)>=6 AND z<100 OR Ref(downtrend_a,-2)>=6 AND z<100 OR Ref(downtrend_a,-1)>=6 AND z<100))); 

PlotShapes(IIf(zlrshort,shapeDigit1+ shapePositionAbove,shapeNone),colorRed,0,0,-15); 

// Famir Short 

Famir_downtrend_a=BarsSince(z<0); 

Famir_downtrend_b=BarsSince(z>0); 

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) AND C<Lsma25; 

Famirshort=  Famir_barsfromline_short<10 AND Famirhook_short AND (Famir_downtrend_a>=6 OR 

(Famir_downtrend_b<6 AND (Ref(Famir_downtrend_a,-6)>=6 OR Ref(Famir_downtrend_a,-5)>=6 OR Ref(Famir_downtrend_a,-4)>=6 OR 

Ref(Famir_downtrend_a,-3)>=6 OR Ref(Famir_downtrend_a,-2)>=6 OR Ref(Famir_downtrend_a,-1)>=6))) AND C<LSMA25; 

PlotShapes(IIf(famirShort,shapeDigit2+ shapePositionAbove,shapeNone),colorRed,0,0,-15); 

// Famir Long 

Famir_uptrend_a=BarsSince(z<0); 

Famir_uptrend_b=BarsSince(z>0); 

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) AND C>Lsma25; 

Famirlong= Famir_barsfromline_long<10 AND Famirhook_long AND (Famir_uptrend_a<6 OR 

(Famir_uptrend_b>=6 AND(Ref(Famir_uptrend_a,-6)<6 OR Ref(Famir_uptrend_a,-5)<6 OR Ref(Famir_uptrend_a,-4)<6 OR Ref(Famir_uptrend_a,-3)<6 OR 

Ref(Famir_uptrend_a,-3)<6 OR Ref(Famir_uptrend_a,-2)<6 OR Ref(Famir_uptrend_a,-1)<6))) AND C>LSMA25; 

PlotShapes(IIf(famirlong,shapeDigit2,shapeNone),colorLime,0,0,-15); 

// HFE 

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

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

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

PlotShapes(IIf(Ref(z,-1)>200 AND z<200,shapeDownTriangle,shapeNone),IIf(Ref(z,-1)>200 AND z<200,colorYellow,shapeNone),0,200,-20); 

PlotShapes(IIf(Ref(z,-1)<-200 AND z>-200,shapeUpTriangle,shapeNone),IIf(Ref(z,-1)<-200 AND z>-200,colorYellow,shapeNone),0,-200,-20); 

// VT Long 

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

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= vt_barsfromline_long<=11 AND (Ref(HHV(z,vt_barsfromline_long),-1)<0 OR HHV(z,vt_barsfromline_long)<=0) AND vthook_long AND C>Lsma25 AND Ref(swinghibars>=2,-1) AND z>-100; 

PlotShapes(IIf(vtlong,shapeDigit3,shapeNone),colorLime,0,Min(z,0),-45); 

// 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= vt_barsfromline_short<=11 AND (Ref(LLV(z,vt_barsfromline_short),-1)>0 OR LLV(z,vt_barsfromline_short)>0) AND vthook_short AND C<Lsma25 AND Ref(swinglowbars>=2,-1) AND z<100; 

PlotShapes(IIf(vtshort,shapeDigit3+ shapePositionAbove,shapeNone),colorRed,0,Max(z,0),-45); 

// GB 100 Long 

uptrend_a=BarsSince(z<0); 

uptrend_b=BarsSince(z>0); 

Linex_longGB=Ref(z,-1)>100 AND z<100; 

barsfromline_longGB=BarsSince(Linex_longGB); 

CCIhook_longGB= Ref(z,-1)<-100 AND z>-100; 

GB100long= barsfromline_longGB<20 AND angle_EMA34>=5 AND CCIhook_longGB AND (uptrend_b<6 AND(Ref(uptrend_a,-6)>=6 OR Ref(uptrend_a,-5)>=6 OR Ref(uptrend_a,-4)>=6 OR Ref(uptrend_a,-3)>=6 OR 

Ref(uptrend_a,-2)>=6 OR Ref(uptrend_a,-1)>=6)); 

PlotShapes(IIf(GB100long,shapeDigit4,shapeNone),colorLime,0,0,-60); 

// GB100 Short 

downtrend_a=BarsSince(z>0); 

downtrend_b=BarsSince(z<0); 

Linex_shortGB=Ref(z,-1)<-100 AND z>-100; 

barsfromline_shortGB=BarsSince(Linex_shortGB); 

CCIhook_shortGB=Ref(z,-1)>100 AND z<100; 

GB100short= barsfromline_shortGB<20 AND angle_EMA34<=-5 AND CCIhook_shortGB AND 

(downtrend_b<6 AND (Ref(downtrend_a,-6)>=6 OR Ref(downtrend_a,-5)>=6 OR Ref(downtrend_a,-4)>=6 OR 

Ref(downtrend_a,-3)>=6 OR Ref(downtrend_a,-2)>=6 OR Ref(downtrend_a,-1)>=6)); 

PlotShapes(IIf(GB100short,shapeDigit4+ shapePositionAbove,shapeNone),colorRed,0,0,-60); 

// MR Long 

MRuptrend_a=BarsSince(z<0); 

MRuptrend_b=BarsSince(z>0); 

MRLinex_long=Ref(z,-1)>100 AND z<100; 

MRbarsfromline_long=BarsSince(MRLinex_long); 

MRCCIhook_long=z>Ref(z,-1) AND Ref(z,-1)<=Ref(z,-2) AND Ref(z,-2)<Ref(z,-3) AND z>-100 AND z<100; 

MRlong= Ref(z,-1)<=0 AND MRbarsfromline_long<10 AND MRCCIhook_long AND (MRuptrend_a>=6 AND z>-100 OR 

(MRuptrend_b<6 AND LLV(z,MRuptrend_b)>-100 AND z>-100 AND (Ref(MRuptrend_a,-6)>=6 AND z>-100 OR Ref(MRuptrend_a,-5)>=6 AND z>-100 OR Ref(MRuptrend_a,-4)>=6 AND z>-100 OR Ref(MRuptrend_a,-3)>=6 AND z>-100 OR 

Ref(MRuptrend_a,-2)>=6 AND z>-100 OR Ref(MRuptrend_a,-1)>=6 AND z>100))); 

PlotShapes(IIf(MRlong,shapeDigit5,shapeNone),colorLime,0,0,-50); 

// MR Short 

MRdowntrend_a=BarsSince(z>0); 

MRdowntrend_b=BarsSince(z<0); 

MRLinex_short=Ref(z,-1)<=-100 AND z>=-100; 

MRbarsfromline_short=BarsSince(MRLinex_short); 

MRCCIhook_short=z<Ref(z,-1) AND Ref(z,-1)>=Ref(z,-2) AND Ref(z,-2)>Ref(z,-3) AND z<100 AND z>-100; 

MRshort= Ref(z,-1)>=0 AND MRbarsfromline_short<10 AND MRCCIhook_short AND (MRdowntrend_a>=6 AND z<100 OR 

(MRdowntrend_b<6 AND HHV(z,MRdowntrend_b)<100 AND z<100 AND (Ref(MRdowntrend_a,-6)>=6 AND z<100 OR Ref(MRdowntrend_a,-5)>=6 AND z<100 OR Ref(MRdowntrend_a,-4)>=6 AND z<100 OR 

Ref(MRdowntrend_a,-3)>=6 AND z<100 OR Ref(MRdowntrend_a,-2)>=6 AND z<100 OR Ref(MRdowntrend_a,-1)>=6 AND z<100))); 

PlotShapes(IIf(MRshort,shapeDigit5+ shapePositionAbove,shapeNone),colorRed,0,0,-50);

// Columns for exploration 

Filter =(zlrlong OR famirlong OR Vtlong OR gb100long OR mrlong  OR hfe OR zlrshort OR famirshort OR vtshort OR gb100short OR mrlong OR (A OR bars)) AND 1 ; 

Buy = (zlrlong OR famirlong OR Vtlong OR gb100long);// AND MarketHours; 

Sell= (z<Ref(z,-1) AND Ref(z,-1)<Ref(z,-2) AND C<O);// OR MArketClose; ; 

Short = (zlrshort OR famirshort OR Vtshort OR gb100short); //AND MarketHours; 

Cover = (z>Ref(z,-1) AND Ref(z,-1)>Ref(z,-2) AND C>O);// OR MArketClose; 

AddColumn( IIf(zlrlong,1,IIf(zlrshort,-1,0)) ,"ZLR",1.0,colorWhite,IIf(zlrlong,colorGreen,IIf(zlrshort,colorRed,colorBlack))); 

AddColumn(IIf(famirlong,1,IIf(famirShort,-1,0)),"Famir",1.0,colorWhite,IIf(famirlong,colorGreen,IIf(famirShort,colorRed,colorBlack))); 

AddColumn(IIf(vtlong,1,IIf(vtShort,-1,0)),"Vegas",1.0,colorWhite,IIf(vtlong,colorGreen,IIf(vtShort,colorRed,colorBlack))); 

AddColumn(IIf(gb100long,1,IIf(gb100Short,-1,0)),"GB100",1.0,colorWhite,IIf(gb100long,colorGreen,IIf(gb100Short,colorRed,colorBlack))); 

AddColumn( IIf(mrlong,1,IIf(mrShort,-1,0)) ,"MR",1.0,colorWhite,IIf(mrlong,colorGreen,IIf(mrShort,colorRed,colorBlack))); 

AddColumn(IIf(hfelong,1,IIf(hfeshort,-1,0)),"HFE",1.0,colorWhite,IIf(hfelong,colorGreen,IIf(hfeshort,colorRed,colorBlack))); 

AddColumn(IIf(A OR bars,1,IIf(A OR bars,-1,0)),"Choppy",1.0,colorWhite,IIf(A OR bars,colorDarkYellow,IIf(A OR bars,colorDarkYellow,colorBlack))); 

//Plot Sell Arrows 

//Sell1=ExRem(Sell,Buy); 

//Cover1=ExRem(Cover,Short); 

//PlotShapes(IIf(Sell1,shapeDownArrow,shapeNone),colorLime,0,200,10); 

//PlotShapes(IIf(Cover1,shapeDownArrow,shapeNone),colorRed,0,200,10); 

//Signal Title 

Signaltitle= WriteIf(zlrlong,EncodeColor(colorYellow) + "ZLR ", 

WriteIf(zlrshort,EncodeColor(colorYellow) + "ZLR ", WriteIf(MRShort,EncodeColor(colorYellow) + "MR ", 

WriteIf(MRlong,EncodeColor(colorYellow) + "MR ", 

WriteIf(Famirshort,EncodeColor(colorYellow) + "FAMIR ", 

WriteIf(Famirlong,EncodeColor(colorYellow) + "FAMIR ",WriteIf(HFE,EncodeColor(colorYellow) + "HFE ",WriteIf(VTlong,EncodeColor(colorYellow) + "VT ", 

WriteIf(VTshort,EncodeColor(colorYellow) + "VT ",WriteIf(GB100long,EncodeColor(colorYellow) + "GB100 ", 

WriteIf(Gb100short,EncodeColor(colorYellow) + "GB100 "," "))))))))))); 

//Choppy Title 

ChoppyTitle= WriteIf(A,EncodeColor(colorYellow) + "CHOPPY",WriteIf(bars,EncodeColor(colorYellow) + "CHOPPY","")); 

//Exit Title 

//Exittitle=WriteIf(Sell1,EncodeColor(colorLime) + "MLAY EXIT LONG",WriteIf(Cover1,EncodeColor(colorRed) + "MPLAY EXIT SHORT","")); 

//Distance from EMA34

Ctoema=round(C-EMA34);

Ctitle= WriteIf(Ctoema>0," points above EMA,",WriteIf(Ctoema<0," points below EMA,"," on EMA,"));

//Number of trending bars

anglelimit= ( angle_ema34<5 AND angle_ema34>-5)  OR (angle_ema34<5 AND angle_ema34>-5);

angletitle= BarsSince(anglelimit);

//Title 

Title = "" + Name() + ", " + Interval(2) + ", " + Date() + "\n" + 

EncodeColor(colorSkyblue) + "CCI 14 = " + round(z) + EncodeColor(colorWhite) + ", " + EncodeColor(colorLightOrange) + 

"CCI 6 = " + round(z6) + EncodeColor(colorWhite) + ", " + 

TitleTimeRem + EncodeColor(colorWhite) + 

TitleAngleEMA34 + EncodeColor(colorWhite) + ", " + TitleAngleLSMA25 + 

TitleTrending + "\n" + EncodeColor(colorWhite)+"Signal = "+Signaltitle + ChoppyTitle; //+ EncodeColor(colorWhite) + Ctoema + Ctitle +  EncodeColor(colorWhite) + " " + angletitle + " " + "bars trending, " + "  " + " "+Exittitle; 

//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; 

PlotShapes(IIf(MplayExitLong,shapeSmallCircle,shapeNone),colorGreen,0,200,-10); 

PlotShapes(IIf(MplayExitShort,shapeSmallCircle,shapeNone),colorRed,0,200,-10); 
_SECTION_END();

Afl for the floor roof.
Code:
_SECTION_BEGIN("Floor Top");

hcl=(O+H+L+C)/4;
Ho=AMA(Ref(hcl,-1),0.5);
HH=Max(H,Max(hcl,Ho));
HL=Min(L,Min(hcl,Ho));

trader = (hcl-Ho);
VarRedLine = WMA(trader,5); 
VarBlueLine = MA(trader,8);
Per = Param("MA Periods",15,3,50,1);
//Plot(trader,"trader",colorDarkRed);
thick=Param("thickness",0.5,0.01,5,0.01);
thick1=Param("ribbon thickness",0.5,0.01,50,0.01);

//P = ParamField("Price field",-1);
HDCPeriods = per;
//Width = Param("Width", 2, 0, 10, 0.05 );
//Color = ParamColor("Color", colorCycle );
//Style = ParamStyle("Style");
bbbot = BBandBot( trader, HDCPeriods, 2 );
bbtop = BBandTop( trader, HDCPeriods, 2 );
Plot( bbtop, "Roof" , colorWhite, styleThick ); 
Plot( bbbot, "Floor" , colorWhite, styleThick ); 

VarAMA = Param("varAMA",0.1,0,2,0.01);
hcl2=(H+L+C)/3;
Ho2=AMA(Ref(hcl2,-1),VarAMA);
HH2=Max(H,Max(hcl2,Ho2));
HL2=Min(L,Min(hcl2,Ho2));
trader2 = hcl2-Ho2;

//Plot(trader2,"trader2",colorGreen);
PlotOHLC(trader2,trader2+thick,trader2-thick,trader2,"trader",colorBlue,styleCloud);
PlotOHLC(trader,trader+thick,trader-thick,trader,"investor",colorRed,styleCloud);

//PlotOHLC(bbbot, bbbot ,IIf(bbbot < trader2,bbbot,trader2),bbbot,"",colorRed,styleCloud);
//PlotOHLC(bbtop, IIf(bbtop > trader2,bbtop,trader2),bbtop,bbtop,"",colorBrightGreen,styleCloud);

//Plot(0,"0",colorDarkGrey,styleLine);
Color_rib = IIf(trader2 > bbtop, colorDarkGrey, IIf(trader2 < bbbot, colorDarkGrey,IIf(trader2 > Ref(trader2,-1), colorBrightGreen,colorDarkRed)));
PlotOHLC(0,thick1,-thick1,0,"",color_rib,styleCloud);

_SECTION_END();
 
Last edited:

linkon7

Well-Known Member
#3


The price panel has a few useful information :

1. Bars are coloured based on average of last 2 cci point.

2. The pivot, R1, R3, S1 and S3 are basically derived from 30 min TF. Each of them act as the perfect stop loss depending on the situation. S3 / R3 are normally the breakdown / breakout points. R1 and S1 makes good trailing SL... Pivot is the point of control.

3. The BB(20,2.25) represents the reversal point, incase market is flat. BB(20,1) and BB(20,2.25) together makes a channel. (coloured in grey).

The Bull channel consist of BBtop2.25 and bbtop1,
No man's land is bbtop1 to bbbot1 and
bear channel is bbbottom1 to bbbotom2.25.

4. The slope of these channel is very important. If the slope is more that 30 degrees, trend is very strong. Counter trend trades will almost always end in a loss. Price have to break out of the channel for a confirmed end of the trend.


5. Another way of using the band, is to join the recent lows and extend it to the right. That line, if broken is the Breakout / breakdown point...We do this on a lower TF, preferably 2 min...!
 
Last edited:

linkon7

Well-Known Member
#4
Golden Rules That results in loss, if broken:

Golden Rules That results in loss, if broken:

1. Trade only when price is between “H3 and H4” or “L3 and L4” only

2. Exit when system says to exit, no room for hope. Trade what you see, not what you think.

3. Not all trades will be profitable. Accept that. End of the day, if system is followed like a book, profit is assured. Worst case, end of the week, profit is assured.

4. When in doubt, don’t take the trade or if already in the trade, exit immediately.

5. Never wait for SL to hit or find reasons to carry a bad trade. If system says exit, exit.

6. Objective is ”NO THINKING, only REACTING”. When certain conditions are fulfilled, we react. What we think, doesn’t matter. Charts will tell us when to enter and when to exit.

7. We won’t short above H4 and we won’t buy below L4. There is a high probability that once price is broken out of the cam zone, it’ll continue. Dips are to be bought and rally needs to be shorted. Catching a falling dagger has been the root cause of all major losses.

8. Enter only after the SL is clear. Place the SL order immediately after ur trade gets initiated. Never lower the SL…if we are long. And never raise SL if we are short. Let it hit SL… we can always re-enter.


Two conditions of the market are :
1. Flat market : trader (blue line) in the floor roof indicator is between the white band
2. Trending market : trader (blue line) in the floor roof indicator is has broken away from the bands.

For each condition we have a different set of profit target and entry / exit rules.


For flat market : traders( blue line) is oscilating between the white band.


SHORT Entry rules:

1. Price has to pierce the BBtop20-2.25 band.
2. After piercing the band, price needs to close inside the BBtop20-2.25 band.
3. This bar becomes our trigger bar and the break of the low of this bar is our entry into the short side with the high of this bar as the stop loss..
4. CCI-14 heading South
3. traders Falling.

Stop loss :
1. High of the trigger bar or
2. BBtop20-2.25 ( whichever is higher).

Target :
BBbot20-2.25

What to look for ?
Price slowly has to move away from the bull channel into the no mans land and then should have enough strength to enter the bear channel. If price fails to move into the bear channel, and CCI starts moving up, exit positions immediately without waiting for SL to hit. traders line coming up, is also a indication to exit positions.

LONG Entry rules:
1. Price has to pierce the BBbot20-2.25 band and then make a close inside the band. this bar then becomes the trigger bar.
2. CCI has to make a hook and come up.
3. traders rising.

Stop loss :
1. Low of the trigger bar or
2. BBBot20-2.25 ( whichever is Lower).

Target : BBtop20-2.25

What to look for ?
Price slowly has to move up from the bear channel into the no mans land and then should have enough strength to enter the bull channel. If price fails to move into the bull channel, and CCI starts falling, exit positions immediately without waiting for SL to hit. traders line going down, is also a indication to exit positions.


For trending market : When traders has broken the white bands

Long Entry rules:
1. The High of the piercing bar is the entry trigger. Price has to have enough juice to take it out and go higher. CCI should be up and making higher highs and higher lows. trader line has broken the roof(upper white line) and is up.
2. SL : BBbot20-1 or low of the piercing bar if it’s a wide bar (whichever is lower)
3. Target: we need to exit 50% at the first CCI hook and trail the remaining with BBtop20-1. Only if in sufficient profit use BBbot20-1 as SL
4. Exit immediately if traders has entered the upper white band (roof) from above...
5. If price is above H4, then never look for short trades.

short Entry rules:
1. The low of the piercing bar is the entry trigger. Price has to have enough juice to take it out and go lower. CCI should be down and making lower highs and lower lows. trader line has broken the floor(lower white line) and is falling.
2. SL : BBtop20-1 or high of the piercing bar if it’s a wide bar (whichever is higher)
3. Target: we need to exit 50% at the first CCI hook and trail the remaining with BBbot20-1. Only if in sufficient profit use BBtop20-1 as SL
4. Exit immediately if traders has entered the lower white band (floor). from below...
5. If price is below L4, then never look for long trades.
 
Last edited:

linkon7

Well-Known Member
#5
Entry Long :

FlatBB rule: When “BBtop (20,2.25) and BBtop(20,1)” is flat


Wait for : Price to pierce the BB and CCI to hook and slope upwards.

SL : Low of the bar that pierced the BB





Angle rule: When “BBtop (20,2.25) and BBtop(20,1)” is sloping upwards (angle greater than 30 degrees)


Wait for : CCI to come down and make a hook and turn upwards. The high of the piercing bar is the entry trigger on the long side.

SL : BB of the opposite BBbot (20,1)



Divergence Rule: When “BBtop (20,2.25) and BBtop(20,1)” is sloping downwards (angle greater than 30 degrees)

Wait for : the slope to flatten out and watch out for divergence in CCI.

SL : Lowest point in CCI acts at the SL (indicator based SL)

Note : Never attempt a counter trend trade (without divergence) as it will give very little profit and will hit SL most of the time.
 
Last edited:

linkon7

Well-Known Member
#6
Entry Short :

FlatBB Rule : When “BBtop (20,2.25) and BBtop(20,1)” is flat

Wait for : Price to pierce the BB and CCI to hook and slope downwards.

SL : High of the bar that pierced the BB or the BBtop2.25 (which ever is higher)



Angle Rule: When “BBtop (20,2.25) and BBtop(20,1)” is sloping downwards (angle greater than 30 degrees)

Wait for : CCI to come up and make a hook and turn downwards.

SL : BB of the opposite BBbot (20,1)



Divergence Rule: When “BBtop (20,2.25) and BBtop(20,1)” is sloping upwards (angle greater than 30 degrees)

Wait for : the slope to flatten out and watch out for divergence in CCI.

SL : highest point in CCI acts at the SL (indicator based SL)

Note : Never attempt a counter trend trade as it will give very little profit and will hit SL most of the time.
 
Last edited:

linkon7

Well-Known Member
#7
Mind set : Why cam levels... and how I intend to play it...?

Lets look at why cam levels work.

Say a stock made a high of 200, a low of 100 and finally closed at 150. Bulls were ready to buy it even at 200, bears were willing to sell it as low as 100 and the fight between them ended bang in the middle, 150.The battle between the bulls vrs the bears is evenly matched for the next day.

conventional pivot will tell you that the pivot (high + low + close divided by 3) is at 150. Above 150 we can buy as bulls are in charge and below 150 bears will take over the match. Next day if the stock opens between 155-160, we can go long since most indicators will give us a buy signal, but the probability of success is 55-60%. However if the bears take charge and bring it to 145-140 region, most of our stop loss gets triggered, we might switch direction and decide to go short. probability of success still remains at 55-60%. stocks always has a tendency to revert back to the mean (point of control-POC-value area). Any trade initiated around this area has a far higher chance of a whipsaw and hitting stoploss both ways.

Cams help us by avoiding trades in this region. The levels generated for our example are :
H4 : 205 --> break out in the up side, go long wt SL at H3
H3 : 178 --> Strongest resistance, Go short wt SL at H4
L3 : 123 --> Strongest support, Go long wt SL at L4
L4 : 95 --> Breakdown, Go short wt SL at L3

Trades are initiated only if price comes between the H3 and H4 level or between the L3 and L4 level. H3 is treated as strong resistance and short trade at this level has a 78% probability of success.

We reverse at H4 or L4. At 205 or 95, balance between bulls and the bears is totally one sided with one group with good profit and willing to add more, while the other group is at a loss and is looking to book losses adding to the pressure.

Cam levels can be played by themselves but its always advisable to add your fav setup to compliment the decision making process.

I follow Woodies CCI intraday panel and DB-BB and take trades based on cam levels. This has helped me eliminate whipsaws to a great extent and improve my average win to average loss ratio.
 
Last edited:

linkon7

Well-Known Member
#8
code for fabo retracement...

Code:
_SECTION_BEGIN("Fib_Levels");
/*---------------------------------------------------
   Automatic Fib Levels
   Aron Pipa, December, 11, 2005
--------------------------------------------------------*/
SetChartOptions(0,chartShowArrows|chartShowDates);
Plot(MA(Close,3),"",IIf(MA(C,3) > Ref(MA(C,3),-1),colorGreen,colorRed),styleThick);
Plot(C,"", IIf(PDI(7) > MDI(7),colorGreen,colorRed) , styleCandle);

//_SECTION_BEGIN("fib");
// Get values for fib levels

StartBar=SelectedValue(BarIndex());
FinishBar = EndValue( BarIndex() );
i = startbar;
period = FinishBar - StartBar;

Lo =LLV(L,period);
Hi = HHV(H,period);
Line0 = 0;
Line1 = 0;
Line2 = 0;
Line3 = 0;
Line4= 0;
Line5= 0;
Line6= 0;
Line100 = 0;

for( i = startbar; i < finishbar; i++ )
{
if(EndValue(C)<SelectedValue(C))
{
Line0  = EndValue(Lo);
Line100 = EndValue(Hi);
Line1 = Line0 + abs(Line100-Line0)*0.236;
Line2 = Line0 + abs(Line100-Line0)*0.382;
Line3 = Line0 + abs(Line100-Line0)*0.5;
Line4 = Line0 + abs(Line100-Line0)*0.618;
Line5 = Line0 - abs(Line100-Line0)*0.236;
Line6 = Line0 - abs(Line100-Line0)*0.382;

}
else
{
Line100  = EndValue(Lo);
Line0 = EndValue(Hi);
Line1 =Line0 - abs(Line100-Line0)*0.236;
Line2 = Line0 - abs(Line100-Line0)*0.382;
Line3 = Line0 - abs(Line100-Line0)*0.5;
Line4 = Line0 - abs(Line100-Line0)*0.618;
Line5 = Line0 + abs(Line100-Line0)*0.236;
Line6 = Line0 + abs(Line100-Line0)*0.382;
}
}

// external fib lines begining fom selecetdbarindex()
fib0= LineArray(startbar, Line0, finishbar, Line0, 0, 1);
fib100 = LineArray(startbar, Line100, finishbar, Line100, 0, 1);

// depth of middle lines
n= round((finishbar-startbar)/2);

// middle lines
fib1= LineArray((finishbar-n), Line1, finishbar, Line1, 0, 1);
fib2= LineArray((finishbar-n), Line2, finishbar, Line2, 0, 1);
fib3= LineArray((finishbar-n), Line3, finishbar, Line3, 0, 1);
fib4= LineArray((finishbar-n), Line4, finishbar, Line4, 0, 1);
fib5= LineArray((finishbar-n), Line5, finishbar, Line5, 0, 1);
fib6= LineArray((finishbar-n), Line6, finishbar, Line6, 0, 1);

Plot(fib0,"", colorGreen);
Plot(fib100,"", colorRed);
Plot(fib1,"", colorYellow,styleDashed);
Plot(fib2,"", colorPink);
Plot(fib3,"", colorWhite);
Plot(fib4,"", colorLightBlue);
//Plot(fib5,"", colorLightGrey);
//Plot(fib6,"", colorLightGrey);

_SECTION_END();



_SECTION_BEGIN("Fibo for all bars");

TimeFrameSet( inDaily ); 
DH=Ref(H,-1); 
DL=Ref(L,-1);
DC=Ref(C,-1);


pd = (O+ DH+ DL + DC )/4;
sd1 = (2*pd)-DH;
sd2 = pd -(DH - DL);
sd3 = Sd1 - (DH-DL); 
rd1 = (2*pd)-DL;
rd2 = pd +(DH -DL);
rd3 = rd1 +(DH-DL);

H4 =  (dH - dL) * 1.1 / 2 + dC;
H3 = (dH - dL) * 1.1 / 4 + dC;
h2 = (dH - dL) * 1.1 / 6 + dC;
H1 = (dH - dL) * 1.1 / 12 + dC;
L1 = dC - (dH - dL) * 1.1 / 12;
L2 = dC - (dH - dL) * 1.1 / 6;
L3 = dC - (dH - dL) * 1.1 / 4;
L4 = dC - (dH - dL) * 1.1 / 2 ;



//Plot (pd,"Pivot",colorBlue,styleDots);
//Plot (rd1," R1 ",35,styleDots);
//Plot (rd2," R2 ",35,styleDots);
//Plot (rd3," R3 ",35,styleDots);

//Plot (sd1," S1 ",4,styleDots);
//Plot (Sd2," S2 ",4,styleDots);
//Plot (Sd3," S3 ",4,8+16);
/*
style = IIf(ParamList("Chart style", "styleCandle|styleBar")=="styleCandle",64,128+4);
Plot (C,Date ()+" close",1,style); //ENABLE THIS TO HAVE CANDLES AS WELL
*/
TimeFrameRestore();

tgt_up = H4*5/1000 + H4;
tgt_dn = L4-L4*5/1000;
Title = EncodeColor(colorWhite)+ "LINKON'S PIVOT TRADING SYSTEM" + " - " +  Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
 "  - " + Date() +" - "
//+ WriteIf(Col_action==colorGreen, EncodeColor(colorGreen)+"stay LONG","")+ WriteIf(Col_action==colorRed, EncodeColor(colorRed)+"stay SHORT","")+  WriteIf(Col_action==colorBlack, EncodeColor(colorYellow)+"No Trend","")+"\n"
+ "Vol= "+ WriteVal(V) +WriteIf ( V > MA(V,26) ,EncodeColor(colorGreen)+"  UP "+ (V/MA(V,26))*100 + " %", EncodeColor(colorRed)+"  DOWN "+ (V/MA(V,26))*100 + " %")
+ EncodeColor(colorGreen)+   "\n H4 : "+ EncodeColor(colorWhite)+H4+ EncodeColor(colorGreen)+   "    tgt : "+ EncodeColor(colorWhite)+tgt_up 
+ EncodeColor(colorGreen)+   "\n H3 : "+ EncodeColor(colorWhite)+H3 
+ EncodeColor(colorGreen)+   "\n H2 : "+ EncodeColor(colorWhite)+H2 
+ EncodeColor(colorGreen)+   "\n H1 : "+ EncodeColor(colorWhite)+H1+ EncodeColor(colorGreen)+   "`            Hi: "+ EncodeColor(colorWhite)+H
+ EncodeColor(colorBlue)+   "\n Pivot : "+ EncodeColor(colorWhite)+pd + EncodeColor(colorYellow)+   "`   Op: "+ EncodeColor(colorWhite)+O+ EncodeColor(colorAqua)+   "Cl: "+ EncodeColor(colorBrightGreen)+C
+ EncodeColor(colorRed)+   "\n L1 : "+ EncodeColor(colorWhite)+L1+ EncodeColor(colorRed)+   "`            Lo: "+ EncodeColor(colorWhite)+L
+ EncodeColor(colorRed)+   "\n L2 : "+ EncodeColor(colorWhite)+L2
+ EncodeColor(colorRed)+   "\n L3 : "+ EncodeColor(colorWhite)+L3
+ EncodeColor(colorRed)+   "\n L4 : "+ EncodeColor(colorWhite)+L4+ EncodeColor(colorRed)+      "     tgt : "+ EncodeColor(colorWhite)+tgt_dn
;

_SECTION_END();

Plot(6, "", IIf(PDI(7) > MDI(7) AND PDI(7) > 30,colorGreen,IIf (MDI(7) > PDI(7) AND MDI(7) > 30,colorRed,colorYellow)), styleOwnScale| styleArea|styleNoLabel,-0.5,100);



Theory is, price never moves in a straight line. it retraces and the expands the range. We use this afl to find the possible retracement point. Normally, price retracement of 23.6 % (yellow dotted line) is seen as a strong trend. retracement of 38.2% (pink line) is normal and signifies continuation of the trend. retracement of 50% (white) is relatively a trend changer. 61.8% retracement ( light blue) is normally a reversal if price doesnt go back to 38.2%.

We use this to pre-determine levels where we go short / long. Or place SL. Sl at 61.2 % is treated as very safe. Sl at 50% is safe. sl at 38.2% is aggressive and 23.6% is very aggressive.

range expansion of 132.8%, 161.8%, 261% is the possible target.


I use 30 min pivots (R1/S1) and / or fabo 38.2% as my entry point for buying the dips or selling the rally....!
 
Last edited:

linkon7

Well-Known Member
#9
This version has the Mplay Exit Indicator in it. The MPLAY exit is a CCI hook to the oposite direction followed by another with the price closing in the opposite direction of the trade. I have coded the MPLAY Indicator with the CCI panel. It is a series of green and red circles just below the +200 line. The nearest green circle that appears after a pattern (any pattern, not just the coded ones) is the exit for a long position. The nearest red circle is the exit after a short pattern. Ignore all the ones in between. The circles appear after every and any occurance of an MPLAY Exit, regardless if a pattern has appeared or not. Just use the nearest applicable circle to exit a pattern entered.



The EMA-34 angle is a very important indicator of the strength of the trend.
Angle of -30 to +30 is generally considered flat.
Angle of "30 to 45" or "-30 to -45" is trending.
Angle of "45 to 60" or "-45 to -60" is strong trend.
Angle excess of 60 or -60 is a sign of forced short / long covering.
 
Last edited:

linkon7

Well-Known Member
#10
floor-Roof...!

reserved...!
 
Last edited:
Thread starter Similar threads Forum Replies Date
linkon7 Options 170
linkon7 AmiBroker 129
VJAY Options 10
linkon7 Options 36
linkon7 Options 17

Similar threads