Back

Custom Charts in Live Trading Terminal

Hi all, 

I'm trying to get my custom charts, particularly indicators, to update in real time.  In my backtests the charts all populate and my logic is correctly firing against those values but in my paper trade trials my charts aren't populating.  I have a couple data points but no lines. 

I initialize the charts in Initialize, then have them updating in my OnData. 

def Initialize(self):

self.emaFast = self.EMA("SPY", 20, Resolution.Daily)
self.emaSlow = self.EMA("SPY", 50, Resolution.Daily)

self.spyRsi = self.RSI("SPY", 20, MovingAverageType.Simple, Resolution.Daily)

self.indexEMA = IndicatorExtensions.Over(self.emaFast, self.emaSlow)


self.PlotIndicator("SPY Indicator", True, self.indexEMA)
self.PlotIndicator("SPY RSI", True, self.spyRsi)

self.SetWarmup(30)

def OnData(self, data):
'''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.'''
'''Arguments:
data: Slice object keyed by symbol containing the stock data'''

#Verify all indicators have warmed up before anything happens
if self.IsWarmingUp: return

#Capture Portfolio Values
self.marginRemaining = self.Portfolio.MarginRemaining
self.CurrentPortValue = self.Portfolio.TotalPortfolioValue
self.CurrentHoldValue = self.Portfolio.TotalHoldingsValue

#Plot any relevant portfolio metrics
self.Plot("Margin Remaining", self.marginRemaining)
self.PlotIndicator("SPY Indicator", self.indexEMA)
self.PlotIndicator("SPY RSI", self.spyRsi)

Any advice would be greatly appreciated. 

Update Backtest







0

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.


I've managed to find the solution myself.  Here is what I came up with:

def Initialize(self):

'''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialize.'''

# Chart - Master Container for the Chart:
stockPlot_1 = Chart('RSI')
stockPlot_2 = Chart('MFI')
stockPlot_3 = Chart('EMA')



#OnData
def OnData(self, data):
'''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.'''
'''Arguments:
data: Slice object keyed by symbol containing the stock data'''

#Verify all indicators have warmed up before anything happens
if self.IsWarmingUp: return

#Capture Portfolio Values
self.marginRemaining = self.Portfolio.MarginRemaining
self.CurrentPortValue = self.Portfolio.TotalPortfolioValue
self.CurrentHoldValue = self.Portfolio.TotalHoldingsValue

#Plot any relevant portfolio metrics
self.Plot("Margin Remaining", self.marginRemaining)
self.PlotIndicator('RSI', self.Rsi_1, self.Rsi_2, self.Rsi_3)
self.PlotIndicator('EMA', self.EMA1, self.EMA2, self.indexEMA3)
self.PlotIndicator('MFI', self.Mfi)

This successfully charts groups of indicators to individual chart plots. I left the margin plot to show the nuances. I'll check to make sure my paper account records the chart correctly, but in any case this reduced clutter on my interface and summarized my data better. 

1

Update Backtest





0

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.


Loading...

This discussion is closed