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

Quick EL question



PureBytes Links

Trading Reference Links

Can anyone tell me why this (the code is below) doesn't ever trigger?  The
idea is this:

1) Check to see if it is a half-hour before the end of the day session.
2) If so, check to see if the last price is outside of a 25% range of the
closing price of the prior day's trading.
3) If so, buy or sell, appropriately - if the price is below 25% of the
prior day's close, buy, and if it is above 25% of the prior day's close,
sell.  So if yesterday closed at 100, and the price one-half hour before
today's close is below 75, I want to buy, and if it is above 125 I want to
sell.
4) If I have a position, I want to exit the market, 30 minutes before the
close, the very next day.

So, what am I doing wrong?  Thanks!

Peter

INPUTS: Pct(.25), Cons(2);

BEGIN

    IF CurrentTime = (Sess1EndTime - 30) THEN begin

        IF Close > Close[1] + (Pct * Close[1])
        THEN Sell Cons Contracts at Market;

        IF Close < Close[1] - (Pct * Close[1])
        THEN Buy Cons Contracts at Market;

    end;

    IF Date = EntryDate + 1
    AND CurrentTime = (Sess1EndTime - 30) THEN Begin

        IF MarketPosition(0) = 1 THEN ExitLong at Market;
        IF MarketPosition(0) = -1 THEN ExitShort at Market;

    end;

END;