Where are the plots?

Back

In the bootcamp of Buy and Hold with a Trailing Stop, section "Visualizing the Stop Levels", I was able to pass the tests, however, I don't see the charts/figures that I created using self.Plot().

Though this might be a silly question, but just where are those figures? The videos didn't say anything about it either, I think it's a bit over-simplified.

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.


https://www.quantconnect.com/docs/algorithm-reference/charting#Charting-Manually-Creating-Charts

Ensure that all was specified as per the above link. I recall seeing the plot on my attempt, however if all was specified correctly as per the documentation above in your attempt, please do attach your answer.

0

Hi Aaron, thanks for the response, however, I still don't see it. But let me be more specific of my question: 

I was trying to get myself through the boot camp toy projects, when I attempted the one named "Visualizing the Stop Levels" within "Buy and Hold with a Trailing Stop", and submitted the code with the solution below, it succesfully run through the backtest. But I cannot find the plot anywhere on my Browser (see attached screenshot). 

Even if I followed the link you sent me and added:

stockPlot = Chart('Data Chart')
self.AddChart(stockPlot)

It doesn't work.

 

 

 

 

Solution code:

class BootCampTask(QCAlgorithm):

# Order ticket for our stop order, Datetime when stop order was last hit
stopMarketTicket = None
stopMarketOrderFillTime = datetime.min
highestSPYPrice = -1

def Initialize(self):
self.SetStartDate(2018, 12, 1)
self.SetEndDate(2018, 12, 10)
self.SetCash(100000)
spy = self.AddEquity("SPY", Resolution.Daily)
spy.SetDataNormalizationMode(DataNormalizationMode.Raw)


def OnData(self, data):

# 1. Plot the current SPY price to "Data Chart" on series "Asset Price"
self.Plot('Data Chart', 'Asset Price', data["SPY"].Close)

if (self.Time - self.stopMarketOrderFillTime).days < 15:
return

if not self.Portfolio.Invested:
self.MarketOrder("SPY", 500)
self.stopMarketTicket = self.StopMarketOrder("SPY", -500, 0.9 * self.Securities["SPY"].Close)

else:

#2. Plot the moving stop price on "Data Chart" with "Stop Price" series name
self.Plot('Data Chart', 'Stop Price', self.stopMarketTicket.Get(OrderField.StopPrice))

if self.Securities["SPY"].Close > self.highestSPYPrice:

self.highestSPYPrice = self.Securities["SPY"].Close
updateFields = UpdateOrderFields()
updateFields.StopPrice = self.highestSPYPrice * 0.9
self.stopMarketTicket.Update(updateFields)

def OnOrderEvent(self, orderEvent):

if orderEvent.Status != OrderStatus.Filled:
return

if self.stopMarketTicket is not None and self.stopMarketTicket.OrderId == orderEvent.OrderId:
self.stopMarketOrderFillTime = self.Time

 

Screenshot:

93025_1601937489.jpg

 

0

Hi Yuying,

Custom plots are not shown in the Boot Camp. To see the plot, run the algorithm in the terminal. The bootcamp algorithms are in the Algorithm Lab under Bootcamp > My Projects.

Best,
Derek Melchin

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.


Hello Derek, thanks for responding! When you say run in the terminal, do you mean backtest the same algorithm on "www.quantconnect.com/terminal/"? If so, I still cannot find the plot, please see the attached figure below. Thanks!

93025_1602107577.jpg

 

0

It is closed by default =) You can open it here:

 677_1602108162.jpg

1

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.


Ah I see, thank you so much Jared!

0

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