Back to Community
Ensuring all positions are closed (no holding overnight) for intraday strategy?


Is there any way I can ensure my algorithm exits all open positions before the market closes that does not involve putting in the order to exit out all positions an hour or more ahead of market close? Preferably in a way that does not prove problematic in the hypothetical event that I trade this strategy with a large amount of capital, say $10 million.

I appreciate any and all help; thanks in advance!

Clone Algorithm
Backtest from to with initial capital
Total Returns
Max Drawdown
Benchmark Returns
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 596bf88d39edf04e24969f2b
There was a runtime error.
3 responses

You could use fixed slippage, so that your order only impacts the price. The good news is I tested it and all position closed by EOD, but the bad news is that since they all filled instantly, the pricing was terrible. It was -2% for the same time period that your backtest shows, and I ran it from the earliest date that UPRO traded, and with fixed slippage, it was at -90% within a year or two.

I think modifying the slippage model in order to get the performance you want is going to make your back test results less accurate.

I don't know where I saw it but I once read about a way to place aggressive orders that will fill at worse prices but are more likely to fill. Not sure I'd possible on quantopian.

What you'll likely have to do is analyze average volume in order to predict how early before market close you need to place your sell.

Yeah. The issue is, with $10 million and default slippage, it takes an hour to put his order in, so it wouldn't be reasonable to expect it all to sell at the end of the day without a major impact on the price.