- ago
Hello.
I'm trying to develop a simple daily strategy on WL7 that buy at the closing price on the last trading day of January and sell on the last trading day of February.
He managed to make the sale date coincide with the end of February by entering:

I have managed to make the sale date coincide with the end of February by entering:

CODE:
if (bars.DateTimes[bar+2].Month == 3)                {                   condition0 = true;                }             }             if (condition0)             {                ClosePosition(foundPosition0, OrderType.MarketClose);             }


But I can't make the purchase date was the close of the last day of January, writing:

CODE:
if (bars.DateTimes[bar].Month == 2 && bars.DateTimes[bar-1].Month == 1)                {                   condition0 = true;                }             }             if (condition0)             {                _transaction = PlaceTrade(bars, TransactionType.Buy, OrderType.MarketClose, 0, 0);             }


If I do it like this, the system buys on the second day of February (two days after what I would like)
What would be the correct instruction to buy on the close of the last day of January?
Thanks.
0
949
1 Replies

Reply

Bookmark

Sort
- ago
#1
Wealth-Lab 7 comes with preinstalled Turn of Month Seasonality strategy. Check it out in "Sample strategies". Hope this helps.
0

Reply

Bookmark

Sort