Candlestick charts (#7425)
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
* Candlestick charts base implementation * Series and Candlestick series json serialization * Some cleanup * Add AddPlot method for candlestick series to QCAlgorithm * Remove Values property from ISeriesPoint * Add candlestick QCAlgorithm.Plot trade bar methods * Implement candlestick series re-sampling * Add more SeriesSampler unit tests * Add examples of candlestick charts usage to exisiting charting algorithm * Address peer review * Address peer review * Derive Candlestick from Bar * Sampler changes * Add new series types from the cloud * Add more candlestick series sampler tests * Minor cleanup * Minor changes
This commit is contained in:
@@ -28,7 +28,8 @@ class CustomChartingAlgorithm(QCAlgorithm):
|
||||
self.SetStartDate(2016,1,1)
|
||||
self.SetEndDate(2017,1,1)
|
||||
self.SetCash(100000)
|
||||
self.AddEquity("SPY", Resolution.Daily)
|
||||
|
||||
spy = self.AddEquity("SPY", Resolution.Daily).Symbol
|
||||
|
||||
# In your initialize method:
|
||||
# Chart - Master Container for the Chart:
|
||||
@@ -45,6 +46,14 @@ class CustomChartingAlgorithm(QCAlgorithm):
|
||||
avgCross.AddSeries(Series("SlowMA", SeriesType.Line, 0))
|
||||
self.AddChart(avgCross)
|
||||
|
||||
# There's support for candlestick charts built-in:
|
||||
weeklySpyPlot = Chart("Weekly SPY")
|
||||
spyCandlesticks = CandlestickSeries("SPY")
|
||||
weeklySpyPlot.AddSeries(spyCandlesticks)
|
||||
self.AddChart(weeklySpyPlot)
|
||||
|
||||
self.Consolidate(spy, Calendar.Weekly, lambda bar: self.Plot("Weekly SPY", "SPY", bar))
|
||||
|
||||
self.fastMA = 0
|
||||
self.slowMA = 0
|
||||
self.lastPrice = 0
|
||||
|
||||
Reference in New Issue
Block a user