thanks, @bbhanushali & @Romeo1998
Last edited:
_SECTION_BEGIN("Bar Count");
// 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]
//
// mode Text - show the barcount as a number above/below the price bars
// every n bars as set
// mode Histogram- shows the barcount as an histogam. Best used on a different pane
//
showhisto = ParamToggle("Mode", "Text|Histogram", 0) ;
everyn = Param("Show Text Every N bars", 3, 1, 10000, 1) ;
showabove = ParamToggle("Show Pos", "Below|Above", 0) ;
Clrtext = ParamColor("Text Color", colorBlack) ;
nd = Day()!=Ref(Day(),-1) ;
nbar = 1+BarsSince(nd) ;
if (showhisto)
Plot(nbar, "Day Bar Count", colorBlue, styleHistogram) ;
else
{
bi = BarIndex() ;
showtextbar = ((nbar -1) % everyn) == 0 ;
if (showabove)
{
pos = H ;
Offset = 10 ;
}
else
{
pos = L ;
Offset = -10;
}
Visfirst = FirstVisibleValue(bi) ;
Vislast = LastVisibleValue(bi) ;
for (i = Visfirst; i <= Vislast ; i++)
{
if (showtextbar[i])
{
str = NumToStr(nbar[i], 1.0) ;
PlotText(str, i, pos[i]+Offset, Clrtext) ;
}
}
// PlotShapes(showtextbar*shapeSmallCircle, colorBlue, 0, H, 50) ;
}
_SECTION_END();
zTickSize=0.05;
function zRoundUp(zValue) {return ceil(zValue/zTickSize)*zTickSize;}
function zRoundDown(zValue) {return floor(zValue/zTickSize)*zTickSize;}
pricex = 9744.351;
t2 = zRoundDown(pricex) ;
_N( Title = ( "" + t2 ) ) ;
TimeFrameSet(inMonthly);
pmh = H;
pml = L;
TimeFrameRestore();
pmh = TimeFrameExpand(pmh,inMonthly,expandFirst);
pml = TimeFrameExpand(pml,inMonthly,expandFirst);
pmh_date = ValueWhen(pmh==H ,DateNum());
pml_date = ValueWhen(pml==l ,DateNum());
Filter = Month()!=Ref(Month(),1);
AddColumn(PMH,"P Month High");
AddColumn(pmh_date,"PMH_date",1.0);
AddColumn(PML,"P Month Low");
AddColumn(pml_date,"PML_date",1.0);
TimeFrameSet(inMonthly);
pmh = H;
pml = L;
TimeFrameRestore();
pmh = TimeFrameExpand(pmh,inMonthly,expandFirst);
pml = TimeFrameExpand(pml,inMonthly,expandFirst);
pmh_date = ValueWhen(pmh==H ,DateNum());
pml_date = ValueWhen(pml==l ,DateNum());
Filter = Month()!=Ref(Month(),1);
AddColumn(PMH,"P Month High");
AddColumn(pmh_date,"PMH_date",1.0);
AddColumn(PML,"P Month Low");
AddColumn(pml_date,"PML_date",1.0);