01-31-2010, 08:37 AM
|
#5 |
Join Date: Sep 2008 Location: Geelong Thanks: 2,084
Thanked 1,477 Times in 912 Posts
| Re: Kelly's Cycle Identifier Code: {Scalper Buys and Sells 7/18/2007
Written by Luis Gomez
inspired by John Carters "Mastering the Trade"
This plots swing highs/lows with a strength of 2 bars on each side, on the condition that there is a
close above/below the high/low the bar after the said swing bar......whew that's a mouthful!
31.07.2007 added some modifications by insideday for displaying on the bottom and with filter
}
inputs:
UsesFilter(1), //added (0) = No Filter, 1= ATR , 2 = Points
MinimumDiffPoints(4), // Points for UsesFilter=2
ATRMult (3),
ATRLen (40);
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),
MinimumDiff (0);
//UsesFilter added
If UsesFilter=0 then MinimumDiff =0 else
if UsesFilter=1 then MinimumDiff = ATRMult *AvgTrueRange(ATRLen)else
MinimumDiff=MinimumDiffPoints;
//***************************************************
//****** 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
and (H[highBarsAgo]-L[lowBarsAgo])>= MinimumDiff then begin //added
plot1[highBarsAgo](1,"HL",white);
//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
and (H[highBarsAgo]-L[lowBarsAgo])>= MinimumDiff then begin //added
plot1[lowBarsAgo](-1,"HL",white);
//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;
plot1(0,"HL",white);
__________________ Only an idiot would reply to a stupid post |
| |