Candlestick Patterns

Upside Gap Two Crows

Introduction

Create a new Upside Gap Two Crows 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 UpsideGapTwoCrows constructor.

UpsideGapTwoCrows()1/2

            UpsideGapTwoCrows QuantConnect.Indicators.CandlestickPatterns.UpsideGapTwoCrows (
     string  name
   )
        

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

UpsideGapTwoCrows()2/2

            UpsideGapTwoCrows QuantConnect.Indicators.CandlestickPatterns.UpsideGapTwoCrows (
   )
        

Initializes a new instance of the UpsideGapTwoCrows 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 UpsideGapTwoCrows _upsidegaptwocrows;

// In Initialize()
_upsidegaptwocrows = new UpsideGapTwoCrows(name);
_upsidegaptwocrows.Updated += IndicatorUpdateMethod;

RegisterIndicator(symbol, _upsidegaptwocrows, Resolution.Daily);

// In IndicatorUpdateMethod()
if (_upsidegaptwocrows.IsReady)
{
    var indicatorValue = _upsidegaptwocrows.Current.Value;
}
from QuantConnect.Indicators.CandlestickPatterns import UpsideGapTwoCrows
    
# In Initialize()
self.upsidegaptwocrows = UpsideGapTwoCrows(name)
self.upsidegaptwocrows.Updated += self.IndicatorUpdateMethod

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

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

// In Initialize()
_upsidegaptwocrows = new UpsideGapTwoCrows();
symbol = AddEquity("SPY").Symbol;

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

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

Get Indicator Values

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

private UpsideGapTwoCrows _upsidegaptwocrows;

// In Initialize()
var symbol = AddEquity("SPY").Symbol;
_upsidegaptwocrows = UpsideGapTwoCrows(symbol);

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

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

Visualization

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

private UpsideGapTwoCrows _upsidegaptwocrows;

// In Initialize()
var symbol = AddEquity("SPY").Symbol;
_upsidegaptwocrows = UpsideGapTwoCrows(symbol);

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

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

The following image shows the plot values in a matplotlib plot. To load algorithm plot data into the Research Environment, see Charts.

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: