[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

EL help



PureBytes Links

Trading Reference Links

Hi, I'm trying to code a countertrend system proposed by Robert Barnes in
"Cutting Edge Futures Trading Methods For 21st Century"(1996). Trades are
made within a channel as price approaches upper and lower boundaries.

I need to find the highest 3 closes of the previous 30 days and average them
to get the upper channel boundary.
I also need to find the median close(of 30)which I'm taking as datapoint 16,
then the datapoint either side of it and average the 3 points to get a
potential exit area for the trade.

Barnes's manual method recalulates every 30 days. I'm wondering if
recalulating daily would give a better result. That is using an array and
loop to keep dropping the last close out of the array then recalculating the
boundaries.

I've bogged down finding the 3 highest Closes within the array and averaging
them. Finding the median and the values either side of it also has me
stumped. I've cannabilised code from the Omega "System Trading & Development
Book 1" and this is what I have so far:

Input:
Vars:Counter(0),
Array:Clos[1,29](0); {to store barnumbers and last 30 closes- I don't know
if I need the
                      barnumbers yet? }

If currentbar>1 then begin
         For counter = 0 to 29 begin
           Clos[0,30-counter] = Clos[0,29-counter];
           Clos[1,30-counter] = Clos[1,29-counter];
         End;
           Clos[0,0] = BarNumber;
           Clos[1,0] = Close;
End;

 {Next section finds 3Highest Closes of the array & averages them, 3Lowest
Closes & averages them, one either side of the median & averages the median
with them. }

????????????????????????????????????????????????????????????????????????????
?

Any help would be most appreciated.
Thankyou, Bob Rowlinson.