I am backtesting a strategy where there are slight gaps in the price between bars. For example, the price might close at 100 on one bar, and then open at 100.5 on the next bar. The issue I'm having is that I exit positions with a profit target block, and these gaps cause a backtest profit on the trade that exceeds the profit target.
Is that normal and intended? Is there a way I can force the sell price of "profit target" exits to not exceed the actual profit target? Otherwise I'm concerned the backtest will give me unrealistic results.
Is that normal and intended? Is there a way I can force the sell price of "profit target" exits to not exceed the actual profit target? Otherwise I'm concerned the backtest will give me unrealistic results.
Rename
That's what would happen in real world trading, so that's what happens in the WL simulation. It's the expected and correct behavior.
I accept that you're correct, but please help me understand. Continuing from my previous example, if I see in my backtest historical data that the price is 100 in one bar, and 100.5 in the next bar, what would have happened in real life if I had a profit target set at 100.3 during those bars? It would have filled my take-profit order at 100.3, and then gone on to 100.5 to fulfill whatever volume still remains, correct?
What scale are you talking about? Depending on scale and liquidity any number of things might have happened.
If these are daily bars on a major US stock, then you would have gotten filled at the market open at 100.5.
If these are daily bars on a major US stock, then you would have gotten filled at the market open at 100.5.
I am working with 1-second bars on Gold futures. I also just tried with tick-level data and got the same result. There is no market closure during the period. Gold futures are obviously highly traded and liquid (about 100 million USD daily volume here). Sometimes there are many trades a second, and sometimes 10 or so seconds between trades. But the gaps in price between bars are pretty constant.

I had never tried trading at less than 1-minute bars before, so I accept that this question probably stems from ignorance on my part. But running the strategy for a while today, my take-profit orders never filled at a higher price than what they were set to (and I didn't expect them to either).
I had never tried trading at less than 1-minute bars before, so I accept that this question probably stems from ignorance on my part. But running the strategy for a while today, my take-profit orders never filled at a higher price than what they were set to (and I didn't expect them to either).
In this case I would expect that your order would probably have "changed reality" and would have executed at the limit price. WL8 doesn't model this kind of potential impact your trade might have, but it does offer slippage settings that can offer a partial way to compensate for it. The limit order slippage setting would cause an order to not get filled in the backtester.
Your Response
Post
Edit Post
Login is required