I am very new to Quantopian and Python. And I am worried that I did something wrong in the code. Can anyone help check it?

Strategy Description
The words/ numbers in < > can be changed by users in the program
Step 1: Calculate linear regression between Gold ETF (GLV) and Silver ETF (SLV)
• Look back day prices • Gold – asilver = constant (a is some constant) [linear regression]

Step 2: Use co-integration test to test mean reversion for the formula obtained from linear regression
• Test mean reversion for Gold – a*silver = constant (a is some constant) • If p-value <= , then the pair is tradable.

Step 2: Construct Bollinger band.
• Bollinger Band settings: days SMA; Standard Deviation • If pairs value (i.e. the constant in the formula) >= upper band, short (Gold – a * silver) o Sell 1 share Gold and Buy "a" share Silver  “a” should be an integer (round the number if needed) • If pairs value <= lower band, buy (Gold –a *silver) o Buy 1 share Gold and Sell "a" share Silver o “a” should be an integer (round the number if needed)

Step 3: Exit
• Take Profit: % • Stop loss: %

20
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: 58ef81040bec0564c5da33d6
There was a runtime error.
1 response

Hello Kai,

This is a great start. A few things you can do here:

1. Research the pairs in a notebook to see if they actually satisfy requirements. It could be that there's just no signal in the stocks. You can use this notebook to get started.