Revert "Merge pull request #1526 from AlexCatarino/python3"
This reverts commit2e523992d0, reversing changes made tofa48fc23ea.
This commit is contained in:
@@ -13,12 +13,16 @@
|
||||
|
||||
from clr import AddReference
|
||||
AddReference("System")
|
||||
AddReference("System.Collections")
|
||||
AddReference("QuantConnect.Algorithm")
|
||||
AddReference("QuantConnect.Indicators")
|
||||
AddReference("QuantConnect.Common")
|
||||
|
||||
from System import *
|
||||
from System.Collections.Generic import List
|
||||
from QuantConnect import *
|
||||
from QuantConnect.Algorithm import *
|
||||
from QuantConnect.Indicators import *
|
||||
|
||||
import numpy as np
|
||||
import decimal as d
|
||||
@@ -42,7 +46,7 @@ class CustomChartingAlgorithm(QCAlgorithm):
|
||||
self.AddEquity("SPY", Resolution.Daily)
|
||||
|
||||
# In your initialize method:
|
||||
# Chart - Master Container for the Chart:
|
||||
# Chart - Master Container for the Chart:
|
||||
stockPlot = Chart("Trade Plot")
|
||||
# On the Trade Plotter Chart we want 3 series: trades and price:
|
||||
stockPlot.AddSeries(Series("Buy", SeriesType.Scatter, 0))
|
||||
@@ -67,8 +71,8 @@ class CustomChartingAlgorithm(QCAlgorithm):
|
||||
self.lastPrice = slice["SPY"].Close
|
||||
if self.fastMA == 0: self.fastMA = self.lastPrice
|
||||
if self.slowMA == 0: self.slowMA = self.lastPrice
|
||||
self.fastMA = (d.Decimal(0.01) * self.lastPrice) + (d.Decimal(0.99) * self.fastMA)
|
||||
self.slowMA = (d.Decimal(0.001) * self.lastPrice) + (d.Decimal(0.999) * self.slowMA)
|
||||
self.fastMA = (d.Decimal(0.01) * self.lastPrice) + (d.Decimal(0.99) * self.fastMA);
|
||||
self.slowMA = (d.Decimal(0.001) * self.lastPrice) + (d.Decimal(0.999) * self.slowMA);
|
||||
|
||||
if self.Time > self.resample:
|
||||
self.resample = self.Time + self.resamplePeriod
|
||||
@@ -85,4 +89,4 @@ class CustomChartingAlgorithm(QCAlgorithm):
|
||||
|
||||
def OnEndOfDay(self):
|
||||
#Log the end of day prices:
|
||||
self.Plot("Trade Plot", "Price", self.lastPrice)
|
||||
self.Plot("Trade Plot", "Price", self.lastPrice);
|
||||
|
||||
Reference in New Issue
Block a user