Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 45 additions & 1 deletion Algorithm/QCAlgorithm.Indicators.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1691,6 +1691,50 @@ public NormalizedAverageTrueRange NATR(Symbol symbol, int period, Resolution? re
return normalizedAverageTrueRange;
}

/// <summary>
/// Creates a new New Highs - New Lows indicator
/// </summary>
/// <param name="symbols">The symbols whose NHNL we want</param>
/// <param name="period">The period over which to compute the NHNL</param>
/// <param name="resolution">The resolution</param>
/// <param name="selector">Selects a value from the BaseData to send into the indicator, if null defaults to casting the input value to a IBaseDataBar</param>
/// <returns>The NewHighsNewLows indicator for the requested symbols over the specified period</returns>
[DocumentationAttribute(Indicators)]
public NewHighsNewLows NHNL(IEnumerable<Symbol> symbols, int period, Resolution? resolution = null, Func<IBaseData, IBaseDataBar> selector = null)
{
var name = CreateIndicatorName(QuantConnect.Symbol.None, $"NH/NL({period})", resolution ?? GetSubscription(symbols.First()).Resolution);
var nhnlDifference = new NewHighsNewLows(name, period);
foreach (var symbol in symbols)
{
nhnlDifference.Add(symbol);
}
InitializeIndicator(nhnlDifference, resolution, selector, symbols.ToArray());

return nhnlDifference;
}

/// <summary>
/// Creates a new New Highs - New Lows Volume indicator
/// </summary>
/// <param name="symbols">The symbols whose NHNLV we want</param>
/// <param name="period">The period over which to compute the NHNLV</param>
/// <param name="resolution">The resolution</param>
/// <param name="selector">Selects a value from the BaseData to send into the indicator, if null defaults to casting the input value to a TradeBar</param>
/// <returns>The NewHighsNewLowsVolume indicator for the requested symbols over the specified period</returns>
[DocumentationAttribute(Indicators)]
public NewHighsNewLowsVolume NHNLV(IEnumerable<Symbol> symbols, int period, Resolution? resolution = null, Func<IBaseData, TradeBar> selector = null)
{
var name = CreateIndicatorName(QuantConnect.Symbol.None, $"NH/NL Volume({period})", resolution ?? GetSubscription(symbols.First()).Resolution);
var nhnlVolume = new NewHighsNewLowsVolume(name, period);
foreach (var symbol in symbols)
{
nhnlVolume.Add(symbol);
}
InitializeIndicator(nhnlVolume, resolution, selector, symbols.ToArray());

return nhnlVolume;
}

/// <summary>
/// Creates a new On Balance Volume indicator. This will compute the cumulative total volume
/// based on whether the close price being higher or lower than the previous period.
Expand Down Expand Up @@ -2215,7 +2259,7 @@ public TargetDownsideDeviation TDD(Symbol symbol, int period, double minimumAcce

return targetDownsideDeviation;
}

/// <summary>
/// Creates a new TomDemark Sequential candlestick indicator for the symbol. The indicator will be automatically
/// updated on the symbol's subscription resolution.
Expand Down
Loading