datamode = ParamToggle("Data Mode", "No|Yes", 0) ;
showintitle = ParamToggle("Show in Title", "No|Yes", 0) ;
showlabel = ParamToggle("Show Label", "No|Yes", 1) ;
usetf = ParamToggle("Use TF", "No|Yes", 0) ;
tf = Param("TF", 6, 1, 100000, 1) ;
isexpandLast = ParamToggle("Expand Mode", "First|Last", 1) ;
expandmode = IIf(isexpandLast, expandLast, expandFirst) ;
period = Param("Period", 30, 1, 100, 1) ;
noiseperiod = Param("Noise Period", 5, 1, 100, 1) ;
Clr = ParamColor("AMA Color", colorLightOrange) ;
ClrClose = ParamColor("AMA Close Color", colorOrange) ;
MAwidthper = Param("MA Width %", 0.005, 0, 10, 1) ;
MAwidth = SelectedValue(C) * MAwidthper /100 ;
showasband = ParamToggle("Show as band", "No|Yes", 1) ;
Onlyclose = ParamToggle("Show Only Close", "No|Yes", 0) ;
showclosebias = ParamToggle("Show Close Bias", "No|Yes", 0) ;
Closebiasht = Param("Close bias Ht", 4, 0, 100) ;
Clrbiasup = ParamColor("Color Bias Up", colorSkyblue) ;
Clrbiasdn = ParamColor("Color Bias Down", colorRose) ;
Clrbiasnone = ParamColor("Color Bias None", colorLavender) ;
Clrband = ParamColor("Color Band", colorGold) ;
bandlevel = Param("Level Band", -1, -5, 5, 1) ;
tradearr = ParamToggle("Show Trade Arrow", "No|Yes", 0) ;
triggertypepvt = ParamToggle("Trigger Type", "Bar|Pvt", 0) ;
Onbody= ParamToggle("BO style", "H-L|Body", 1) ;
datamodestyle = styleNoRescale ;
if (NOT showintitle)
datamodestyle |= styleNoTitle ;
if (NOT showlabel)
datamodestyle |= styleNoLabel ;
if (datamode)
datamodestyle = styleNoDraw|styleNoTitle|styleNoLabel|styleNoRescale ;
onlyClosestyle = 0 ;
if (Onlyclose)
OnlyClosestyle = styleNoDraw ;
tfs = tf *in1Minute ;
if (usetf)
TimeFrameSet(tfs) ;
tfma = int(Interval()/60) ;
if (usetf AND tfs >= Interval())
tfma = tf ;
strtf = NumToStr(tfma, 8.0)+"min" ;
Refo = ParamField("TF Open", 0) ;
Refh = ParamField("TF High", 1) ;
Refl = ParamField("TF Low", 2) ;
Refc = ParamField("TF Close", 3) ;
//Refbi = ParamField("BI", 4) ;
//Plot(EMA( Close, period ), "", colorRed) ;
fast = 2/(2+1);
slow = 2/(period+1);
dir=abs(Refc -Ref(Refc ,-noiseperiod ));
vol=Sum(abs(Refc -Ref(Refc,-1)),noiseperiod );
ER=dir/vol;
sc =( ER*(fast-slow)+slow)^2;
amaplotcx = AMA( Refc, sc );
dirh=abs(Refh -Ref(Refh ,-noiseperiod ));
volh=Sum(abs(Refh -Ref(Refh,-1)),noiseperiod );
ERh=dirh/volh;
sch =( ERh*(fast-slow)+slow)^2;
amaplothx = AMA( Refh, sch );
dirl=abs(Refl -Ref(Refl ,-noiseperiod ));
voll=Sum(abs(Refl -Ref(Refl,-1)),noiseperiod );
ERl=dirl/voll;
scl =( ERl*(fast-slow)+slow)^2;
amaplotlx = AMA( Refl, scl );
amaplotc = amaplotcx ;
amaploth = amaplothx ;
amaplotl = amaplotlx ;
if (usetf)
{
amaplotc = TimeFrameExpand(amaplotcx, tfs, expandmode) ;
amaploth = TimeFrameExpand(amaplothx, tfs, expandmode) ;
amaplotl = TimeFrameExpand(amaplotlx, tfs, expandmode) ;
TimeFrameRestore() ;
}
showoncrb = ParamToggle("Show On CRB", "No|Yes", 0) ;
Refo = ParamField("CRB Open", 7+0) ;
Refh = ParamField("CRB High", 7+1) ;
Refl = ParamField("CRB Low", 7+2) ;
Refc = ParamField("CRB Close", 7+3) ;
Refbi = ParamField("CRB BI", 7+4) ;
Refcrbbars = ParamField("CRB Bars", 7+5) ;
Refnbars = ParamField("TF Bars", 7+6) ;
Refdt = ParamField("CRB DT", 7+7) ;
if (showoncrb)
{
diffbars = Refnbars -Refcrbbars -1 ;
// convert to crb
Refamaploth = Ref(amaploth, -diffbars) ;
Refamaplotc = Ref(amaplotc, -diffbars) ;
Refamaplotl = Ref(amaplotl, -diffbars) ;
// RefClre = Ref(Clr, -diffbars) ;
k = 0 ;
for ( i = Crbst ; i < BarCount ; i++)
{
Refbar = Refbi[i];
Refamaploth[i] = amaploth[Refbar] ;
Refamaplotc[i] = amaplotc[Refbar] ;
Refamaplotl[i] = amaplotl[Refbar] ;
// RefClre[i] = Clr[Refbar];
k++;
}
}
else
{
Refamaploth = amaploth ;
Refamaplotc = amaplotc ;
Refamaplotl = amaplotl ;
// RefClre = Clre ;
}
Plot(Refamaplotc, strtf+"AMA close"+NumToStr(period, 1.0)+" "+ NumToStr(noiseperiod , 1.0), ClrClose, styleThick|datamodestyle) ;
Plot(Refamaploth, strtf+"AMA high"+NumToStr(period, 1.0)+" "+ NumToStr(noiseperiod , 1.0), Clr, styleThick|datamodestyle|OnlyClosestyle) ;
Plot(Refamaplotl, strtf+"AMA low"+NumToStr(period, 1.0)+" "+ NumToStr(noiseperiod , 1.0), Clr, styleThick|datamodestyle|OnlyClosestyle) ;
if (MAwidth > 0)
PlotOHLC(Refamaplotc+MAwidth, Refamaplotc+MAwidth, Refamaplotc-MAwidth, Refamaplotc-MAwidth, "", ClrClose , styleCloud|styleNoLabel|datamodestyle) ;
if (showasband)
{
PlotOHLC(Refamaploth, Refamaploth, Refamaplotl, Refamaplotl, "", Clrband, styleCloud|styleNoLabel|datamodestyle|OnlyClosestyle, 0, 0, 0, bandlevel) ;
}
if (showclosebias)
{
upside = Refamaploth-(Refamaploth-Refamaplotl)/3 ;
dnside = Refamaplotl+(Refamaploth-Refamaplotl)/3 ;
up = Refamaplotc >= upside ;
dn = Refamaplotc <= dnside ;
Clr = IIf(up, Clrbiasup, IIf(dn, Clrbiasdn,Clrbiasnone)) ;
Plot(Closebiasht, "", Clr, styleArea|styleNoLabel|styleOwnScale, 0, 100) ;
}
showparam = ParamToggle("Show Key Param", "No|Yes", 1) ;
if (showparam)
{
y = (SelectedValue(Refamaploth)+ SelectedValue(Refamaplotl)) /2 ;
tfsd = tfs ;
if (tfsd < Interval())
tfsd = Interval() ;
// str = "TF="+NumToStr(tfsd/in1Minute, 1.0) + " P=" + NumToStr(period, 1.0)+"-"+ NumToStr(noiseperiod, 1.0);
str = NumToStr(tfsd/in1Minute, 1.0) + " AMA" ;
PlotText(str, BarCount+2, y, colorBlack) ;
}
showrib = ParamToggle("Show Ribbon", "No|Yes", 0) ;
barht = Param("Bar Ht", 4, 1, 100) ;
Refo = ParamField("Open", 0) ;
Refh = ParamField("High", 1) ;
Refl = ParamField("Low", 2) ;
Refc = ParamField("Close", 3) ;
if (showrib)
{
Buy = Refc > Max(Refamaplotc, Refamaploth) ;
Short = Refc < Min(Refamaplotc, Refamaplotl) ;
up = Flip(Buy, Short) ;
dn = Flip(Short, Buy) ;
Clr = IIf(up, colorBlue, colorRed) ;
Plot(barht, "", Clr, styleArea|styleNoLabel|styleOwnScale, 0, 100) ;
}
isemapvts = ParamToggle("Pvt Type", "H-L|EMA", 1) ;
if (tradearr)// AND NOT datamode)
{
avgP = (Refh+refl+Refc)/3 ;
p1 = Param("Fast", 1, 1, 100, 1) ;
p2 = Param("Slow", 3, 1, 100, 1) ;
ismph = H-H ;
ismpl = L-L ;
if (isemapvts)
{
EMA1 = EMA(avgP, p1) ;
EMA2 = EMA(avgP, p2) ;
upcross = Cross(EMA1, EMA2) ;
downcross = Cross(EMA2, EMA1) ;
bi = BarIndex() ;
mphbar = HighestSinceBars(upcross, Refh) ;
mplbar = LowestSinceBars(downcross, Refl) ;
mphbi = ValueWhen(downcross, bi, 0) - ValueWhen(downcross, mphbar, 0) ;
ismph = mphbi == bi ;
mplbi = ValueWhen(upCross, bi, 0) - ValueWhen(upCross, mplbar, 0) ;
ismpl = mplbi == bi ;
ismph = IIf(downCross AND mphbar == 0, True, ismph) ;
ismpl = IIf(upcross AND mplbar == 0, True, ismpl) ;
}
else
{
ismph = H >= Ref(H, -1) AND H > Ref(H, 1) ;
ismpl = L <= Ref(L, -1) AND L < Ref(L, 1) ;
/*
ismph = ExRem(ismph, ismpl) ;
ismpl = ExRem(ismpl, ismph) ;
isbmph = ExRem(isbmph, isbmpl) ;
isbmpl = ExRem(isbmpl, isbmph) ;
*/
}
showminor = ParamToggle("Show Minor Pvts", "No|Yes", 1) ;
showminorlvls = ParamToggle("Show Minor Levels", "No|Yes", 1) ;
issquare = ParamToggle("Pvt style", "Circle|Square", 0) ;
pvtmarker = IIf(issquare, shapeSmallSquare, shapeSmallCircle) ;
if (showminor)
{
PlotShapes(ismph*pvtmarker , colorRed, 0, Refh, 12) ;
PlotShapes(ismpl*pvtmarker , colorGreen, 0, Refl, -12) ;
}
mph = ValueWhen(ismph, Refh) ;
mpl = ValueWhen(ismpl, Refl) ;
if (showminorlvls)
{
x = LineArray(0, SelectedValue(mph), (BarCount-1), SelectedValue(mph));
Plot(x, "", colorGold, styleDashed);
x = LineArray(0, SelectedValue(mpl), (BarCount-1), SelectedValue(mpl));
Plot(x, "", colorGold, styleDashed);
}
Reflow = Refl ;
Refhigh = Refh ;
if (Onbody)
{
Reflow = Min(Refo, Refc) ;
Refhigh = Max(Refo, Refc) ;
}
if (triggertypepvt)
{
Buy = ismph AND Refhigh > AMAploth ;
Short = ismpl AND Reflow < AMAplotl ;
}
else
{
Buy = avgP > AMAploth ;
Short = avgP < AMAplotl ;
}
Buy = ExRem(Buy, Short OR Refc < AMAploth ) ;
Short = ExRem(Short, Buy OR Refc > AMAplotl ) ;
Sell = (Refc < AMAploth AND NOT Refc < AMAplotl AND Refl > AMAplotl) ;
Cover = (Refc > AMAplotl AND NOT Refc > AMAploth AND Refh < AMAploth) ;
Cover = ExRem(Cover, Short OR Buy) ;
Sell = ExRem(Sell, Short OR Buy) ;
PlotShapes(Buy*shapeUpTriangle, colorGreen, 0, Refh, 12) ;
PlotShapes(Short*shapeDownTriangle, colorBrown, 0, Refl, 12) ;
showsl = ParamToggle("Show SL", "No|Yes", 0) ;
if (showsl)
{
PlotShapes(Cover*shapeSmallUpTriangle, colorBlack, 0, Refh, 12) ;
PlotShapes(Sell*shapeSmallDownTriangle, colorBlack, 0, Refl, 12) ;
}
}
datamode = ParamToggle("Data Mode", "No|Yes", 0) ;
showintitle = ParamToggle("Show in Title", "No|Yes", 0) ;
showlabel = ParamToggle("Show Label", "No|Yes", 1) ;
usetf = ParamToggle("Use TF", "No|Yes", 1) ;
tf = Param("TF", 15, 1, 100000, 1) ;
isexpandLast = ParamToggle("Expand Mode", "First|Last", 1) ;
expandmode = IIf(isexpandLast, expandLast, expandFirst) ;
period = Param("Period", 30, 1, 100, 1) ;
noiseperiod = Param("Noise Period", 5, 1, 100, 1) ;
Clr = ParamColor("AMA Color", colorRed) ;
ClrClose = ParamColor("AMA Close Color", colorRed) ;
MAwidthper = Param("MA Width %", 0.005, 0, 10, 1) ;
MAwidth = SelectedValue(C) * MAwidthper /100 ;
showasband = ParamToggle("Show as band", "No|Yes", 1) ;
Clrband = ParamColor("Color Band", colorLavender) ;
bandlevel = Param("Level Band", -2, -5, 5, 1) ;
tradearr = ParamToggle("Show Trade Arrow", "No|Yes", 0) ;
triggertypepvt = ParamToggle("Trigger Type", "Bar|Pvt", 0) ;
Onbody= ParamToggle("BO style", "H-L|Body", 1) ;
datamodestyle = styleNoRescale ;
if (NOT showintitle)
datamodestyle |= styleNoTitle ;
if (NOT showlabel)
datamodestyle |= styleNoLabel ;
if (datamode)
datamodestyle = styleNoDraw|styleNoTitle|styleNoLabel|styleNoRescale ;
tfs = tf *in1Minute ;
if (usetf)
TimeFrameSet(tfs) ;
tfma = int(Interval()/60) ;
if (usetf AND tfs >= Interval())
tfma = tf ;
strtf = NumToStr(tfma, 8.0)+"min" ;
Refo = ParamField("TF Open", 0) ;
Refh = ParamField("TF High", 1) ;
Refl = ParamField("TF Low", 2) ;
Refc = ParamField("TF Close", 3) ;
//Refbi = ParamField("BI", 4) ;
//Plot(EMA( Close, period ), "", colorRed) ;
fast = 2/(2+1);
slow = 2/(period+1);
dir=abs(Refc -Ref(Refc ,-noiseperiod ));
vol=Sum(abs(Refc -Ref(Refc,-1)),noiseperiod );
ER=dir/vol;
sc =( ER*(fast-slow)+slow)^2;
amaplotcx = AMA( Refc, sc );
dirh=abs(Refh -Ref(Refh ,-noiseperiod ));
volh=Sum(abs(Refh -Ref(Refh,-1)),noiseperiod );
ERh=dirh/volh;
sch =( ERh*(fast-slow)+slow)^2;
amaplothx = AMA( Refh, sch );
dirl=abs(Refl -Ref(Refl ,-noiseperiod ));
voll=Sum(abs(Refl -Ref(Refl,-1)),noiseperiod );
ERl=dirl/voll;
scl =( ERl*(fast-slow)+slow)^2;
amaplotlx = AMA( Refl, scl );
amaplotc = amaplotcx ;
amaploth = amaplothx ;
amaplotl = amaplotlx ;
if (usetf)
{
amaplotc = TimeFrameExpand(amaplotcx, tfs, expandmode) ;
amaploth = TimeFrameExpand(amaplothx, tfs, expandmode) ;
amaplotl = TimeFrameExpand(amaplotlx, tfs, expandmode) ;
TimeFrameRestore() ;
}
showoncrb = ParamToggle("Show On CRB", "No|Yes", 0) ;
Refo = ParamField("CRB Open", 7+0) ;
Refh = ParamField("CRB High", 7+1) ;
Refl = ParamField("CRB Low", 7+2) ;
Refc = ParamField("CRB Close", 7+3) ;
Refbi = ParamField("CRB BI", 7+4) ;
Refcrbbars = ParamField("CRB Bars", 7+5) ;
Refnbars = ParamField("TF Bars", 7+6) ;
Refdt = ParamField("CRB DT", 7+7) ;
if (showoncrb)
{
diffbars = Refnbars -Refcrbbars -1 ;
// convert to crb
Refamaploth = Ref(amaploth, -diffbars) ;
Refamaplotc = Ref(amaplotc, -diffbars) ;
Refamaplotl = Ref(amaplotl, -diffbars) ;
// RefClre = Ref(Clr, -diffbars) ;
k = 0 ;
for ( i = Crbst ; i < BarCount ; i++)
{
Refbar = Refbi[i];
Refamaploth[i] = amaploth[Refbar] ;
Refamaplotc[i] = amaplotc[Refbar] ;
Refamaplotl[i] = amaplotl[Refbar] ;
// RefClre[i] = Clr[Refbar];
k++;
}
}
else
{
Refamaploth = amaploth ;
Refamaplotc = amaplotc ;
Refamaplotl = amaplotl ;
// RefClre = Clre ;
}
Plot(Refamaplotc, strtf+"AMA close"+NumToStr(period, 1.0)+" "+ NumToStr(noiseperiod , 1.0), ClrClose , styleThick|datamodestyle) ;
Plot(Refamaploth, strtf+"AMA high"+NumToStr(period, 1.0)+" "+ NumToStr(noiseperiod , 1.0), Clr, styleThick|datamodestyle) ;
Plot(Refamaplotl, strtf+"AMA low"+NumToStr(period, 1.0)+" "+ NumToStr(noiseperiod , 1.0), Clr, styleThick|datamodestyle) ;
if (MAwidth > 0)
PlotOHLC(Refamaplotc+MAwidth, Refamaplotc+MAwidth, Refamaplotc-MAwidth, Refamaplotc-MAwidth, "", ClrClose , styleCloud|styleNoLabel|datamodestyle) ;
if (showasband)
{
PlotOHLC(Refamaploth, Refamaploth, Refamaplotl, Refamaplotl, "", Clrband, styleCloud|styleNoLabel|datamodestyle, 0, 0, 0, bandlevel) ;
}
showparam = ParamToggle("Show Key Param", "No|Yes", 1) ;
if (showparam)
{
y = (SelectedValue(Refamaploth)+ SelectedValue(Refamaplotl)) /2 ;
tfsd = tfs ;
if (tfsd < Interval())
tfsd = Interval() ;
// str = "TF="+NumToStr(tfsd/in1Minute, 1.0) + " P=" + NumToStr(period, 1.0)+"-"+ NumToStr(noiseperiod, 1.0);
str = NumToStr(tfsd/in1Minute, 1.0) + " AMA" ;
PlotText(str, BarCount+2, y, colorBlack) ;
}
Refo = ParamField("Open", 0) ;
Refh = ParamField("High", 1) ;
Refl = ParamField("Low", 2) ;
Refc = ParamField("Close", 3) ;
if (tradearr) // AND NOT datamode)
{
avgP = (Refh+refl+Refc)/3 ;
p1 = Param("Fast", 1, 1, 100, 1) ;
p2 = Param("Slow", 3, 1, 100, 1) ;
ismph = H-H ;
ismpl = L-L ;
EMA1 = EMA(avgP, p1) ;
EMA2 = EMA(avgP, p2) ;
upcross = Cross(EMA1, EMA2) ;
downcross = Cross(EMA2, EMA1) ;
bi = BarIndex() ;
mphbar = HighestSinceBars(upcross, Refh) ;
mplbar = LowestSinceBars(downcross, Refl) ;
mphbi = ValueWhen(downcross, bi, 0) - ValueWhen(downcross, mphbar, 0) ;
ismph = mphbi == bi ;
mplbi = ValueWhen(upCross, bi, 0) - ValueWhen(upCross, mplbar, 0) ;
ismpl = mplbi == bi ;
ismph = IIf(downCross AND mphbar == 0, True, ismph) ;
ismpl = IIf(upcross AND mplbar == 0, True, ismpl) ;
showminor = ParamToggle("Show Minor Pvts", "No|Yes", 1) ;
showminorlvls = ParamToggle("Show Minor Levels", "No|Yes", 1) ;
issquare = ParamToggle("Pvt style", "Circle|Square", 0) ;
pvtmarker = IIf(issquare, shapeSmallSquare, shapeSmallCircle) ;
if (showminor)
{
PlotShapes(ismph*pvtmarker , colorRed, 0, Refh, 12) ;
PlotShapes(ismpl*pvtmarker , colorGreen, 0, Refl, -12) ;
}
mph = ValueWhen(ismph, Refh) ;
mpl = ValueWhen(ismpl, Refl) ;
if (showminorlvls)
{
x = LineArray(0, SelectedValue(mph), (BarCount-1), SelectedValue(mph));
Plot(x, "", colorGold, styleDashed);
x = LineArray(0, SelectedValue(mpl), (BarCount-1), SelectedValue(mpl));
Plot(x, "", colorGold, styleDashed);
}
Reflow = Refl ;
Refhigh = Refh ;
if (Onbody)
{
Reflow = Min(Refo, Refc) ;
Refhigh = Max(Refo, Refc) ;
}
if (triggertypepvt)
{
Buy = ismph AND mph > AMAploth ;
Short = ismpl AND mpl < AMAplotl ;
}
else
{
Buy = avgP > AMAploth ;
Short = avgP < AMAplotl ;
}
Buy = ExRem(Buy, Short OR Refc < AMAploth ) ;
Short = ExRem(Short, Buy OR Refc > AMAplotl ) ;
inbuy = Flip(Buy, Short) ;
inshort = Flip(Short, Buy) ;
Sell = (Refc < AMAploth AND NOT Refc < AMAplotl AND inbuy) ;
Cover = (Refc > AMAplotl AND NOT Refc > AMAploth AND inshort) ;
Cover = ExRem(Cover, Short OR Buy) ;
Sell = ExRem(Sell, Short OR Buy) ;
PlotShapes(Buy*shapeUpTriangle, colorBlue, 0, Refh, 12) ;
PlotShapes(Short*shapeDownTriangle, colorRed, 0, Refl, 12) ;
showsl = ParamToggle("Show SL", "No|Yes", 1) ;
if (showsl)
{
PlotShapes(Cover*shapeSmallUpTriangle, colorBlack, 0, Refh, 12) ;
PlotShapes(Sell*shapeSmallDownTriangle, colorBlack, 0, Refl, 12) ;
}
}
// Author: Pratap Balakrishnan
// Copyright: All rights reserved. Not to be circulated or shared or posted on websites without the author's written permission.
// email id: [email protected]
//
ro = ParamField("Open", 0) ;
rh = ParamField("High", 1) ;
rl = ParamField("Low", 2) ;
rc = ParamField("Close", 3) ;
P = (rH+rL+rC)/3 ;
p1 = Param("Fast", 1, 1, 100, 1) ;
p2 = Param("Slow", 3, 1, 100, 1) ;
EMAfactor = Param("EMA factor", 1, 1, 100) ;
usebpvts = ParamToggle("Use Body Pvts", "No|Yes", 0) ;
isemapvts = ParamToggle("Pvt Type", "H-L|EMA", 1) ;
ismph = H-H ;
ismpl = L-L ;
bph = Max(rO,rC);
bpl = Min(rO,rC);
if (isemapvts)
{
EMA1 = EMA(P, p1*EMAfactor) ;
EMA2 = EMA(P, p2*EMAfactor) ;
upcross = Cross(EMA1, EMA2) ;
downcross = Cross(EMA2, EMA1) ;
//bph = Max(O,C);
//bpl = Min(O,C);
bi = BarIndex() ;
mphbar = HighestSinceBars(upcross, rH) ;
mplbar = LowestSinceBars(downcross, rL) ;
mphbi = ValueWhen(downcross, bi, 0) - ValueWhen(downcross, mphbar, 0) ;
ismph = mphbi == bi ;
mplbi = ValueWhen(upCross, bi, 0) - ValueWhen(upCross, mplbar, 0) ;
ismpl = mplbi == bi ;
ismph = IIf(downCross AND mphbar == 0, True, ismph) ;
ismpl = IIf(upcross AND mplbar == 0, True, ismpl) ;
bmphbar = HighestSinceBars(upcross, bph) ;
bmplbar = LowestSinceBars(downcross, bpl) ;
bmphbi = ValueWhen(downcross, bi, 0) - ValueWhen(downcross, bmphbar, 0) ;
isbmph = bmphbi == bi ;
bmplbi = ValueWhen(upCross, bi, 0) - ValueWhen(upCross, bmplbar, 0) ;
isbmpl = bmplbi == bi ;
isbmph = IIf(downCross AND bmphbar == 0, True, isbmph) ;
isbmpl = IIf(upcross AND bmplbar == 0, True, isbmpl) ;
}
else
{
isbmph = ismph = rH >= Ref(rH, -1) AND rH > Ref(rH, 1) ;
isbmpl = ismpl = rL <= Ref(rL, -1) AND rL < Ref(rL, 1) ;
ismph = ExRem(ismph, ismpl) ;
ismpl = ExRem(ismpl, ismph) ;
isbmph = ExRem(isbmph, isbmpl) ;
isbmpl = ExRem(isbmpl, isbmph) ;
}
showminor = ParamToggle("Show Minor Pvts", "No|Yes", 1) ;
issquare = ParamToggle("Pvt style", "Circle|Square", 1) ;
Clrmph = ParamColor("MPH Color", colorGreen) ;
Clrmpl = ParamColor("MPL Color", colorBrown) ;
pvtmarker = IIf(issquare, shapeSmallSquare, shapeSmallCircle) ;
if (showminor)
{
if (usebpvts)
{
PlotShapes(isbmph*pvtmarker , Clrmph , 0, rH, 12) ;
PlotShapes(isbmpl*pvtmarker , Clrmpl, 0, rL, -12) ;
}
else
{
PlotShapes(ismph*pvtmarker , Clrmph , 0, rH, 12) ;
PlotShapes(ismpl*pvtmarker , Clrmpl, 0, rL, -12) ;
}
}
showminorlvls = ParamToggle("Show Minor Levels", "No|Yes", 1) ;
mph = ValueWhen(ismph, rH) ;
mpl = ValueWhen(ismpl, rL) ;
if (showminorlvls)
{
x = LineArray(0, SelectedValue(mph), (BarCount-1), SelectedValue(mph));
Plot(x, "", colorGold, styleDashed|styleNoRescale);
x = LineArray(0, SelectedValue(mpl), (BarCount-1), SelectedValue(mpl));
Plot(x, "", colorGold, styleDashed|styleNoRescale);
}
showminortrend = ParamToggle("Show Minor Trend", "No|Yes", 0) ;
if (showminortrend)
{
// initialize minor levels
mph = ValueWhen(ismph, rH) ;
mpl = ValueWhen(ismpl, rL) ;
mbph = ValueWhen(isbmph, bph) ;
mbpl = ValueWhen(isbmpl, bpl) ;
// minor trend
mut = rH > mph OR (rC > mbph) OR (ismph AND rH > Ref(mph, -1));
mdt = rL < mpl OR (rC < mbpl) OR (ismpl AND rL < Ref(mpl, -1));
mdt = Flip(mdt, mut) ;
mut = Flip(mut, mdt) ;
//mutst = ExRem(mut, mdt) ;
//mdtst = ExRem(mdt, mut) ;
Clr = IIf(mut, colorBlue, colorRed) ;
// PlotOHLC(rO,rH,rL,rC, "", Clr, styleCandle|styleNoLabel);
Plot(4, "", Clr, styleArea|styleOwnScale, 0, 100, 0, -1) ;
}
tffactor = Param("TF Factor", 5, 1, 100, 1) ;
showhigher = ParamToggle("Show Higher", "No|Yes", 0) ;
ishtfemapvts = ParamToggle("HTF Pvt Type", "H-L|EMA", 1) ;
htfEMAfactor = Param("HTF EMA factor", 1, 1, 100) ;
if (showhigher)
{
tfs = tffactor *Interval() ;
TimeFrameSet(tfs) ;
if (ishtfemapvts)
{
Ptf = (H+L+C)/3 ;
EMA1tf = EMA(Ptf, p1*htfEMAfactor) ;
EMA2tf = EMA(Ptf, p2*htfEMAfactor) ;
upcrosstf = Cross(EMA1tf, EMA2tf) ;
downcrosstf = Cross(EMA2tf, EMA1tf) ;
bphtf = Max(O,C) ;
bpltf = Min(O,C) ;
if (usebpvts)
{
Refhtf = bphtf ;
Refltf = bpltf ;
}
else
{
Refhtf = H ;
Refltf = L ;
}
mphbartf = HighestSinceBars(upcrosstf, Refhtf) ;
mplbartf = LowestSinceBars(downcrosstf, Refltf) ;
bitf = BarIndex() ;
mphbitf = ValueWhen(downcrosstf, bitf, 0) - ValueWhen(downcrosstf, mphbartf, 0) ;
ismphtf = mphbitf == bitf ;
mplbitf = ValueWhen(upCrosstf, bitf, 0) - ValueWhen(upCrosstf, mplbartf, 0) ;
ismpltf = mplbitf == bitf ;
ismphtf = IIf(downCrosstf AND mphbartf == 0, True, ismphtf) ;
ismpltf = IIf(upcrosstf AND mplbartf == 0, True, ismpltf) ;
}
else
{
ismphtf = H >= Ref(H, -1) AND H > Ref(H, 1) ;
ismpltf = L <= Ref(L, -1) AND L < Ref(L, 1) ;
ismphtf = ExRem(ismphtf, ismpltf) ;
ismpltf = ExRem(ismpltf, ismphtf) ;
}
if (showminortrend)
{
// initialize minor levels
mphtf = ValueWhen(ismphtf, H) ;
mpltf = ValueWhen(ismpltf, L) ;
mbphtf = ValueWhen(ismphtf, bphtf) ;
mbpltf = ValueWhen(ismpltf, bpltf) ;
// minor trend
muttf = H > mphtf OR (C > mbphtf) OR (ismphtf AND H > Ref(mphtf, -1));
mdttf = L < mpltf OR (C < mbpltf) OR (ismpltf AND L < Ref(mpltf, -1));
mdttf = Flip(mdttf, muttf) ;
muttf = Flip(muttf, mdttf) ;
//mutst = ExRem(mut, mdt) ;
//mdtst = ExRem(mdt, mut) ;
Clrtf = IIf(muttf, colorBlue, colorRed) ;
// PlotOHLC(rO,rH,rL,rC, "", Clr, styleCandle|styleNoLabel);
Clrtfe = TimeFrameExpand(Clrtf, tfs, expandLast) ;
Plot(2, "", Clrtfe, styleArea|styleOwnScale, 0, 100) ;
}
ismphtfe = TimeFrameExpand(ismphtf, tfs, expandFirst) ;
ismpltfe = TimeFrameExpand(ismpltf, tfs, expandFirst) ;
He=TimeFrameExpand(H, tfs, expandFirst) ;
Le=TimeFrameExpand(L, tfs, expandFirst) ;
mphhtf = ValueWhen(ismphtf, H) ;
mplhtf = ValueWhen(ismpltf, L) ;
muthtf = H > mphhtf OR (ismphtf AND H > Ref(mphhtf, -1));
mdthtf = L < mplhtf OR (ismpltf AND L < Ref(mplhtf, -1));
muthtf = IIf(muthtf AND mdthtf, IIf(C<O, 0, 1), muthtf) ;
mdthtf = IIf(muthtf AND mdthtf, IIf(C>O, 0, 1), mdthtf) ;
TimeFrameRestore() ;
muthtfe = TimeFrameExpand(muthtf, tfs, expandFirst) ;
mdthtfe = TimeFrameExpand(mdthtf, tfs, expandFirst) ;
mphhtfe = TimeFrameExpand(mphhtf, tfs, expandLast) ;
mplhtfe = TimeFrameExpand(mplhtf, tfs, expandLast) ;
ishtfmph = IIf(ismph == ismphtfe, 1, 0) ;
ishtfmpl = IIf(ismpl == ismpltfe, 1, 0) ;
PlotShapes(ismphtfe *shapeSmallSquare, Clrmph , 0, He, 12) ;
PlotShapes(ismpltfe *shapeSmallSquare, Clrmpl, 0, Le, -12) ;
showhtflvls = ParamToggle("Show HTF levels", "No|Yes", 1) ;
Clrhtflvl = colorPaleGreen ;
//Plot(2, "", IIf(ismph , colorBlue, IIf(ismpl, colorRed, colorGrey40)), styleArea|styleOwnScale, 0, 100) ;
//Plot(4, "", IIf(ishtfmph , colorBlue, IIf(ishtfmpl , colorRed, colorGrey40)), styleArea|styleOwnScale, 0, 100) ;
mphhtf = ValueWhen(ismphtfe , He, 1) ;
mplhtf = ValueWhen(ismpltfe , Le, 1) ;
if (showhtflvls )
{
mphhtf = ValueWhen(ismphtfe , He, 1) ;
mplhtf = ValueWhen(ismpltfe , Le, 1) ;
x = LineArray(0, SelectedValue(mphhtf), (BarCount-1), SelectedValue(mphhtf));
Plot(x, NumToStr(tfs/in1Minute, 1.0)+"min mph", Clrhtflvl , styleDashed|styleNoRescale|styleNoTitle);
x = LineArray(0, SelectedValue(mplhtf), (BarCount-1), SelectedValue(mplhtf));
Plot(x, NumToStr(tfs/in1Minute, 1.0)+"min mpl", Clrhtflvl , styleDashed|styleNoRescale|styleNoTitle);
}
showhtftrend = ParamToggle("Show HTF Trend", "No|Yes", 0) ;
Htfbarht = Param("HTF Trend Bar Ht", 4, 1,100) ;
riblayer = Param("Ribbon Layer", 1, -5, 5) ;
if (showhtftrend)
{
mdthtfe = Flip(mdthtfe, muthtfe) ;
muthtfe = Flip(muthtfe, mdthtfe) ;
Plot(Htfbarht, "", IIf(muthtfe, colorBlue, colorRed), styleArea|styleNoLabel|styleOwnScale, 0, 100, 0, riblayer) ;
}
//Plot(2, "", IIf(ismphtfe , colorRed, IIf(ismpltfe , colorBlue, colorGrey40)), styleArea|styleOwnScale, 0, 100) ;
//Plot(4, "", IIf(ismph, colorRed, IIf(ismpl , colorBlue, colorGrey40)), styleArea|styleOwnScale, 0, 100) ;
}
// Author: Pratap Balakrishnan
// Copyright: All rights reserved. Not to be circulated or shared or posted on websites without the author's written permission.
// email id: [email protected]
//
debug = ParamToggle("Debug", "No|Yes", 0) ;
ro = ParamField("Open", 0) ;
rh = ParamField("High", 1) ;
rl = ParamField("Low", 2) ;
rc = ParamField("Close", 3) ;
p1 = Param("Fast", 1, 1, 100, 1) ;
p2 = Param("Slow", 3, 1, 100, 1) ;
usebpvts = ParamToggle("Use Body Pvts", "No|Yes", 0) ;
isemapvts = ParamToggle("Pvt Type", "H-L|EMA", 1) ;
showminor = ParamToggle("Show Minor Pvts", "No|Yes", 1) ;
issquare = ParamToggle("Pvt style", "Circle|Square", 1) ;
Clrmph = ParamColor("MPH Color", colorBlueGrey) ;
Clrmpl = ParamColor("MPL Color", colorOrange) ;
pvtmarker = IIf(issquare, shapeSmallSquare, shapeSmallCircle) ;
showminortrend = ParamToggle("Show Minor Trend", "No|Yes", 1) ;
barht = Param("Bar Ht", 4, 0, 100, 1) ;
showtrendclronbar = ParamToggle("Show Trend on Bar", "No|Yes", 0) ;
tf = Param("TF", 15, 1, 100, 1) ;
showhigher = ParamToggle("Show Higher", "No|Yes", 1) ;
tfs = tf *in1Minute;
TimeFrameSet(tfs) ;
if (isemapvts)
{
Ptf = (H+L+C)/3 ;
EMA1tf = EMA(Ptf, p1) ;
EMA2tf = EMA(Ptf, p2) ;
upcrosstf = Cross(EMA1tf, EMA2tf) ;
downcrosstf = Cross(EMA2tf, EMA1tf) ;
bphtf = Max(O,C) ;
bpltf = Min(O,C) ;
if (usebpvts)
{
Refhtf = bphtf ;
Refltf = bpltf ;
}
else
{
Refhtf = H ;
Refltf = L ;
}
mphbartf = HighestSinceBars(upcrosstf, Refhtf) ;
mplbartf = LowestSinceBars(downcrosstf, Refltf) ;
bitf = BarIndex() ;
mphbitf = ValueWhen(downcrosstf, bitf, 0) - ValueWhen(downcrosstf, mphbartf, 0) ;
ismphtf = mphbitf == bitf ;
mplbitf = ValueWhen(upCrosstf, bitf, 0) - ValueWhen(upCrosstf, mplbartf, 0) ;
ismpltf = mplbitf == bitf ;
ismphtf = IIf(downCrosstf AND mphbartf == 0, True, ismphtf) ;
ismpltf = IIf(upcrosstf AND mplbartf == 0, True, ismpltf) ;
}
else
{
ismphtf = H > Ref(H, -1) AND H > Ref(H, 1) ;
ismpltf = L < Ref(L, -1) AND L < Ref(L, 1) ;
}
// initialize minor levels
mphtf = ValueWhen(ismphtf, H) ;
mpltf = ValueWhen(ismpltf, L) ;
mbphtf = ValueWhen(ismphtf, bphtf) ;
mbpltf = ValueWhen(ismpltf, bpltf) ;
// minor trend
mphbreak = H > mphtf OR (ismphtf AND H > Ref(mphtf, -1));
mplbreak = L < mpltf OR (ismpltf AND L < Ref(mpltf, -1));
mdttf = Flip(mplbreak , mphbreak ) ;
muttf = Flip(mphbreak , mplbreak) ;
//mutst = ExRem(mut, mdt) ;
//mdtst = ExRem(mdt, mut) ;
Clrtf = IIf(muttf, colorBlue, colorRed) ;
// PlotOHLC(rO,rH,rL,rC, "", Clr, styleCandle|styleNoLabel);
Clrtfe = TimeFrameExpand(Clrtf, tfs, expandFirst) ;
mphbreake = TimeFrameExpand(mphbreak, tfs, expandFirst) ;
mplbreake = TimeFrameExpand(mplbreak, tfs, expandFirst) ;
// Plot(barht, "", Clrtfe, styleArea|styleOwnScale, 0, 100) ;
nlvls = Param("No. of Lvls", 0, 0, 100, 1) ;
showlvls = ParamToggle("Show Lvls", "No|Yes", 0) ;
showatbodies = ParamToggle("Show at Bodies", "No|Yes", 1) ;
showlabel = ParamToggle("Show Label", "No|Yes", 1) ;
Clrhigh = ParamColor("Color High", colorRed) ;
Clrlow = ParamColor("Color Low", colorBlue) ;
styl = 0 ;
if (NOT showlabel)
style |= styleNoLabel ;
if (showlvls)
{
for (i = 1 ; i <= nlvls; i++)
{
Lvlh = ValueWhen(ismphtf, IIf(showatbodies, Max(O,C), H), i) ;
Lvll = ValueWhen(ismpltf, IIf(showatbodies, Min(O,C), L), i) ;
Lvlhe = TimeFrameExpand(Lvlh, tfs, expandFirst) ;
Lvlle = TimeFrameExpand(Lvll, tfs, expandFirst) ;
Plot(IIf(Lvlhe == Ref(Lvlhe, 1), Lvlhe, Null), "", Clrhigh, styleThick|styl |styleNoRescale) ;
Plot(IIf(Lvlle == Ref(Lvlle, 1), Lvlle, Null), "", Clrlow, styleThick|styl |styleNoRescale) ;
}
}
ismphtfe = TimeFrameExpand(ismphtf, tfs, expandFirst) ;
ismpltfe = TimeFrameExpand(ismpltf, tfs, expandFirst) ;
mphtfe = TimeFrameExpand(mphtf, tfs, expandLast) ;
mpltfe = TimeFrameExpand(mpltf, tfs, expandLast) ;
He=TimeFrameExpand(H, tfs, expandFirst) ;
Le=TimeFrameExpand(L, tfs, expandFirst) ;
TimeFrameRestore() ;
//ishtfmph = IIf(ismph == ismphtfe, 1, 0) ;
//ishtfmpl = IIf(ismpl == ismpltfe, 1, 0) ;
showoncrb = ParamToggle("Show On CRB", "No|Yes", 0) ;
Refo = ParamField("CRB Open", 7+0) ;
Refh = ParamField("CRB High", 7+1) ;
Refl = ParamField("CRB Low", 7+2) ;
Refc = ParamField("CRB Close", 7+3) ;
Refbi = ParamField("CRB BI", 7+4) ;
Refcrbbars = ParamField("CRB Bars", 7+5) ;
Refnbars = ParamField("TF Bars", 7+6) ;
Refdt = ParamField("CRB DT", 7+7) ;
if (showoncrb)
{
diffbars = Refnbars -Refcrbbars -1 ;
// convert to crb
Refismphtfe = Ref(ismphtfe, -diffbars) ;
Refismpltfe = Ref(ismpltfe, -diffbars) ;
RefHe = Ref(He, -diffbars) ;
RefLe = Ref(Le, -diffbars) ;
RefClrtfe = Ref(Clrtfe, -diffbars) ;
// RefClre = Ref(Clr, -diffbars) ;
k = 0 ;
for ( i = Crbst ; i < BarCount ; i++)
{
Refbar = Refbi[i];
Refismphtfe[i] = ismphtfe[Refbar] ;
Refismpltfe[i] = ismpltfe[Refbar] ;
RefHe[i] = He[Refbar] ;
RefLe[i] = Le[Refbar] ;
RefClrtfe[i] = Clrtfe[Refbar] ;
// RefClre[i] = Clr[Refbar];
k++;
}
}
else
{
Refismphtfe = ismphtfe ;
Refismpltfe = ismpltfe ;
RefHe = He;
RefLe = Le;
RefClrtfe = Clrtfe;
// RefClre = Clre ;
}
markpvts = ParamToggle("Mark Pvts", "No|Yes", 1) ;
showtext = ParamToggle("Show Text", "No|Yes", 1) ;
txtoff = 16 ;
ribLayer = Param("Rib Layer", 0, -5, 5, 1) ;
if (markpvts)
{
PlotShapes(Refismphtfe *pvtmarker , Clrmph , 0, RefHe, 12) ;
PlotShapes(Refismpltfe *pvtmarker , Clrmpl, 0, RefLe, -12) ;
}
if (showminortrend)
Plot(barht, "", RefClrtfe, styleArea|styleOwnScale, 0, 100, 0, ribLayer ) ;
if (showtrendclronbar)
{
// minor trend
hbreak = H > Ref(mphtfe, -1) ;
lbreak = L < Ref(mpltfe, -1) ;
mdt = Flip(lbreak , hbreak ) ;
mut = Flip(hbreak , lbreak) ;
//mutst = ExRem(mut, mdt) ;
//mdtst = ExRem(mdt, mut) ;
Clr = IIf(mut, colorBlue, colorRed) ;
// PlotOHLC(rO,rH,rL,rC, "", Clr, styleCandle|styleNoLabel);
SetBarFillColor(Clr) ;
Plot(C, "", Clr, styleCandle|styleNoLabel, 0,0,0,1) ;
}
ismph = Refismphtfe AND (RefHe == H) ;
ismpl = Refismpltfe AND (RefLe == L) ;
if (showtext)
{
bi = BarIndex() ;
st = LowestVisibleValue(bi) ;
ed = HighestVisibleValue(bi) ;
for (i = st ; i <=ed ; i++)
{
if (ismph[i])
PlotText(NumToStr(Refhe[i], 8.1), i-2, Refhe[i] +txtoff-2, colorBlack) ;
if (ismpl[i])
PlotText(NumToStr(Refle[i], 8.1), i-2, Refle[i] -txtoff, colorBlack) ;
}
}
showerls = Param("Show ERLs", 0, 0, 10, 1) ;
showderls = Param("Show DERLs", 0, 0, 10, 1) ;
showmoves = ParamToggle("Show Moves", "No|Yes", 0) ;
Connectlast = ParamToggle("Connect Last", "No|Yes", 0) ;
Clrmoveup = ParamColor("Color Move Up", colorBlue) ;
Clrmovedn = ParamColor("Color Move Down", colorRed) ;
if (showerls > 0)
{
Clrerlres = Clrmovedn ;
Clrerlsupp = Clrmoveup ;
mphb = (NOT mphbreake) AND Ref(mphbreake, 1) ;
mplb = (NOT mplbreake) AND Ref(mplbreake, 1) ;
mph = ValueWhen(ismphtfe, H, 1) ;
mpl = ValueWhen(ismpltfe, L, 1) ;
for (i = 1 ; i <= showerls ; i++)
{
res = ValueWhen(mphb, mph, i) ;
supp = ValueWhen(mplb, mpl, i) ;
Plot(res, "", Clrerlres, styleNoLine|styleDots|styleNoTitle|styleNoRescale) ;
Plot(supp, "", Clrerlsupp, styleNoLine|styleDots|styleNoTitle|styleNoRescale) ;
}
}
if (showderls > 0)
{
Clrderlres = Clrmovedn ;
Clrderlsupp = Clrmoveup ;
bi = BarIndex() ;
for (i = 1 ; i <= showderls ; i++)
{
res1 = ValueWhen(ismph, H, i) ;
res1bi = ValueWhen(ismph, bi, i) ;
res2 = ValueWhen(ismph, H, i+1) ;
res2bi = ValueWhen(ismph, bi, i+1) ;
supp1 = ValueWhen(ismpl, L, i) ;
supp1bi = ValueWhen(ismpl, bi, i) ;
supp2 = ValueWhen(ismpl, L, i+1) ;
supp2bi = ValueWhen(ismpl, bi, i+1) ;
derlres = LineArray(SelectedValue(res2bi), SelectedValue(res2), SelectedValue(res1bi), SelectedValue(res1), 1) ;
derlsupp = LineArray(SelectedValue(supp2bi), SelectedValue(supp2), SelectedValue(supp1bi), SelectedValue(supp1), 1) ;
Plot(derlres, "", Clrderlres, styleLine|styleNoTitle|styleNoRescale) ;
Plot(derlsupp, "", Clrderlsupp, styleLine|styleNoTitle|styleNoRescale) ;
}
}
//Plot(2, "", IIf(ismphtfe , colorRed, IIf(ismpltfe , colorBlue, colorGrey40)), styleArea|styleOwnScale, 0, 100) ;
//Plot(4, "", IIf(ismph, colorRed, IIf(ismpl , colorBlue, colorGrey40)), styleArea|styleOwnScale, 0, 100) ;
if(showmoves)
{
bi = BarIndex();
edbi = HighestVisibleValue(bi) ;
stbi = LowestVisibleValue(bi) ;
stph = Null ;
stx = 0 ;
edx = 0 ;
edph = Null ;
for (i = stbi; i <= edbi ; i++)
{
if (ismph) // (Refismphtfe[i] AND RefHe[i] == H[i])
{
stph = edph ;
edph = H[i] ;
stx = edx ;
edx = i ;
}
if (ismpl) // (Refismpltfe[i] AND RefLe[i] == L[i])
{
stph = edph ;
edph = L[i] ;
stx = edx ;
edx = i ;
}
if (stx!= 0 AND edx !=0)
{
pline = LineArray(stx, stph, edx, edph);
Plot(pline, "", IIf(stph < edph, Clrmoveup, Clrmovedn), styleThick|styleNoLabel) ;
}
}
if (Connectlast)
{
stx = edx ;
edx = BarCount-1 ;
stph = edph ;
edph = C[edx] ;
if (stx!= 0 AND edx !=0)
{
pline = LineArray(stx, stph, edx, edph);
Plot(pline, "", IIf(stph < edph, Clrmoveup, Clrmovedn), styleThick|styleNoLabel) ;
}
}
}
mut = Refclrtfe == colorBlue ;
mdt = NOT mut ;
showzone = ParamToggle("Show Zone", "No|Yes", 0) ;
showasdefarea = ParamToggle("Show as Def Area", "No|Yes", 1) ;
zoneonbodies = ParamToggle("Zone on bodies", "No|Yes", 1) ;
Layerzone = Param("Layer zone", -4, -5, 5, 1) ;
Clrzone = IIf(mut, ParamColor("Zone UT", colorSkyblue), ParamColor("Zone DT", colorRose)) ;
if (showzone)
{
mph = ValueWhen(ismph, H) ;
mpl = ValueWhen(ismpl, L) ;
mbph = ValueWhen(ismph, Max(C, O));
mbpl = ValueWhen(ismpl, Min(C, O)) ;
hbreak = IIf(ismph, H > Ref(mph, -1), H > mph) ;
lbreak = IIf(ismpl, L < Ref(mpl, -1), L < mpl) ;
Hbreak = ExRem(Hbreak, ismph) ;
Lbreak = ExRem(Lbreak, ismpl) ;
up = Flip(Hbreak, Lbreak) ;
mphbreak = Refclrtfe != Ref(Refclrtfe, -1) AND Refclrtfe == colorBlue;
mplbreak = Refclrtfe != Ref(Refclrtfe, -1) AND Refclrtfe == colorRed;
zmph = IIf(zoneonbodies, mbph, mph) ;
zmpl = IIf(zoneonbodies, mbpl, mpl) ;
if (showasdefarea)
{
zoneh = IIf(up, ValueWhen(hbreak, zmph), ValueWhen(lbreak, zmph)) ;
zonel = IIf(up, ValueWhen(hbreak, zmpl), ValueWhen(lbreak, zmpl)) ;
}
else
{
zoneh = ValueWhen(mphbreake OR mplbreake, zmph) ;
zonel = ValueWhen(mphbreake OR mplbreake, zmpl) ;
}
PlotOHLC(zoneh, zoneh, zonel, zonel, "", Clrzone, styleCloud|styleNoLabel|styleNoRescale,0,0,0,Layerzone) ;
}
showtflvls = ParamToggle("Show Lvls", "No|Yes", 1) ;
Clrtflvl = colorPaleGreen ;
if (showtflvls )
{
Hd = ValueWhen(ismphtfe , He, 1) ;
Ld = ValueWhen(ismpltfe , Le, 1) ;
x = LineArray(0, SelectedValue(Hd), (BarCount-1), SelectedValue(Hd));
Plot(x, NumToStr(tfs/in1Minute, 1.0)+"min mph", Clrtflvl , styleDashed|styleNoRescale);
x = LineArray(0, SelectedValue(Ld), (BarCount-1), SelectedValue(Ld));
Plot(x, NumToStr(tfs/in1Minute, 1.0)+"min mpl", Clrtflvl , styleDashed|styleNoRescale);
}
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
R | Price Action Analysis | Trading Diary | 64 | |
P | Ytc price action trader pdf | Technical Analysis | 3 | |
N | Practicing Equity Swing Trading With Only Price Action Analysis | Swing Trading | 22 | |
T | Nifty Intraday Price Action | Day Trading | 11 | |
P | Hello my fellow traders & price action enthusiast | Introductions | 1 |