Candlestick Pattern

Evening Star

Introduction

Create a new Evening Star candlestick pattern to indicate the pattern's presence.

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 EveningStar constructor.

EveningStar()1/3

            EveningStar QuantConnect.Indicators.CandlestickPatterns.EveningStar (
     string    name,
     *decimal  penetration
   )
        

Initializes a new instance of the EveningStar class using the specified name.

EveningStar()2/3

            EveningStar QuantConnect.Indicators.CandlestickPatterns.EveningStar (
     decimal  penetration
   )
        

Initializes a new instance of the EveningStar class.

EveningStar()3/3

            EveningStar QuantConnect.Indicators.CandlestickPatterns.EveningStar (
   )
        

Initializes a new instance of the EveningStar 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 EveningStar _eveningstar;

// In Initialize()
_eveningstar = new EveningStar(name, penetration);
_eveningstar.Updated += IndicatorUpdateMethod;

RegisterIndicator(symbol, _eveningstar, Resolution.Daily);

// In IndicatorUpdateMethod()
if (_eveningstar.IsReady)
{
    var indicatorValue = _eveningstar.Current.Value;
}
from QuantConnect.Indicators.CandlestickPatterns import EveningStar
    
# In Initialize()
self.eveningstar = EveningStar(name, penetration)
self.eveningstar.Updated += self.IndicatorUpdateMethod

self.RegisterIndicator(symbol, self.eveningstar, Resolution.Daily)

# In IndicatorUpdateMethod()
if self.eveningstar.IsReady:
    indicator_value = self.eveningstar.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 EveningStar _eveningstar;
private Symbol symbol;

// In Initialize()
_eveningstar = new EveningStar(penetration);
symbol = AddEquity("SPY").Symbol;

// In OnData()
if (data.Bars.ContainsKey(_symbol))
{
    _eveningstar.Update(data.Bars[symbol]);
}
if (_eveningstar.IsReady)
{
    var indicatorValue = _eveningstar.Current.Value;
}
from QuantConnect.Indicators.CandlestickPatterns import EveningStar
    
# In Initialize()
self.eveningstar = EveningStar(penetration)
self.symbol = self.AddEquity("SPY").Symbol

# In OnData()
if data.Bars.ContainsKey(self.symbol):
    self.eveningstar.Update(data.Bars[self.symbol])
if self.eveningstar.IsReady:
    indicator_value = self.eveningstar.Current.Value

Get Indicator Values

To get the value of the indicator, use its Current.Value attribute.

private EveningStar _eveningstar;

// In Initialize()
var symbol = AddEquity("SPY").Symbol;
_eveningstar = EveningStar(symbol);

// In OnData()
if (_eveningstar.IsReady)
{
    var current = _eveningstar.Current.Value;
}
# In Initialize()
symbol = self.AddEquity("SPY").Symbol
self.eveningstar = self.EveningStar(symbol)

# In OnData()
if self.eveningstar.IsReady:
    current = self.eveningstar.Current.Value

Visualization

To plot indicator values, in the OnData event handler, call the Plot method.

private EveningStar _eveningstar;

// In Initialize()
var symbol = AddEquity("SPY").Symbol;
_eveningstar = EveningStar(symbol);

// In OnData()
if (_eveningstar.IsReady)
{
    Plot("My Indicators", "eveningstar", _eveningstar.Current);
}
# In Initialize()
symbol = self.AddEquity("SPY").Symbol
self.eveningstar = self.EveningStar(symbol)

# In OnData()
if self.eveningstar.IsReady:
    self.Plot("My Indicators", "eveningstar", self.eveningstar.Current)

For more information about plotting indicators, see Plotting Indicators.

You can also see our Videos. You can also get in touch with us via Discord.

Did you find this page helpful?

Contribute to the documentation: