I'm using a monthly rotational system and I'd like to understand why the backtest is closing the trade in the middle of the current month.
Pad and align is active and Add artificial future bar is not active. I would like to see in Open long current position. If Pad and align is not active, I get the same result. Is anything in my code incorrect or should I change anything from settings to see in the backtest result the current Open Long?
Just some thoughts... As I have clue at what you should change but just want to share what I see.
SetTradeDelays( 0, 0, 0, 0 );
Means you trade at the close.
18th of february is the last day of the month (atleast, as long as we have not seen the 21st, at what point the 21st will be the last day of the month)
So you trade on the last day of the month, you trade at the close.
System is doing exactly programmed it to do....
One solution, making it more realistic also, is change the tradedelays to 1. My guess is that you then will not have this problem. It will also save you from a lot of trouble if you would want to trade this system in real life. Why create a monhtly system if you are going to trade it at the close of the last day of the month, requirying you to have real time data ec.
Hi Henry! Thanks for your comments. You're right, if I set the delay to (1,1,0,0) and in settings the buy and sell price to Open, the open Long is correct. But as you can see the date is not correct. It looks it Opened the QQQ trade the 31th of july, but the trade was made the 1st of July.
The date wouldn't be a problem for me, but I went back to check what I would have seen in the backtest the first of july and as I was expecting I wouldn't have seen the open trade until the end of july, one month later.
Then, or I'm doing something wrong or this doesn't solve my problem.
So Vegeta, if I understand correctly now, you will need to set the settings to use the open and also set the trade delay there. Your screenshot shows that you have it on the open but the buy delay is still at 0 which is not overruled in this case.