Herman;

My heat map isn't working.  I've tinkered a bit but can't quite get it.  My 
MaxList seems OK (see the title, I only have 5 tickers in it right now).  Can 
you see something obvious?

I noticed that the variable YStep is initialized but never used.

chuck





// Heat-Map by Herman - 06DEC2007 - TEST/DEMO ONLY!

// Set Param -> Axis & Grid: NO Middle Lines

// Convert Variable-To-Map to 0-99 range

// Zoom Chart to get nice display



SetBarsRequired(1000000,1000000);

GraphXSpace = 0;

GraphZOrder = False;

SetChartOptions( 3, chartShowDates);

RequestTimedRefresh( MApRefreshInterval = 5 );

//RefreshMap = Status("redrawaction");

RefreshMap = ParamTrigger("Redraw", "Redraw");

WLNum = Param("WatchList Number",0,0,64,1);

TickersToMap = Param("Num. Tickers to Map",10,1,64,1);

MaxTickers = Param("Max. Tickers",50,2,100,1);

MaxHue = Param("Max. Hue",255,0,255,1);

MinHue = Param("Min. Hue",97,0,255,1);


if( RefreshMap )

{ 

TickersToMap = Min(TickersToMap, MaxTickers);

List = CategoryGetSymbols( categoryWatchlist, WLNum );

MaxList = "";

for( T=0; (Ticker=StrExtract( List, T))!= "" AND T < TickersToMap; T++)

{

MaxList = MaxList + Ticker +",";

StaticVarSetText("Ticker"+T, Ticker);

}

StaticVarSetText("MaxList",MaxList);

BI = BarIndex();

MaxYCoordinate = TickersToMap;

MinYCoordinate = 1;

MinXBarindex = BarCount-TickersToMap;

MaxXBarindex = BarCount-1;

CellCount = 0;

XCoordinate = YCoordinate = 0;

MaxList = StaticVarGetText("MaxList");

for( Y=MinYCoordinate; Y <= TickersToMap; Y++ )

{

for( X=MinXBarindex; X <= MaxXBarindex; X++ )

{

XTicker = StaticVarGetText("Ticker"+XCoordinate); 

YTicker = StaticVarGetText("Ticker"+YCoordinate);

VarToMap = Cellcount; // must be in range 0-99

StaticVarSet(XTicker+"-"+YTicker, VarToMap);

XCoordinate++;

CellCount++;

}

XCoordinate=0;

YCoordinate++;

}

} //if refreshmap

Plot(-1,"",1,styleNoLine|styleNoLabel);

Plot(TickersToMap,"",1,styleNoLine|styleNoLabel);

BI = BarIndex();

MaxYCoordinate = TickersToMap;

MinYCoordinate = 1;

MinXBarindex = BarCount-TickersToMap;

MaxXBarindex = BarCount-1;

YStep = int(MaxYCoordinate/TickersToMap);

XCoordinate = YCoordinate = 0;

for( Y=MinYCoordinate; Y<=MaxYCoordinate; Y++)

{

for( X = MinXBarindex; X <= MaxXBarindex; X++ )

{

XTicker = StaticVarGetText("Ticker"+XCoordinate); 

YTicker = StaticVarGetText("Ticker"+YCoordinate);

VarToMap = StaticVarGet(XTicker+"-"+YTicker); 

HueStep = (MaxHue - MinHue)/100;

Co = ColorHSB(Min(255,int((100-VarToMap)*HueStep)),255,255);

printf(Yticker);

PlotText(NumToStr(VarToMap,1.0),X,Y-0.5,1);

if( XTicker == YTicker ) Co = colorBlack;

Plot(IIf(X==BI,Y,Null),"",Co,styleArea|styleOwnScale|styleNoLabel,-1,MaxYCoordinate*1.03);

XCoordinate++;

}

XCoordinate = 0;

YCoordinate++;

} 



for(T=0; T<=TickersToMap; T++) 

{

Ticker = StaticVarGetText("Ticker"+T);

//printf(Ticker);

PlotText(Ticker,BarCount,T+0.5,9);

PlotText("\n"+Ticker,BarCount-TickersToMap+T,-0.5,9);

}


MaxList = StaticVarGetText("MaxList");

Title = "Heat Map for Watchlist #"+NumToStr(WLNum,1.0,False)+": "+MaxList;



<<attachment: clip_image002.jpg>>

Reply via email to