Back

How to plot an indicator

Hi,

I'm new to object oriented programming and i am using python but i could not plot a Bollinger Band on output chart. I found the code lines:

var bb = BB(Symbol symbol, int period, decimal k, MovingAverageType movingAverageType = null, Resolution resolution = null, Func`2[Data.IBaseData,Decimal] selector = null)

Plot<T>(string chart, params IndicatorBase<T>[] indicators) where T : BaseData

I could not even apply Bollinger Band with periods=20 and k=2, so i did not try to plot it. May you write a basic sample python code or just tell where to write them ?

Update Backtest








Please checkout the attached project.
The C# snippets you mencioned are translated into: 

// In Initialize
self.bb = self.BB(self.spy, 20, 2)

and

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)

This code works in the current python framework (IronPython) and the upcoming one. 
 

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.


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