Back to Community
long-short mean reversion attempt

Here's something to consider. Needs some re-factoring, clean-up, comments, etc. It may be an over-fit, but recent performance looks pretty good. --Grant

Clone Algorithm
78
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
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: 57003071d476340e164b80ea
There was a runtime error.
5 responses

Long-term backtest. Not so good.

Clone Algorithm
78
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
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: 5700496cb7fcb10e13f8c47a
There was a runtime error.

Thanks for sharing your code! I really like these OLMAR approaches. I notice slippage and commission were overridden. I ran with default slippage and commission (by just commenting out lines 14 and 15) and the results are different. See below. I didn't see this degradation nor need to override with your other OLMAR posts (e.g. see simple OLMAR w/ optimizer & get_fundamentals)

Clone Algorithm
1
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
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: 570076bd5d631c0e0614593c
There was a runtime error.

Thanks Marc,

Not sure what's going on. There may be a lot of turn-over combined with the high level of capital? So, the slippage model kicks in?

Here's another version

Note:

set_commission(commission.PerTrade(cost=0))
set_slippage(slippage.FixedSlippage(spread=0.00))

Clone Algorithm
78
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
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: 57062d934aa1220f35121c63
There was a runtime error.

Since this takes over an hour to run in Quantopian 1, this might be a great candidate to test in Quantopian 2. I tried to port it... most is straight forward except dies with cryptic "error: failed in converting 4th argument `xl' of _slsqp.slsqp to C/Fortran array".