Contents
Candlestick Pattern
Gravestone Doji
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 GravestoneDoji
constructor.
GravestoneDoji()1/2
GravestoneDoji QuantConnect.Indicators.CandlestickPatterns.GravestoneDoji (
string
name
)
Initializes a new instance of the GravestoneDoji
class using the specified name.
GravestoneDoji()2/2
GravestoneDoji QuantConnect.Indicators.CandlestickPatterns.GravestoneDoji ( )
Initializes a new instance of the GravestoneDoji
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 GravestoneDoji _gravestonedoji; // In Initialize() _gravestonedoji = new GravestoneDoji(name); _gravestonedoji.Updated += IndicatorUpdateMethod; RegisterIndicator(symbol, _gravestonedoji, Resolution.Daily); // In IndicatorUpdateMethod() if (_gravestonedoji.IsReady) { var indicatorValue = _gravestonedoji.Current.Value; }
from QuantConnect.Indicators.CandlestickPatterns import GravestoneDoji # In Initialize() self.gravestonedoji = GravestoneDoji(name) self.gravestonedoji.Updated += self.IndicatorUpdateMethod self.RegisterIndicator(symbol, self.gravestonedoji, Resolution.Daily) # In IndicatorUpdateMethod() if self.gravestonedoji.IsReady: indicator_value = self.gravestonedoji.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 GravestoneDoji _gravestonedoji; private Symbol symbol; // In Initialize() _gravestonedoji = new GravestoneDoji(); symbol = AddEquity("SPY").Symbol; // In OnData() if (data.Bars.ContainsKey(_symbol)) { _gravestonedoji.Update(data.Bars[symbol]); } if (_gravestonedoji.IsReady) { var indicatorValue = _gravestonedoji.Current.Value; }
from QuantConnect.Indicators.CandlestickPatterns import GravestoneDoji # In Initialize() self.gravestonedoji = GravestoneDoji() self.symbol = self.AddEquity("SPY").Symbol # In OnData() if data.Bars.ContainsKey(self.symbol): self.gravestonedoji.Update(data.Bars[self.symbol]) if self.gravestonedoji.IsReady: indicator_value = self.gravestonedoji.Current.Value
Get Indicator Values
To get the value of the indicator, use its Current.Value
attribute.
private GravestoneDoji _gravestonedoji; // In Initialize() var symbol = AddEquity("SPY").Symbol; _gravestonedoji = GravestoneDoji(symbol); // In OnData() if (_gravestonedoji.IsReady) { var current = _gravestonedoji.Current.Value; }
# In Initialize() symbol = self.AddEquity("SPY").Symbol self.gravestonedoji = self.GravestoneDoji(symbol) # In OnData() if self.gravestonedoji.IsReady: current = self.gravestonedoji.Current.Value
Visualization
To plot indicator values, in the OnData
event handler, call the Plot
method.
private GravestoneDoji _gravestonedoji; // In Initialize() var symbol = AddEquity("SPY").Symbol; _gravestonedoji = GravestoneDoji(symbol); // In OnData() if (_gravestonedoji.IsReady) { Plot("My Indicators", "gravestonedoji", _gravestonedoji.Current); }
# In Initialize() symbol = self.AddEquity("SPY").Symbol self.gravestonedoji = self.GravestoneDoji(symbol) # In OnData() if self.gravestonedoji.IsReady: self.Plot("My Indicators", "gravestonedoji", self.gravestonedoji.Current)
For more information about plotting indicators, see Plotting Indicators.