PureBytes Links
Trading Reference Links
|
Someone asked for a "123" code. Assume that was for Haggerty. Just in
case, here's the code for Jeff Cooper's 1-2-3-4 from his book "Hit and Run
Trading." (Posted with permission.)
It's interesting if you're looking for a way define trend and pullback.
Also shows how to write code to enter on the first bar in which price takes
out a prior high or low to resume a trend.
As you can see, it was coded by Stuart Okorofsky for the software add-on to
Jeff's book and both book and sofware are available from TradingMarkets.com.
Here's the code with an attached ela. Note that this is a Show Me, not an
Indicator.
Bill M
Vero Beach FL
{Copyright (c) 1996 Stuart Okorofsky
PO Box 23
Rosendale NY 12472
(914) 658-9706 (voice)
(914) 658-9853 (fax)
Krofs@xxxxxxx (e-mail)
This version is used to show historically which days would have been flagged
for the 1-2-3-4 Trading System
}
Inputs:
UsePrice(true), {If true, Minimum price filter will be used}
MinPrice(50), {Min Price of stock}
UseVol(false), {If true, Volume filter will be used}
MaxVol(200000), {Max avg daily volume allowed}
MinVol(25000), {Min Avg Daily Volume needed}
VolLen(10), {# of days to use in Avg Volume calculation}
UseADX(true), {If true, ADX will be used as a filter}
ADXLen(14), {Length of ADX}
MinADX(30), {Min ADX value required}
UseDMI(true), {If true, use DMI+ and DMI-}
UseHiLo(false), {If true, we are looking for a new High or Low}
NumDays(43); {Number of trading days looked at for new High or Low}
Vars:ADXVal(0),HigherHigh(false),LowerLow(false),InsideDay(false),
DMIPlusVal(0),DMIMinusVal(0);
Vars:AVGVol(0);
ADXVal = ADX(ADXLen);
DMIPlusVal = DMIPlus(ADXLen);
DMIMinusVal = DMIMinus(ADXLen);
HigherHigh = high > high[1];
LowerLow = low < low[1];
InsideDay = high <= high[1] and low >= low[1];
AVGVol = Average(Volume,VolLen);
if ((AVGVol<=MaxVol and AVGVol>=MinVol ) or UseVol = false) AND
((ADXVal >= MinADX) or UseADX = false) AND
((Close >= MinPrice) or UsePrice = false) THEN
begin
if DMIPlusVal > DMIMInusVal AND
((HIGH[3] > highest(high,NumDays-1)[4]) or UseHiLo = false) AND
(high[3] > high[4]) AND
((LowerLow and LowerLow[1] and LowerLow[2]) OR
(LowerLow and LowerLow[1] and InsideDay[2]) OR
(LowerLow and InsideDay[1] and LowerLow[2]) OR
(InsideDay and LowerLow[1] and LowerLow[2])) THEN
begin
plot1(high+1/8,"1-2-3-4-Buy");
plot3(lowest(low,3),"Stop");
alert = true;
end;
if DMIPlusVal < DMIMInusVal AND
((LOW[3] < lowest(low,NumDays-1)[4]) or UseHiLo = false) AND
(low[3] < low[4]) AND
((HigherHigh and HigherHigh[1] and HigherHigh[2]) OR
(HigherHigh and HigherHigh[1] and InsideDay[2]) OR
(HigherHigh and InsideDay[1] and HigherHigh[2]) OR
(InsideDay and HigherHigh[1] and HigherHigh[2])) THEN
begin
plot2(low-1/8,"1-2-3-4-Sell");
plot4(highest(high,3),"Stop ");
alert = true;
end;
end;
Attachment:
Description: "1-2-3-4.ELA.ELA"
|