Contents
Candlestick Pattern
Doji Star
Create Manual Indicators
A candlestick pattern indicator requires manual creation and update with a TradeBar
object. Manual indicators let you update their values with any data you choose. The following reference table describes the DojiStar
constructor.
DojiStar()1/2
DojiStar QuantConnect.Indicators.CandlestickPatterns.DojiStar (
string
name
)
Initializes a new instance of the DojiStar
class using the specified name.
DojiStar()2/2
DojiStar QuantConnect.Indicators.CandlestickPatterns.DojiStar ( )
Initializes a new instance of the DojiStar
class.
Update Manual Indicators
You can update the indicator automatically or manually.
Automatic Update
To register a manual indicator for automatic updates with the security data, call the RegisterIndicator
method.
using QuantConnect.Indicators.CandlestickPatterns; private DojiStar _dojistar; // In Initialize() _dojistar = new DojiStar(name); _dojistar.Updated += IndicatorUpdateMethod; RegisterIndicator(symbol, _dojistar, Resolution.Daily); // In IndicatorUpdateMethod() if (_dojistar.IsReady) { var indicatorValue = _dojistar.Current.Value; }
from QuantConnect.Indicators.CandlestickPatterns import DojiStar # In Initialize() self.dojistar = DojiStar(name) self.dojistar.Updated += self.IndicatorUpdateMethod self.RegisterIndicator(symbol, self.dojistar, Resolution.Daily) # In IndicatorUpdateMethod() if self.dojistar.IsReady: indicator_value = self.dojistar.Current.Value
To customize the data that automatically updates the indicator, see Custom Indicator Periods and Custom Indicator Values.
Manual Update
Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update
method with a TradeBar
. The indicator will only be ready after you prime it with enough data.
using QuantConnect.Indicators.CandlestickPatterns; private DojiStar _dojistar; private Symbol symbol; // In Initialize() _dojistar = new DojiStar(); symbol = AddEquity("SPY").Symbol; // In OnData() if (data.Bars.ContainsKey(_symbol)) { _dojistar.Update(data.Bars[symbol]); } if (_dojistar.IsReady) { var indicatorValue = _dojistar.Current.Value; }
from QuantConnect.Indicators.CandlestickPatterns import DojiStar # In Initialize() self.dojistar = DojiStar() self.symbol = self.AddEquity("SPY").Symbol # In OnData() if data.Bars.ContainsKey(self.symbol): self.dojistar.Update(data.Bars[self.symbol]) if self.dojistar.IsReady: indicator_value = self.dojistar.Current.Value
Get Indicator Values
To get the value of the indicator, use its Current.Value
attribute.
private DojiStar _dojistar; // In Initialize() var symbol = AddEquity("SPY").Symbol; _dojistar = DojiStar(symbol); // In OnData() if (_dojistar.IsReady) { var current = _dojistar.Current.Value; }
# In Initialize() symbol = self.AddEquity("SPY").Symbol self.dojistar = self.DojiStar(symbol) # In OnData() if self.dojistar.IsReady: current = self.dojistar.Current.Value
Visualization
To plot indicator values, in the OnData
event handler, call the Plot
method.
private DojiStar _dojistar; // In Initialize() var symbol = AddEquity("SPY").Symbol; _dojistar = DojiStar(symbol); // In OnData() if (_dojistar.IsReady) { Plot("My Indicators", "dojistar", _dojistar.Current); }
# In Initialize() symbol = self.AddEquity("SPY").Symbol self.dojistar = self.DojiStar(symbol) # In OnData() if self.dojistar.IsReady: self.Plot("My Indicators", "dojistar", self.dojistar.Current)
For more information about plotting indicators, see Plotting Indicators.