_SECTION_BEGIN("Start");
ChartType =ParamToggle("Chart Type"," EquiVolume | CandleVolume",1);
UpColor =ParamColor("Up Close",colorLightGrey);
DnColor =ParamColor("Dn Close",colorGrey50);
Plot(Close,"",39,styleBar|styleNoDraw);
MinVolume =LowestVisibleValue( Volume );
MaxVolume =HighestVisibleValue( Volume );
Chg = C > Ref(Close,-1);
_SECTION_END();
Maxy =Status( "axismaxy" );
Miny =Status ( "axisminy" );
pxchartheight =Status ( "pxchartheight" );
pxchartbottom =Status( "pxchartbottom" );
pxchartwidth =Status ( "pxchartwidth" );
pxchartleft =Status( "pxchartleft" );
fvb =Status ( "firstvisiblebar" );
Lvb =Status ( "lastvisiblebar" );
Space = Param("Bar-Spsce",1,-10,5,1);
function yConvert( Value )
{
return pxchartbottom - floor( 0.5 + ( Value - Miny ) * pxchartheight / (Maxy - Miny ) );
}
MinVolume =LowestVisibleValue( Volume );
MinVolume =Max ( Minvolume, 1 );
sigma =0 ;
for ( i = BarCount - 1 ; i > fvb - 1 ; i -- )
{
ratio =Volume[i] / MinVolume;
sigma +=ratio;
}
visiblebars =Lvb - fvb + 1;
totalspace =Visiblebars * space;
unitpx =( pxchartwidth - totalSpace ) / sigma; // pixel
LastbarRatio =Volume [BarCount -1] / MinVolume;
delta =unitpx * Lastbarratio / 2;
start = pxchartleft + ( BarCount - fvb - 1 ) * pxchartwidth / Visiblebars + delta;
//--------------------------------------------------------------------------------------------
for ( i = BarCount - 1 ; i >= fvb && start > 0 ; i -- )
{
ratio =Volume[i] / MinVolume;
width =unitpx * ratio ;
width =Min ( width , pxchartwidth / 5 ); // limit max bar width in pixel to chartwidh/5
if ( ChartType == 0 )
{
x =start - (width / 2);
}
y1 =yConvert ( High[i] );
y2 =yConvert ( Low[i] );
if ( ChartType == 0 )
{
GfxMoveTo(x,y1);
GfxLineTo(x,y2);
}
x1 =start - width;
x2 =start ;
if ( ChartType == 0 )
{
y1 =yConvert ( Open[i] );
y2 =yConvert ( Close[i] );
}
//--------------------------------------------------------------------------------------------
PenColor =IIf(Chg[i] > 0,UpColor,DnColor);
GfxSelectPen( colorBlack,1 );
GfxSelectSolidBrush( PenColor);
//--------------------------------------------------------------------------------------------
Hgt =(y2 - y1);
if(Hgt == 0)
Hgt =1;
y2 =(y1 + Hgt);
GfxRoundRect(x1,y1,x2,y2,3,3);
start =x1 - Space;
}
RequestTimedRefresh( 1 );
_SECTION_BEGIN("HEading");
Change = Close-Ref(Close,-1);
BrushCol =ParamColor("BrushColor",colorDarkGrey);
TxtCol =ParamColor("TxtColor",colorWhite);
YC = TimeFrameGetPrice( "C", inDaily, -1 );
DD = Prec( C - YC, 2 );
xx = Prec( ( DD / YC ) * 100, 2 );
GfxSelectSolidBrush( BrushCol );
GfxRectangle(1,25,1640,1);
GfxSetTextAlign(6);
GfxSetBkMode(0);
GfxSetTextColor(TxtCol);
GfxSelectFont( "Futura",8,700,False );
GfxTextOut(
Name()+" ..... "+
Interval(2)+
" ..... Date: "+Date()+
" ..... Open: "+WriteVal(Open,5.2)+
" ..... Hi: "+WriteVal(High,5.2)+
" ..... Lo: "+WriteVal(Low,5.2)+
" ..... Close: "+WriteVal(Close,2.2)+
" ..... Change: " + WriteVal(DD,5.2)+
" ..... " + xx + "%",Status("pxwidth")/2,Status("pxheight")/125);
_SECTION_END();