Traderlu - thanks for your help on this indicator. I could use some your help on how should the code be written if I wanted to use it in a Radar screen on Tradestation? i changed the colors so the bars a blue for a short and white for a long...I am assuming this is the same code you have posted..
Thanks for your help!
The code is:
{Scalper Buys and Sells 7/18/2007
Written by Luis Gomez
inspired by John Carters "Mastering the Trade"
}
inputs:
buyColor(white),
sellColor(blue),
width(3);
variables:
highBarsAgo(1),
possibleHighBarsAgo(1),
possibleHigh(-2),
hightoBeat(-1),
barsSincePaint(1),
lowBarsAgo(1),
possibleLowBarsAgo(1),
possibleLow(10000001),
lowtoBeat(10000000),
triggerPriceSell(-1),
triggerPriceBuy(1000000),
trend(1),
_UP(1),
_DOWN(-1),
_ON(1),
_OFF(-1);
//***************************************************
//****** Find and plot the highest swing high *******
//***************************************************
if trend = _UP then begin
if swingHighBar(1,H,2,barsSincePaint+2) > -1 then begin
possibleHighBarsAgo = swingHighBar(1,H,2,barsSincePaint+2);
possibleHigh = H[possibleHighBarsAgo];
end;
if possibleHigh >= hightoBeat then begin
highBarsAgo = possibleHighBarsAgo;
hightoBeat = possibleHigh;
triggerPriceSell = L[HighBarsAgo - 1];
end;
if C < triggerPriceSell and
highest(high,highBarsAgo) < hightoBeat then begin
plotpb[highBarsAgo](H[highBarsAgo],L[highBarsAgo],"",sellColor);
alert("Scalper Sell");
trend = _DOWN;
barsSincePaint = highBarsAgo-1;
hightoBeat = -1;
lowtoBeat = 10000000;
triggerPriceBuy = 10000000;
triggerPriceSell = -1;
highBarsAgo = 1;
possibleHigh = -2;
end;
end;
//***************************************************
//****** Find and plot the lowest swing low *********
//***************************************************
if trend = _DOWN then begin
if swingLowBar(1,L,2,barsSincePaint+2) > -1 then begin
possibleLowBarsAgo = swingLowBar(1,L,2,barsSincePaint+2);
possibleLow = L[possibleLowBarsAgo];
end;
if possibleLow <= lowtoBeat then begin
lowBarsAgo = possibleLowBarsAgo;
lowtoBeat = possibleLow;
triggerPriceBuy = H[LowBarsAgo - 1];
end;
if C > triggerPriceBuy and
lowest(L,lowBarsAgo) > lowtoBeat then begin
plotpb[lowBarsAgo](H[lowBarsAgo],L[lowBarsAgo],"",buyColor);
alert("Scalper Buy");
trend = _UP;
barsSincePaint = lowBarsAgo-1;
possibleLow = 10000001;
lowtoBeat = 10000000;
hightoBeat = -1;
triggerPriceBuy = 10000000;
triggerPriceSell = -1;
lowBarsAgo = 1;
end;
end;
barsSincePaint = barsSincePaint+1;
if trend = _UP then highBarsAgo = highBarsAgo + 1;
if trend = _DOWN then lowBarsAgo = lowBarsAgo + 1;
setPlotWidth(1,width);