PureBytes Links
Trading Reference Links
|
This is an example of how helpful it is to be able to draw our own
creations.
The code is attached
Jim Hutchison
GfxSetOverlayMode(2);
Page = Param("Page #",0,0,12,1);
listNum= Param("Watch List Num" ,0,0,50,1); ;//enter watchlist number
ChartsWiNum = Param("# Charts Wide",3,1,4,1);
ChartsHiNum = Param("# Charts High",3,1,4,1);
ChartMargin = 5 ;
DataMargin = 20 ;
NumCharts = ChartsWiNum * ChartsHiNum ;
ScreenHeight = Status("pxheight") ;
SceernWidth = Status("pxwidth") ;
ChartHeight = ScreenHeight / ChartsHiNum -2 ;
Width = SceernWidth / ChartsWiNum - 2;
BarChartHeight= (0.80) * ChartHeight - DataMargin;
VolChartHeight = ChartHeight - BarChartHeight - DataMargin ;
NumberPriceLevels = BarChartHeight / 25;
BarChartWidth= Width - 45;
Bars =Param("Number Of Bars", 195,50,250,1) ;
BarWidth = (BarChartWidth - ChartMargin * 3) / Bars ;
LastBar = BarCount ;
FirstBar = LastBar - Bars;
_N(list = CategoryGetSymbols( categoryWatchlist, listnum ));
printf("Watch List Name\n");
WL = CategoryGetName( categoryWatchlist, listnum );
s = Page * NumCharts;
/*
_TRACE("ScreenHeight "+WriteVal(ScreenHeight));
_TRACE("ChartHeight "+WriteVal(ChartHeight));
_TRACE("VolChartHeight "+WriteVal(VolChartHeight));
_TRACE("BarChartHeight "+WriteVal(BarChartHeight));
*/
for( x = 0; x < ChartsHiNum ; x++ )
{
for( i = 0; i < ChartsWiNum ; i++ )
{
sym = StrExtract( list, s );
if(sym != "")
{
x1 = Width * i + 5;
y1 = ChartHeight * x + 5;
x2 = Width * (i + 1);
y2 = ChartHeight * (x + 1);
GfxSelectPen( colorBlack );
GfxRectangle( x1, y1, x2, y2 );
SetForeign(sym);
s++;
priceHigh = 0;
VolHigh = 0;
priceMin = 1000000;
for( z = FirstBar; z < LastBar ; z++ )
{
Vol = V[z];
BarH = H[z];
BarL = L[z];
if( Vol > VolHigh )
{
VolHigh = Vol;
}
if( BarH > priceHigh )
{
priceHigh = BarH;
}
if( BarL < priceMin )
{
priceMin = BarL;
}
}
LOpen = O[LastBar-1];
LHigh = H[LastBar-1];
LLow = L[LastBar-1];
LClose = C[LastBar-1];
LVol = V[LastBar-1];
GfxSelectFont("Tahoma", 9 );
GfxSetTextColor(colorBlack);
GfxTextOut(sym + " O-" +LOpen + " H-" +LHigh + " L-" +LLow + " C-" +LClose + " Vol-" +LVol/ 1000000+ " M", x1+5, y1+2);
VolRatio = VolChartHeight / VolHigh ;
Range = priceHigh - priceMin;
Ratio = BarChartHeight / Range ;
PriceLineLevel = Range / NumberPriceLevels;
yHi=(((priceHigh - priceMin )* Ratio) - BarChartHeight) * -1 + y1 + DataMargin;
GfxTextOut(WriteVal(priceHigh, 1.2), x1 + BarChartWidth, yHi -8);
GfxSelectPen( colorLightGrey );
GfxMoveTo( x1 , yHi );
GfxLineTo( x1 + BarChartWidth -5, yHi );
/*
_TRACE("x "+WriteVal(x));
_TRACE("i "+WriteVal(i));
_TRACE("VolHigh "+WriteVal(VolHigh));
_TRACE("VolChartHeight "+WriteVal(VolChartHeight));
_TRACE("VolRatio "+WriteVal(VolRatio,1.8));
_TRACE("Ratio "+WriteVal(Ratio));
_TRACE("PriceLineLevel "+WriteVal(PriceLineLevel));
*/
for( z = 0; z < NumberPriceLevels ; z++ )
{
PriceLevel = PriceLineLevel*z + priceMin;
yHi=(((PriceLevel - priceMin )* Ratio) - BarChartHeight) * -1 + y1 + DataMargin;
GfxTextOut(WriteVal(PriceLevel, 1.2), x1 + BarChartWidth, yHi -8);
GfxSelectPen( colorLightGrey );
GfxMoveTo( x1 , yHi );
GfxLineTo( x1 + BarChartWidth -5, yHi );
}
HighestLast = 0;
w = 1;
for( z = FirstBar; z < LastBar ; z++ )
{
BarH = H[z];
BarL = L[z];
BarO = O[z];
BarC = C[z];
Vol = V[z];
vHi= Vol * VolRatio - VolChartHeight + y2;
yHi=(((BarH - priceMin )* Ratio)- BarChartHeight ) * -1 + y1 + DataMargin;
yLo= (((BarL - priceMin )* Ratio) - BarChartHeight) * -1 + y1 + DataMargin;
if( BarH > HighestLast )
{
HighestLast = BarH;
GfxSelectPen( colorBlue );
}
else
{
GfxSelectPen( colorRed );
}
GfxMoveTo( BarWidth * w + x1 + ChartMargin , yHi );
GfxLineTo( BarWidth * w + x1 + ChartMargin, yLo );
if( BarO > BarC)
{
GfxSelectPen( colorRed );
}
else
{
GfxSelectPen( colorLime );
}
GfxMoveTo( BarWidth * w + x1 + ChartMargin , vHi );
GfxLineTo( BarWidth * w + x1 + ChartMargin, y2 );
w++;
}
RestorePriceArrays();
}
}
}
|