Removed references to FrameworkBridgeAlgorithm, but kept essential points about adding EmitInsights
This commit is contained in:
@@ -28,14 +28,14 @@ from datetime import timedelta
|
||||
### <summary>
|
||||
### Demonstration algorithm showing how to easily convert an old algorithm into the framework.
|
||||
###
|
||||
### 1. Make class derive from QCAlgorithmFrameworkBridge instead of QCAlgorithm.
|
||||
### 2. When making orders, also create insights for the correct direction (up/down), can also set insight prediction period/magnitude/direction
|
||||
### 1. When making orders, also create insights for the correct direction (up/down/flat), can also set insight prediction period/magnitude/direction
|
||||
### 2. Emit insights before placing any trades
|
||||
### 3. Profit :)
|
||||
### </summary>
|
||||
### <meta name="tag" content="indicators" />
|
||||
### <meta name="tag" content="indicator classes" />
|
||||
### <meta name="tag" content="plotting indicators" />
|
||||
class ConvertToFrameworkAlgorithm(QCAlgorithm): # 1. Derive from QCAlgorithmFrameworkBridge
|
||||
class ConvertToFrameworkAlgorithm(QCAlgorithm):
|
||||
'''Demonstration algorithm showing how to easily convert an old algorithm into the framework.'''
|
||||
|
||||
FastEmaPeriod = 12
|
||||
@@ -88,6 +88,16 @@ class ConvertToFrameworkAlgorithm(QCAlgorithm): # 1. Derive from QCAlgorithmFr
|
||||
|
||||
self.SetHoldings(self.symbol, -1)
|
||||
|
||||
# if we wanted to liquidate our positions
|
||||
## 1. Call EmitInsights with insights create in the correct direction -- Flat
|
||||
|
||||
#self.EmitInsights(
|
||||
# Creates an insight for our symbol, predicting that it will move down or up within the fast ema period number of days, depending on our current position
|
||||
# Insight.Price(self.symbol, timedelta(self.FastEmaPeriod), InsightDirection.Flat)
|
||||
#)
|
||||
|
||||
#self.Liquidate()
|
||||
|
||||
# plot both lines
|
||||
self.Plot("MACD", self.macd, self.macd.Signal)
|
||||
self.Plot(self.symbol.Value, self.macd.Fast, self.macd.Slow)
|
||||
|
||||
Reference in New Issue
Block a user