Candlestick Pattern

Three Inside

Introduction

Create a new Three Inside Up/Down 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 ThreeInside constructor.

ThreeInside()1/2

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

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

ThreeInside()2/2

            ThreeInside QuantConnect.Indicators.CandlestickPatterns.ThreeInside (
   )
        

Initializes a new instance of the ThreeInside 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 ThreeInside _threeinside;

// In Initialize()
_threeinside = new ThreeInside(name);
_threeinside.Updated += IndicatorUpdateMethod;

RegisterIndicator(symbol, _threeinside, Resolution.Daily);

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

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

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

// In Initialize()
_threeinside = new ThreeInside();
symbol = AddEquity("SPY").Symbol;

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

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

Get Indicator Values

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

private ThreeInside _threeinside;

// In Initialize()
var symbol = AddEquity("SPY").Symbol;
_threeinside = ThreeInside(symbol);

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

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

Visualization

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

private ThreeInside _threeinside;

// In Initialize()
var symbol = AddEquity("SPY").Symbol;
_threeinside = ThreeInside(symbol);

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

# In OnData()
if self.threeinside.IsReady:
    self.Plot("My Indicators", "threeinside", self.threeinside.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: