Running into an unknown why the algo only takes a single trade. Nothing is showing up in the logs.
Ideally what I'd love to do is get a trailing stop loss that is calculated as orderEventFillPrice - self.atr[i].Current.Value *2). Then each subsuquent day, the trailing sl would move up maintaing the distance of the previous day's high price.
Would you place a self.Plot in the BuySignals section or the OnOrderEvent.Filled if I wanted to track the price on a graph along with the Bolinger bands? Something like:
self.Plot("Stock Plot", "Buy", order.Price)
Johnnie Pattison
I have found that 2 * ATR can be a large number. If ATR returns .34, doubling it is setting your stop at 93.2% of purchase price. Or rather, 6.8% below.
Derek Melchin
Hi Axist,
Since the securities and the Bollinger bands are all registered for daily data, we can plot the trailing stop loss and BBs on the same chart by calling `Plot` whenever the BBs are updated.
def Initialize(self): # ... self.bb = self.BB(symbol, 100, 1, MovingAverageType.Exponential, Resolution.Daily) self.bb.Updated += self.plot_variables def plot_variables(self, sender, bar): self.Plot("BB", "MiddleBand", self.bb.MiddleBand.Current.Value) self.Plot("BB", "UpperBand", self.bb.UpperBand.Current.Value) self.Plot("BB", "LowerBand", self.bb.LowerBand.Current.Value) # plot trailing stop loss here
Before doing so, the logic for adding the trailing stop in OnData needs to be completed. Additionally, there is currently an issue with the data resolutions. The algorithm subscribes to daily data but uses intraday Scheduled Events to place trades. This causes the algorithm to trade using stale data. When continuing the development of this algorithm, we recommend increasing the data resolution to the minute level.
Best,
Derek Melchin
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.
Axist
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!