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

A different question entirely (was Need Help with System)



PureBytes Links

Trading Reference Links

I just wanted to say thank you to all the individuals who helped me out with
my problem - it looks like I figured it out.  For some reason, these two
bits of code do not produce the same result, although they (seemingly,
logically) should.  The basic idea here is that, if the closes of the past
three bars have been increasingly higher, you should sell on the open of the
fourth, that is, tomorrow (an common idea).  If you're already short/long
for some reason, you put on a larger position (5 lots instead of 2).  This
is NOT the code I was working on - it's just an analogous example.  If I'm
missing something here, let me know, but I don't think it makes sense that
these two don't produce the exact same results.  Try them yourself and see.
Why is this?  Thanks.

BJ

{This one does not produce the desired results}
IF Close > Close[1] AND Close[1] > Close[2] AND Close[2] > Close[3]
THEN Value1=1;

IF Close < Close[1] AND Close[1] < Close[2] AND Close[2] < Close[3]
THEN Value1=0;

IF Value1=1 AND MarketPosition >= 0 THEN Sell 2 Contracts Tomorrow at
Open -2 points stop;
IF  Value1=1 AND MarketPosition < 0 THEN Sell 5 Contracts Tomorrow at
Open -2 points stop;
IF Value1=0 AND MarketPosition <= 0 THEN Buy 2 Contracts Tomorrow at Open +2
points stop;
IF  Value1=0 AND MarketPosition > 0 THEN Buy 5 Contracts Tomorrow at Open +2
points stop;

{This one does}
BEGIN;

    IF Close > Close[1] AND Close[1] > Close[2] AND Close[2] > Close[3]
    THEN begin;

    IF MarketPosition >= 0 THEN Sell 2 Contracts Tomorrow at Open -2 points
stop;
    IF MarketPosition < 0 THEN Sell 5 Contracts Tomorrow at Open -2 points
stop;
    end;

    IF Close < Close[1] AND Close[1] < Close[2] AND Close[2] < Close[3]
    THEN begin;

    IF MarketPosition <= 0 THEN Buy 2 Contracts Tomorrow at Open +2 points
stop;
    IF MarketPosition > 0 THEN Buy 5 Contracts Tomorrow at Open +2 points
stop;
    end;

END;