Skip to content

IIndicatorsAccessor.MassIndex

method · IIndicatorsAccessor · cAlgo.API.Internals

DesktopCLICloud

The Mass Index indicator is used to predict trend reversals.

Overloads

MassIndex(int periods)

The Mass Index indicator is used to predict trend reversals.

MassIndex MassIndex(int periods)
api.Indicators.MassIndex(periods: int) -> MassIndex

Parameters

Name C# type Python type Description
periods int int The value of the periods used for calculation.

Returns MassIndex — Mass Index indicator instance

Examples

var massIndex = Indicators.MassIndex(9);
if (massIndex.Result.LastValue > 27)
    Print("Mass Index reversal bulge: {0}", massIndex.Result.LastValue);
massIndex = api.Indicators.MassIndex(9)
if massIndex.Result.LastValue > 27:
    api.Print(f"Mass Index reversal bulge: {massIndex.Result.LastValue}")

MassIndex(Bars bars, int periods)

The Mass Index indicator is used to predict trend reversals.

MassIndex MassIndex(Bars bars, int periods)
api.Indicators.MassIndex(bars: Bars, periods: int) -> MassIndex

Parameters

Name C# type Python type Description
bars Bars Bars The Bars that will be used by indicator, you can pass another timeframe/symbol bars
periods int int The value of the periods used for calculation.

Returns MassIndex — Mass Index indicator instance

Examples

var dailyBars = MarketData.GetBars(TimeFrame.Daily);
var dailyMassIndex = Indicators.MassIndex(dailyBars, 9);
Print("Daily Mass Index: {0}", dailyMassIndex.Result.LastValue);
dailyBars = api.MarketData.GetBars(TimeFrame.Daily)
dailyMassIndex = api.Indicators.MassIndex(dailyBars, 9)
api.Print(f"Daily Mass Index: {dailyMassIndex.Result.LastValue}")