PureBytes Links
Trading Reference Links
|
Can anyone help me. I am trying to program a system from Dr. Martin Zweig.
Its buys when the market goes up 4%. Then If the market goes in the
opposite direction by 4% a sell signal is generated. Here is the code that
I have been working on.
It bought in early 1983 and is up $200,000 but I need it to reverse and sell.
What am I doing wrong???
Rob
============================================================================
=======
Input: UpPer(4), DownPer(4);
Var: NewHigh(0), NewLow(0), Once(True);
Var: InHigh(False), InLow(False);
if Once then Begin
NewLow = Low;
NewHigh = High;
end;
if (InHigh or Once) and
(Low <= ( (1 - (DownPer/100)) * NewHigh)) then Begin
Sell tomorrow at open;
end;
if (InLow or Once) and
(High >= ( (1 - (UpPer/100)) * NewLow)) then Begin
Buy tomorrow at open;
end;
Once = False;
|