- ago
After studying the OneNight strategy thoroughly, I have an idea that should make backtesting strategies more realistic.

Issue: Strategies currently can create an unlimited number of buy limit orders. Brokers will not accept an unlimited number of buy limit orders which makes this type of strategy impossible to implement when using a dataset with many symbols such as the S&P 500. Ideally, backtesting will limit the number of limit orders based on buying power & broker specific rules.

Complications: How can buying power be determined? Perhaps the starting capital can be used. If a broker account is synchronized, it may be possible to collect actual buying power. There may also need to be preferences that enable mimicking common broker enforced limitations. For example, buying power may be set to 2x capital and outstanding limit orders should not exceed this value.

This could be a toggled option; on/off. If toggled on, WL would need to randomly select the signals to generate and orders to fill when qualified. This is similar to NSF positions, but it would apply to signals / orders.
0
265
8 Replies

Reply

Bookmark

Sort
Cone8
 ( 5.88% )
- ago
#1
QUOTE:
... impossible to implement when using a dataset with many symbols
This isn't true. The Quotes tool was designed precisely for this purpose. It monitors all limit and stop order and places them when they're marketable (or nearly so if you set the trigger Threshold below 100).

QUOTE:
If a broker account is synchronized, it may be possible to collect actual buying power.
Trading Preferences > Portfortlio Synch > Use Broker Account value for Equity based PosSizers

QUOTE:
buying power may be set to 2x capital
Trading Preferences > Trading Thresholds > use one or more

Re: Use starting capital to determine buying power & limit orders
If you want to do that, just don't use the Portfolio Sync options and start your backtest "yesterday". Starting Capital is used for all backtests.

I'm going to remove the feature request, but if you want to develop the idea more specifically for something that can't already be done, we can add the tag again.
1
- ago
#2
Wouldn't the Quote & Trigger tool need to wait until at least the opening price has been reported before it can generate an order and auto send this order to a broker? If so, we would end up always placing order post open although possibly very quickly after the open. In the case of OneNight which assume the broker has an active limit order at open, this does make a significant difference in performance. Backtesting also prioritizes positions that open at or below the limit price which differs slightly from using the quote & trigger tool to quickly place orders.

If the above is accurate, then the thought is to use buying power to limit the number of generated limit orders. Currently buying power limits the number of positions filled, but I don't believe it limits the number of orders generated. For example, if I backtest OneNight using the S&P 500 I will generate 500 limit orders every day. If we could force the backtest to limit the number of orders placed to within buying power, WL would then need to randomly select surviving orders.

0
Cone8
 ( 5.88% )
- ago
#3
QUOTE:
Wouldn't the Quote & Trigger tool need to wait until at least the opening price has been reported before it can generate an order and auto send this order to a broker?
No, but it does need a "tick". You can turn off the Market filter and stream premarket trading to trigger orders. Depending on when you start, you might trigger orders and the market opens above the limit trigger - which would just leave an active order working. And again, you can trigger orders so that they're working before the limit price is achieved using a threshold below 100.

QUOTE:
this does make a significant difference in performance.
Yes, the delay could actually improve the fill price! But sure, you can also miss the trade at the limit... "Slippage" works both ways - it isn't always negative and is unpredictable.

QUOTE:
Backtesting also prioritizes positions that open at or below the limit price which differs slightly from using the quote & trigger tool to quickly place orders.
I actually trade like this every day. I'd estimate less than a 1 second delay to get the order to the market after the open using IB. Anyway, it's easy to observe which orders are close to their triggers premarket, even if you want to trigger them manually.

QUOTE:
If we could force the backtest to limit the number of orders placed to within buying power, WL would then need to randomly select surviving orders.
Then you're working with a completely different strategy.
0
- ago
#4
Understood on all points. Quote & Trigger does get us close. Perhaps it would come close to matching a backtest using tick scale granular processing. The only difference I'm aware of is that granular processing would benefit from prioritizing the symbols that open below the limit price while Quote & Trigger would need to place all orders after the market opens. Pre-market monitoring might work as well, but this would not match the backtest results which were done during the standard session. Seemingly minor points, but these issues do make a significant difference.

Perhaps a second request, but related: It might be worth considering applying granular processing to published strategies that have NSF positions (or all strategies). Since strategies that have NSF positions result in random selection processes, without using granular processing the published results cannot be faithfully implemented. Random selection benefits from knowing which symbols qualify which is not known until the end of the session. The chronological selection process used by granular processing much more accurately replicate how the strategy will perform in live trading. In the case of OneNight, for example, chronological vs random makes all the difference.
1
Cone8
 ( 5.88% )
- ago
#5
Exactly. Now we're both saying something we all know, i.e., Strategies with NSF positions return different results for different backtests because each backtest uses a random process (by default) to select which trade candidates use the buying power first.

Market order Strategies can make that selection deterministic by assigning Transaction Weight. When you trade it live, you sort the candidates for the day and enter the top choices by weight to use all the buying power. At Market exits add to the buying power. This is what the backtest does.

For stop/limit strategies the only way to do match live trading is to assigning weight by time-of-day. That's what granular processing does.

QUOTE:
Perhaps a second request, but related: It might be worth considering applying granular processing to published strategies that have NSF positions
This one is up to you. The tools are already there.
0
- ago
#6
The "Top 10 published strategies by APR" page should have granular processing applied. The granular processing tool is great and will make these ranking much more accurate.

https://www.wealth-lab.com/Strategy/Rankings
0
- ago
#7
I added a #FeatureRequest to use granular processing in the Top 5:

https://www.wealth-lab.com/Discussion/Add-Granular-Processing-to-the-Top-5-Rankings-11770

Vote for it everybody!
1
- ago
#8
Thank you!
0

Reply

Bookmark

Sort