I want to plot 60 minutes candles for SPY using the following code:
### <summary>
### Simple multi-fimeframe forex scalping based on https://www.youtube.com/watch?v=zhEukjCzXwM
### </summary>>
class Plotting(QCAlgorithm):
def Initialize(self):
'''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.'''
self.SetStartDate(2015, 12, 1) #Set Start Date
self.SetEndDate(2015, 12, 5) #Set End Date
self.SetCash(5000) #Set Strategy Cash
self.forexPair = "EURUSD"
self.AddEquity('SPY', Resolution.Hour)
chart = Chart("Candles")
price = Series("SPY", SeriesType.Candle)
chart.AddSeries(price)
self.AddChart(chart)
def OnData(self,data):
self.Plot("Candles","SPY", self.Securities['SPY'].Close)
But instead of one candle each 60 minutes, I get one candle per day:
What am I doing wrong?
Rahul Chowdhury
Hey Filib,
There is currently no good way to plot candle bars. However, this is an issue we are working on.
Best
Rahul
Filib Uster
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!