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

EasyLanguage bug w/ OpenPositionProfit?



PureBytes Links

Trading Reference Links

Can someone have a look at the example strategy below and tell me if I'm
doing something silly?

If you choose your own value for FirstDate and apply the following strategy
to a stock price series with daily compression, I find that the OpenPosition
Profit returned on ThirdDate is totally wrong.  Do I have an
interpretation/usage problem or is this a (very big and important!) bug?




vars: FirstDate(990607),SecondDate(0),ThirdDate(0);

if DayofWeek(FirstDate)=5 then SecondDate=FirstDate+3 else
SecondDate=FirstDate+1;
if DayofWeek(SecondDate)=5 then ThirdDate=SecondDate+3 else
ThirdDate=SecondDate+1;

if Date=FirstDate then buy 100 shares at next bar open;
if Date=SecondDate then buy 100 shares at next bar open;
if Date=ThirdDate then exitlong 200 shares at next bar open;
if Date>=FirstDate and Date <=ThirdDate+3 then print(" date ", date, "
OpenPositionProfit ",OpenPositionProfit);