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

Oddball system variation



PureBytes Links

Trading Reference Links

I thought sharing this might be helpful to someone.

{Variation of oddball system by Mark Brown.
Indifferent to bar length if <= interval, and to extraneous night session
data.
First and last are start and end times.  Interval is time in minutes between
pollings.}

Inputs: bz(3), sz(1), first(1000), interval(60), last(1600);
var: rai(0), action(0);
array: obtime[1000](0), obvalue[1000](0);

obtime[1] = timetominutes(first);
value1 = 1;
while obtime[value1] < timetominutes(last) begin
	value1 = value1 + 1;
	obtime[value1] = obtime[value1-1] + interval;
end;

action = 0;
for value2 = 1 to value1 begin
	if timetominutes(time) = obtime[value2] then begin
		if obvalue[value2] > 0 then begin
			rai = ((close of data2) / obvalue[value2] - 1) * 100;
			If rai > bz Then action = 1;
			If rai < sz Then action = -1;
		end;
		obvalue[value2] = close of data2;
	end;
end;

if action = 1 then buy;
if action = -1 then sell;