PureBytes Links
Trading Reference Links
|
I have been playing around with some code here and I keep getting the
error message:
"memory error - EXE code too large"
Basically, I had some of Williams's fractal stuff and I was just playing
with a few ideas.
The idea is simple. Use a 20 day price channel. When price breaks
above channel, buy. Add to the position at each up fractal or up
squat. The same for selling. Sell on a break below the channel and add
to the position at each down fractal or squat.
Now to be honest, I'm not very good at this EL crap and the problem may
be obvious to those of you who are experts. I've included the rather
large code below. Let me know what you think.
Tom
INPUT: PtsInTic(1), TicExpnd(1),Length(20);
VAR : UpHump(FALSE), DownHump(FALSE), Expansion(0),
Move(0),P1(0),P2(0),P3(0),P4(0);
IF CurrentBar > 1 and Close > Highest(High,Length)[1] Then Buy at
Market;
IF CurrentBar > 1 and Close < Lowest(Low,Length)[1] Then Sell at Market;
UpHump = UpFractal = 1;
DownHump = DownFractal = 1;
IF TicExpnd >= MinimumMove THEN
Move = TicExpnd
ELSE
Move = MinimumMove;
Expansion = Move * PtsInTic;
IF UpHump THEN
BEGIN
IF H[2] >= H[3] AND H[2] > H[4] THEN
BEGIN
IF SquatBar[2] = 1 THEN
P1=HIGH[2] + Expansion Points
ELSE
BEGIN
IF SquatBar[3] = 1 AND H[2] = H[3] THEN
P1=HIGH[3] + Expansion Points
ELSE
P3=HIGH[2] + Expansion Points;
if marketposition=1 then buy at p1[1] stop;
if marketposition=1 then buy at p3[1] stop;
END;
END;
IF H[2] = H[3] AND H[3] = H[4] THEN
BEGIN
IF SquatBar[2] = 1 THEN
P1=HIGH[2] + Expansion Points
ELSE
IF SquatBar[3] = 1 THEN
P1=HIGH[3] + Expansion Points
ELSE
IF SquatBar[4] = 1 THEN
P1=HIGH[4] + Expansion Points
ELSE
P3=HIGH[2] + Expansion Points;
if marketposition=1 then buy at p1[1] stop;
if marketposition=1 then buy at p3[1] stop;
END;
IF H[2] > H[3] AND H[2] = H[4] THEN
BEGIN
IF SquatBar[2] = 1 THEN
P1=HIGH[2] + Expansion Points
ELSE
IF SquatBar[4] = 1 THEN
P1=HIGH[4] + Expansion Points
ELSE
IF SquatBar[3] = 1 THEN
P1=HIGH[2] + Expansion Points
ELSE
P3=HIGH[2] + Expansion Points;
if marketposition=1 then buy at p1[1] stop;
if marketposition=1 then buy at p3[1] stop;
END;
IF H[2] = H[3] AND H[3] = H[4] AND H[4] = H[5] THEN
BEGIN
IF SquatBar[2] = 1 THEN
P1=HIGH[2] + Expansion Points
ELSE
IF SquatBar[3] = 1 THEN
P1=HIGH[3] + Expansion Points
ELSE
IF SquatBar[4] = 1 THEN
P1=HIGH[4] + Expansion Points
ELSE
IF SquatBar[5] = 1 THEN
P1=HIGH[5] + Expansion Points
ELSE
P3=HIGH[2] + Expansion Points;
if marketposition=1 then buy at p1[1] stop;
if marketposition=1 then buy at p3[1] stop;
END;
IF H[2] = H[3] AND H[3] = H[4] AND H[4] = H[5] AND H[5] = H[6] THEN
BEGIN
IF SquatBar[2] = 1 THEN
P1=HIGH[2] + Expansion Points
ELSE
IF SquatBar[3] = 1 THEN
P1=HIGH[3] + Expansion Points
ELSE
IF SquatBar[4] = 1 THEN
P1=HIGH[4] + Expansion Points
ELSE
IF SquatBar[5] = 1 THEN
P1=HIGH[5] + Expansion Points
ELSE
IF SquatBar[6] = 1 THEN
P1=HIGH[6] + Expansion Points
ELSE
P3=HIGH[2] + Expansion Points;
if marketposition=1 then buy at p1[1] stop;
if marketposition=1 then buy at p3[1] stop;
END;
END;
IF DownHump THEN
BEGIN
IF L[2] <= L[3] AND L[2] < L[4] THEN
BEGIN
IF SquatBar[2] = 1 THEN
P2=LOW[2] - Expansion Points
ELSE
BEGIN
IF SquatBar[3] = 1 AND L[2] = L[3] THEN
P2=LOW[3] - Expansion Points ELSE
P4=LOW[2] - Expansion Points;
if marketposition=-1 then sell at p2[1] stop;
if marketposition=-1 then sell at p4[1] stop;
END;
END;
IF L[2] = L[3] AND L[3] = L[4] THEN
BEGIN
IF SquatBar[2] = 1 THEN
P2=LOW[2] - Expansion Points
ELSE
IF SquatBar[3] = 1 THEN
P2=LOW[3] - Expansion Points
ELSE
IF SquatBar[4] = 1 THEN
P2=LOW[4] - Expansion Points
ELSE
P4=LOW[2] - Expansion Points;
if marketposition=-1 then sell at p2[1] stop;
if marketposition=-1 then sell at p4[1] stop;
END;
IF L[2] < L[3] AND L[2] = L[4] THEN
BEGIN
IF SquatBar[2] = 1 THEN
P2=LOW[2] - Expansion Points
ELSE
IF SquatBar[4] = 1 THEN
P2=LOW[4] - Expansion Points
ELSE
IF SquatBar[3] = 1 THEN
P2=LOW[2] - Expansion Points
ELSE
P4=LOW[2] - Expansion Points;
if marketposition=-1 then sell at p2[1] stop;
if marketposition=-1 then sell at p4[1] stop;
END;
IF L[2] = L[3] AND L[3] = L[4] AND L[4] = L[5] THEN
BEGIN
IF SquatBar[2] = 1 THEN
P2=LOW[2] - Expansion Points
ELSE
IF SquatBar[3] = 1 THEN
P2=LOW[3] - Expansion Points
ELSE
IF SquatBar[4] = 1 THEN
P2=LOW[4] - Expansion Points
ELSE
IF SquatBar[5] = 1 THEN
P2=LOW[5] - Expansion Points
ELSE
P4=LOW[2] - Expansion Points;
if marketposition=-1 then sell at p2[1] stop;
if marketposition=-1 then sell at p4[1] stop;
END;
IF L[2] = L[3] AND L[3] = L[4] AND L[4] = L[5] AND L[5] = L[6] THEN
BEGIN
IF SquatBar[2] = 1 THEN
P2=LOW[2] - Expansion Points
ELSE
IF SquatBar[3] = 1 THEN
P2=LOW[3] - Expansion Points
ELSE
IF SquatBar[4] = 1 THEN
P2=LOW[4] - Expansion Points
ELSE
IF SquatBar[5] = 1 THEN
P2=LOW[5] - Expansion Points
ELSE
IF SquatBar[6] = 1 THEN
P2=LOW[6] - Expansion Points
ELSE
P4=LOW[2] - Expansion Points;
if marketposition=-1 then sell at p2[1] stop;
if marketposition=-1 then sell at p4[1] stop;
END;
END;
|