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

Gremlins in TS or crappy code



PureBytes Links

Trading Reference Links

Can anyone tell me what is the problem with this code?  I am just trying to
build something here so please no comments on how dumb this idea may or may
not be... But it works perfectly sometimes and then other times does not.
What it is trying to do right now is wait for OB to be long or short and
then buy the breakout of yesterday's high or low.  As you can see by the
attched gif, on the first trade pictured it enters fine, but on the second
trade it does not enter properly.  Yesterday's high is plotted as a green
line and yesterday's low is plotted as a red line.   There is a red dot on
the opening bar.  Blue bars mean permission is long.


Begin

If OddBall_Permission(7,0,0) = 1 and OpenD(0) < HighD(1) Then Buy at
HighD(1) Stop;
If OddBall_Permission(7,0,0) = -1 Then ExitLong;

If OddBall_Permission(7,0,0) = -1 and OpenD(0) > LowD(1) Then Sell at
LowD(1) Stop;
If OddBall_Permission(7,0,0) = 1 Then ExitShort;

SetExitOnClose;

End;


Also what I need to do is specify not to take new trades that day if
permission changes during the day ie. wait until tomorrow, but I don't know
how to do that.  Any insights would be appreciated.

Thanks,

David

Attachment: Description: "gremlins.gif"