Hello Raghuveer, amitrandive and everyone who is interested in this concept
Lets start Analyzing, ST concept with this formula , will Take TD pivot point afterwords
// E.M.Pottasch
SetBarsRequired(sbrAll,sbrAll);
x=BarIndex();
Lx=LastValue(x);
rightStrength=Param("Fractal Pivot Right side Strength",3,0,50,1);
leftStrength=Param("Fractal Pivot Left side Strength",4,0,50,1);
pk=H>Ref(HHV(H,leftStrength),-1) AND Ref(HHV(H,rightStrength),
rightStrength)<=H;
tr=L<Ref(LLV(L,leftStrength),-1) AND Ref(LLV(L,rightStrength),
rightStrength)>=L;
PHigh = PK;
PHighPrice0 = ValueWhen(PHigh,H);
PHighPrice1 = IIf(PHighPrice0 AND BarsSince(PHigh) > rightStrength,PHighPrice0,Null);
PHighPrice2 = IIf(PHighPrice0 AND BarsSince(PHigh) <= rightStrength,PHighPrice0,Null);
PLow = TR;
PLowPrice0 = ValueWhen(PLow,L);
PLowPrice1 = IIf(PLowPrice0 AND BarsSince(Plow) > rightStrength,PLowPrice0,Null);
PLowPrice2 = IIf(PLowPrice0 AND BarsSince(Plow) <= rightStrength,PLowPrice0,Null);
//pk=ExRem(pk,tr);
//tr=ExRem(tr,pk);
px0=ValueWhen(pk,x,0); tx0=ValueWhen(tr,x,0);
px1=ValueWhen(pk,x,1); tx1=ValueWhen(tr,x,1);
px2=ValueWhen(pk,x,2); tx2=ValueWhen(tr,x,2);
ph0=ValueWhen(pk,H,0); tl0=ValueWhen(tr,L,0);
ph1=ValueWhen(pk,H,1); tl1=ValueWhen(tr,L,1);
ph2=ValueWhen(pk,H,2); tl2=ValueWhen(tr,L,2);
ll=tr AND tl1<tl2;
hl=tr AND tl1>tl2;
hh=pk AND ph1>ph2;
lh=pk AND ph1<ph2;
dt=pk AND ph1==ph2;
db=tr AND tl1==tl2;
ll_h=IIf(ll,1,0);
hl_h=IIf(hl,2,0);
hh_h=IIf(hh,3,0);
lh_h=IIf(lh,4,0);
dt_h=IIf(dt,5,0);
db_h=IIf(db,6,0);
combi=ll_h+hl_h+lh_h+hh_h;
t0=ValueWhen(combi,combi,0);
t1=ValueWhen(combi,combi,1);
t2=ValueWhen(combi,combi,2);
t3=ValueWhen(combi,combi,3);
t4=ValueWhen(combi,combi,4);
GraphXSpace = 5;
SetChartOptions(0, chartShowDates);
Plot(C,"\nLast",colorWhite,64);
PlotShapes(shapeSmallCircle*tr,IIf(Lx-ValueWhen(tr,x)>=rightStrength,ColorRGB(0,100,0),colorWhite),0,L,-10);
PlotShapes(shapeSmallCircle*pk,IIf(Lx-ValueWhen(pk,x)>=rightStrength,ColorRGB(255,0,0),colorWhite),0,H,10);
Plot(PHighPrice1,"\nPHighPrice",colorOrange,styleLine);
Plot(PHighPrice2,"",colorOrange,styleDots | styleNoLine);
Plot(PLowPrice1,"\nPLowPrice",colorBrightGreen,styleLine);
Plot(PLowPrice2,"",colorBrightGreen,styleDots | styleNoLine);
PH =Phigh- Ref(Phigh,-1) != 0;
PHprice = ValueWhen(PH, H,1);
Pvalid = C > ValueWhen(PH, PHighPrice2,1 ) ;
Pvalid = ExRem(Pvalid, PH);
Buy=Cover=Pvalid ;
PL= Plow - Ref(Plow,-1) != 0;
PLPrice = ValueWhen(PL,L,1);
TValid = C < ValueWhen(PL, PLowPrice2,1) ;
TValid = ExRem(TValid, PL);
Sell=Short= TValid ;
Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
Short=ExRem(Short,Cover);
Cover=ExRem(Cover,Short);
PlotShapes(IIf(Buy , shapeSmallUpTriangle, shapeNone) ,colorGreen, 0,L,-30);
PlotShapes(IIf(Short , shapeSmallDownTriangle, shapeNone) ,colorRed, 0,H,-30);
PlotShapes(IIf( Cover, shapeHollowSmallUpTriangle, shapeNone) ,colorPink, 0,L,-25);
PlotShapes(IIf( Sell, shapeHollowSmallDownTriangle, shapeNone) ,colorOrange, 0,H,-25);
Title = Name() + " # " +Date() +
"\nRight Bars: " + rightStrength +
"\nLeft Bars : " + leftStrength;
abcdy_up=32;
abcdy_dn=20;
function GetVisibleBarCount()
{
lvb=Status("lastvisiblebar");
fvb=Status("firstvisiblebar");
return Min(lvb-fvb,BarCount-fvb);
}
function GfxConvertPixelsToBarX(Pixels)
{
lvb=Status("lastvisiblebar");
fvb=Status("firstvisiblebar");
pxchartleft=Status("pxchartleft");
pxchartwidth=Status("pxchartwidth");
fac=pxchartwidth/Pixels;
bar=(lvb-fvb)/fac;
return Nz(bar);
}
function GfxConvertPixelToValueY(Pixels)
{
local Miny,Maxy,pxchartbottom,pxchartheight;
Miny=Status("axisminy");
Maxy=Status("axismaxy");
pxchartbottom=Status("pxchartbottom");
pxchartheight=Status("pxchartheight");
fac=pxchartheight/Pixels;
Value=(Maxy-Miny)/fac;
return Nz(Value);
}
function GfxConvertBarToPixelX(bar)
{
lvb=Status("lastvisiblebar");
fvb=Status("firstvisiblebar");
pxchartleft=Status("pxchartleft");
pxchartwidth=Status("pxchartwidth");
return Nz(pxchartleft+bar*pxchartwidth/(lvb-fvb+1));
}
function GfxConvertValueToPixelY(value)
{
local Miny,Maxy,pxchartbottom,pxchartheight;
Miny=Status("axisminy");
Maxy=Status("axismaxy");
pxchartbottom=Status("pxchartbottom");
pxchartheight=Status("pxchartheight");
return Nz(pxchartbottom-floor(0.5+(Value-Miny)*pxchartheight/(Maxy-Miny)));
}
AllVisibleBars=GetVisibleBarCount();
fvbx=Status("firstvisiblebar");
abcdy_up=GfxConvertPixelToValueY(abcdy_up);
abcdy_dn=GfxConvertPixelToValueY(abcdy_dn);
Labels = ParamToggle("Plot HH-LL","No|Yes" ,1);
for(i=0;i<AllVisibleBars;i++)
{ GfxSelectFont("Tahoma",8,500); GfxSetBkMode(1);
if(ll[i+fvbx]AND Labels )
{
lvix=i+fvbx;
GfxSetTextColor(colordarkYellow);GfxTextOut("LL",
GfxConvertBarToPixelX(i)-3,GfxConvertValueToPixelY(L[lvix]-abcdy_dn-3));
}
if(hl[i+fvbx] AND Labels)
{
lvix=i+fvbx;
GfxSetTextColor(colorYellow);GfxTextOut("HL",
GfxConvertBarToPixelX(i)-3,GfxConvertValueToPixelY(L[lvix]-abcdy_dn-3));
}
if(hh[i+fvbx] AND Labels)
{
lvix=i+fvbx;
GfxSetTextColor(colorYellow);GfxTextOut("HH",
GfxConvertBarToPixelX(i)-5,GfxConvertValueToPixelY(H[lvix]+abcdy_up+3));
}
if(lh[i+fvbx] AND Labels)
{
lvix=i+fvbx;
GfxSetTextColor(colordarkYellow);GfxTextOut("LH",
GfxConvertBarToPixelX(i)-5,GfxConvertValueToPixelY(H[lvix]+abcdy_up+3));
}
if(dt[i+fvbx] AND Labels)
{
lvix=i+fvbx;
GfxSetTextColor(colorOrange);GfxTextOut("DT",
GfxConvertBarToPixelX(i)-5,GfxConvertValueToPixelY(H[lvix]+abcdy_up+3));
}
if(db[i+fvbx] AND Labels)
{
lvix=i+fvbx;
GfxSetTextColor(colorwhite);GfxTextOut("DB",
GfxConvertBarToPixelX(i)-3,GfxConvertValueToPixelY(L[lvix]-abcdy_dn-3));
}
}