Thursday, September 24, 2009

Finding New Intraday Highs/Lows

Here is tradestation code to find stocks that are making consistent HOD and LOD. Use this in RadarScreen.

vars: highCount(0), lowCount(0), length(0), plotValue(0), highestHigh(0), lowestLow(10000);

If Date <> Date[1] then begin
highCount = 0;
lowCount = 0;
length = 0;
highestHigh = 0;
lowestLow = 10000;
end;

if High > highestHigh then begin
highCount = highCount + 1;
highestHigh = high;
Alert("New High");
end;

if Low < lowestLow then begin
lowCount = lowCount + 1;
lowestLow = low;
Alert("New Low");
end;

plotValue = highCount - lowCount;
Plot1(plotValue, "H/L Count");

if(plotValue > 0) then
SetPlotColor(1, Green)
else if(plotValue < 0) then
SetPlotColor(1, Red)
else SetPlotColor(1, White);