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

What's wrong with this code?



PureBytes Links

Trading Reference Links

Omega List,

Can anyone tell me what is wrong with this code?  It is meant to be an
opening range breakout day trading system which defines a channel high and
low between 9:30 and 11:00 am and buys/sells the breakout/breakdown of this
channel and exits on the close.  For some reason though, it doesn't do that.
For one thing, it buys before the channel is complete, often on the first
bar of the day (?).  Also, it sometimes buys/sells after the channel at the
proper point, but also at some arbitrary points as well.  HELP!

Thanks in advance for your help,

David Folster



INPUT:BEGINCH(930),ENDCH(1100);

VARS:CH(H),CL(L);

IF TIME = BEGINCH + BARINTERVAL THEN BEGIN
     CH = H;
     CL = L;
END;

IF TIME >= BEGINCH AND TIME <= ENDCH THEN BEGIN
     IF H > CH THEN CH = H;
     IF L < CL THEN CL = L;
END;


IF TIME > ENDCH THEN BUY AT CH + 1 STOP;
IF TIME > ENDCH THEN SELL AT CL -1 STOP;

SetExitOnClose;