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.
If you use the SetTradeDelays then the settings in the settings menu are overruled. It does not matter what you set there.
How do you know it made the trade the 1st of july ? If the date showing in that is is showing 31st july, how do you know that is wrong ? (I have other price data.... so I can not verify it....)
I think you are using monthly data... I can imagine that will have a bar dated with the end of the month but you are actualy trading the first day of the month....
Set the date to the 2nd of july. 1st of july should work I would think... because there is trading data there, but just give a try to be sure. It might be "to the 1st" and not "including the 1st".
That's incorrect! It does not always override settings menu.
See his backtest mode
And then look here ->
AFL Function Reference - ENABLEROTATIONALTRADING
Important: The rotational trading mode uses "buy price" and "buy delay" from the Settings Trade page as trade price and delay for both entries and exits (long and short).
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.