PureBytes Links
Trading Reference Links
|
I'm trying to write the code for a formation. It begins with a long bar
whose open is higher than the close, followed by a 4 - 10 bar uptrend whose
high is lower than the high of the long bar. This is followed by a 4 - 10
bar downtrend, triggered when the last bar violates the long bars' Low.
I came up with this code and it seems right but it's not working.
Vars: Count(2), Stop1(0), Entry1(0);
Condition1 = Open[1] > Close[1];
Condition2 = Low[2] > Low[1] and High[2] < High[1];
Condition3 = High[3] > High[2] and High[3] < High[1];
Condition4 = High[4] > High[3] and High[4] < High[1];
Condition5 = High[5] > High[4] and High[5] < High[1];
Condition6 = High[6] > High[5] and High[6] < High[1];
Condition7 = High[7] > High[6] and High[7] < High[1];
Condition8 = High[8] < High[7];
Condition9 = High[9] < High[8];
Condition10 = High[10] < High[9];
Condition11 = High[11] < High[10];
Condition12 = Condition1 and Condition2 and Condition3 and Condition4 and
Condition5 and Condition6 and Condition7 and Condition8 and Condition9 and
Condition10 and Condition11;
Count = Count + 1;
If condition12 then begin
Stop1 = High[1];
Entry1 = Low[1];
Count = 1;
end;
If Count < 5 then Sell next bar at Entry1 stop;
If MarketPosition > 0 then ExitShort next bar at Stop1 stop;
I, as always, appreciate any help.
Thanks,
Vince
|