Version(5.6);
function ToChartX(Pixels)
{
lvb=Status("lastvisiblebar");
fvb=Status("firstvisiblebar");
pxchartleft=Status("pxchartleft");
pxchartwidth=Status("pxchartwidth");
fac=pxchartwidth/Pixels;
bar=(lvb-fvb)/fac;
return bar;
}
function ToChartY(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 Value;
}
function ToScrX(bar)
{
lvb=Status("lastvisiblebar");
fvb=Status("firstvisiblebar");
pxchartleft=Status("pxchartleft");
pxchartwidth=Status("pxchartwidth");
return pxchartleft+bar*pxchartwidth/(lvb-fvb+1);
}
function ToScrY(value)
{
local Miny,Maxy,pxchartbottom,pxchartheight;
Miny=Status("axisminy");
Maxy=Status("axismaxy");
pxchartbottom=Status("pxchartbottom");
pxchartheight=Status("pxchartheight");
return pxchartbottom-floor(0.5+(Value-Miny)*pxchartheight/(Maxy-Miny));
}
function GetVisiBarsPerChart()
{
lvb = Status( "lastvisiblebar" );
fvb = Status( "firstvisiblebar" );
return Min( Lvb - fvb, BarCount - fvb );
}
bgTop = ParamColor("BgTop", colorBlack);
bgBot = ParamColor("BgBottom", colorBlack);
SetChartBkGradientFill( bgTop ,bgBot);
lvb = Status("lastvisiblebar");
fvb = Status("firstvisiblebar");
GfxSetBkMode( 0 );
GfxSelectFont("Arial", 8, 400, False, False, 900);
GfxSetTextColor(colorWhite);
Plot(V,"",IIf (C>O, colorGreen, colorRed),styleHistogram|styleNoLabel, Null,Null, 0,0, 5);
Buy=V>Ref(HHV(V,30),-1);
TotalBars = Lvb - fvb;
for( i = 0; i < TotalBars AND i < ( BarCount - fvb ); i++ )
{
if( Buy[i] )
{
s= NumToStr(V[i]/1000000, 1.0);
GfxTextOut( s, ToScrX(i), ToScrY(V[i]));
}
}