Lean  $LEAN_TAG$
QuantConnect.Indicators.IndicatorExtensions Class Reference

Provides extension methods for Indicator More...

Static Public Member Functions

static bool Update (this IndicatorBase< IndicatorDataPoint > indicator, DateTime time, decimal value)
 Updates the state of this indicator with the given value and returns true if this indicator is ready, false otherwise More...
 
static T Of< T > (this T second, IIndicator first, bool waitForFirstToReady=true)
 Configures the second indicator to receive automatic updates from the first by attaching an event handler to first.DataConsolidated More...
 
static CompositeIndicator WeightedBy< T, TWeight > (this IndicatorBase< T > value, TWeight weight, int period)
 Creates a new CompositeIndicator such that the result will be average of a first indicator weighted by a second one More...
 
static CompositeIndicator Plus (this IndicatorBase left, decimal constant)
 Creates a new CompositeIndicator such that the result will be the sum of the left and the constant More...
 
static CompositeIndicator Plus (this IndicatorBase left, IndicatorBase right)
 Creates a new CompositeIndicator such that the result will be the sum of the left and right More...
 
static CompositeIndicator Plus (this IndicatorBase left, IndicatorBase right, string name)
 Creates a new CompositeIndicator such that the result will be the sum of the left and right More...
 
static CompositeIndicator Minus (this IndicatorBase left, decimal constant)
 Creates a new CompositeIndicator such that the result will be the difference of the left and constant More...
 
static CompositeIndicator Minus (this IndicatorBase left, IndicatorBase right)
 Creates a new CompositeIndicator such that the result will be the difference of the left and right More...
 
static CompositeIndicator Minus (this IndicatorBase left, IndicatorBase right, string name)
 Creates a new CompositeIndicator such that the result will be the difference of the left and right More...
 
static CompositeIndicator Over (this IndicatorBase left, decimal constant)
 Creates a new CompositeIndicator such that the result will be the ratio of the left to the constant More...
 
static CompositeIndicator Over (this IndicatorBase left, IndicatorBase right)
 Creates a new CompositeIndicator such that the result will be the ratio of the left to the right More...
 
static CompositeIndicator Over (this IndicatorBase left, IndicatorBase right, string name)
 Creates a new CompositeIndicator such that the result will be the ratio of the left to the right More...
 
static CompositeIndicator Times (this IndicatorBase left, decimal constant)
 Creates a new CompositeIndicator such that the result will be the product of the left and the constant More...
 
static CompositeIndicator Times (this IndicatorBase left, IndicatorBase right)
 Creates a new CompositeIndicator such that the result will be the product of the left to the right More...
 
static CompositeIndicator Times (this IndicatorBase left, IndicatorBase right, string name)
 Creates a new CompositeIndicator such that the result will be the product of the left to the right More...
 
static ExponentialMovingAverage EMA< T > (this IndicatorBase< T > left, int period, decimal? smoothingFactor=null, bool waitForFirstToReady=true)
 Creates a new ExponentialMovingAverage indicator with the specified period and smoothingFactor from the left indicator More...
 
static Maximum MAX (this IIndicator left, int period, bool waitForFirstToReady=true)
 Creates a new Maximum indicator with the specified period from the left indicator More...
 
static Minimum MIN< T > (this IndicatorBase< T > left, int period, bool waitForFirstToReady=true)
 Creates a new Minimum indicator with the specified period from the left indicator More...
 
static SimpleMovingAverage SMA< T > (this IndicatorBase< T > left, int period, bool waitForFirstToReady=true)
 Initializes a new instance of the SimpleMovingAverage class with the specified name and period from the left indicator More...
 
static object Of (PyObject second, PyObject first, bool waitForFirstToReady=true)
 The methods overloads bellow are due to python.net not being able to correctly solve generic methods overload. More...
 
static CompositeIndicator WeightedBy (PyObject value, PyObject weight, int period)
 Creates a new CompositeIndicator such that the result will be average of a first indicator weighted by a second one More...
 
static ExponentialMovingAverage EMA (PyObject left, int period, decimal? smoothingFactor=null, bool waitForFirstToReady=true)
 Creates a new ExponentialMovingAverage indicator with the specified period and smoothingFactor from the left indicator More...
 
static Maximum MAX (PyObject left, int period, bool waitForFirstToReady=true)
 Creates a new Maximum indicator with the specified period from the left indicator More...
 
static Minimum MIN (PyObject left, int period, bool waitForFirstToReady=true)
 Creates a new Minimum indicator with the specified period from the left indicator More...
 
static SimpleMovingAverage SMA (PyObject left, int period, bool waitForFirstToReady=true)
 Initializes a new instance of the SimpleMovingAverage class with the specified name and period from the left indicator More...
 
static object Over (PyObject left, decimal constant)
 
static object Over (PyObject left, PyObject right, string name="")
 Creates a new CompositeIndicator such that the result will be the ratio of the left to the right More...
 
static object Minus (PyObject left, decimal constant)
 Creates a new CompositeIndicator such that the result will be the difference of the left and constant More...
 
static object Minus (PyObject left, PyObject right, string name="")
 Creates a new CompositeIndicator such that the result will be the difference of the left and right More...
 
static object Times (PyObject left, decimal constant)
 Creates a new CompositeIndicator such that the result will be the product of the left and the constant More...
 
static object Times (PyObject left, PyObject right, string name="")
 Creates a new CompositeIndicator such that the result will be the product of the left to the right More...
 
static object Plus (PyObject left, decimal constant)
 Creates a new CompositeIndicator such that the result will be the sum of the left and the constant More...
 
static object Plus (PyObject left, PyObject right, string name="")
 Creates a new CompositeIndicator such that the result will be the sum of the left and right More...
 

Detailed Description

Provides extension methods for Indicator

Definition at line 28 of file IndicatorExtensions.cs.

Member Function Documentation

◆ Update()

static bool QuantConnect.Indicators.IndicatorExtensions.Update ( this IndicatorBase< IndicatorDataPoint indicator,
DateTime  time,
decimal  value 
)
static

Updates the state of this indicator with the given value and returns true if this indicator is ready, false otherwise

Parameters
indicatorThe indicator to be updated
timeThe time associated with the value
valueThe value to use to update this indicator
Returns
True if this indicator is ready, false otherwise

Definition at line 38 of file IndicatorExtensions.cs.

◆ Of< T >()

static T QuantConnect.Indicators.IndicatorExtensions.Of< T > ( this T  second,
IIndicator  first,
bool  waitForFirstToReady = true 
)
static

Configures the second indicator to receive automatic updates from the first by attaching an event handler to first.DataConsolidated

Parameters
secondThe indicator that receives data from the first
firstThe indicator that sends data via DataConsolidated even to the second
waitForFirstToReadyTrue to only send updates to the second if first.IsReady returns true, false to always send updates to second
Returns
The reference to the second indicator to allow for method chaining
Type Constraints
T :IIndicator 

Definition at line 51 of file IndicatorExtensions.cs.

◆ WeightedBy< T, TWeight >()

static CompositeIndicator QuantConnect.Indicators.IndicatorExtensions.WeightedBy< T, TWeight > ( this IndicatorBase< T >  value,
TWeight  weight,
int  period 
)
static

Creates a new CompositeIndicator such that the result will be average of a first indicator weighted by a second one

Parameters
valueIndicator that will be averaged
weightIndicator that provides the average weights
periodAverage period
Returns
Indicator that results of the average of first by weights given by second
Type Constraints
T :IBaseData 
TWeight :IndicatorBase<IndicatorDataPoint> 

Definition at line 73 of file IndicatorExtensions.cs.

Here is the call graph for this function:

◆ Plus() [1/5]

static CompositeIndicator QuantConnect.Indicators.IndicatorExtensions.Plus ( this IndicatorBase  left,
decimal  constant 
)
static

Creates a new CompositeIndicator such that the result will be the sum of the left and the constant

value = left + constant

Parameters
leftThe left indicator
constantThe addend
Returns
The sum of the left and right indicators

Definition at line 118 of file IndicatorExtensions.cs.

Here is the caller graph for this function:

◆ Plus() [2/5]

static CompositeIndicator QuantConnect.Indicators.IndicatorExtensions.Plus ( this IndicatorBase  left,
IndicatorBase  right 
)
static

Creates a new CompositeIndicator such that the result will be the sum of the left and right

value = left + right

Parameters
leftThe left indicator
rightThe right indicator
Returns
The sum of the left and right indicators

Definition at line 133 of file IndicatorExtensions.cs.

◆ Plus() [3/5]

static CompositeIndicator QuantConnect.Indicators.IndicatorExtensions.Plus ( this IndicatorBase  left,
IndicatorBase  right,
string  name 
)
static

Creates a new CompositeIndicator such that the result will be the sum of the left and right

value = left + right

Parameters
leftThe left indicator
rightThe right indicator
nameThe name of this indicator
Returns
The sum of the left and right indicators

Definition at line 148 of file IndicatorExtensions.cs.

◆ Minus() [1/5]

static CompositeIndicator QuantConnect.Indicators.IndicatorExtensions.Minus ( this IndicatorBase  left,
decimal  constant 
)
static

Creates a new CompositeIndicator such that the result will be the difference of the left and constant

value = left - constant

Parameters
leftThe left indicator
constantThe subtrahend
Returns
The difference of the left and right indicators

Definition at line 162 of file IndicatorExtensions.cs.

Here is the caller graph for this function:

◆ Minus() [2/5]

static CompositeIndicator QuantConnect.Indicators.IndicatorExtensions.Minus ( this IndicatorBase  left,
IndicatorBase  right 
)
static

Creates a new CompositeIndicator such that the result will be the difference of the left and right

value = left - right

Parameters
leftThe left indicator
rightThe right indicator
Returns
The difference of the left and right indicators

Definition at line 177 of file IndicatorExtensions.cs.

◆ Minus() [3/5]

static CompositeIndicator QuantConnect.Indicators.IndicatorExtensions.Minus ( this IndicatorBase  left,
IndicatorBase  right,
string  name 
)
static

Creates a new CompositeIndicator such that the result will be the difference of the left and right

value = left - right

Parameters
leftThe left indicator
rightThe right indicator
nameThe name of this indicator
Returns
The difference of the left and right indicators

Definition at line 192 of file IndicatorExtensions.cs.

◆ Over() [1/5]

static CompositeIndicator QuantConnect.Indicators.IndicatorExtensions.Over ( this IndicatorBase  left,
decimal  constant 
)
static

Creates a new CompositeIndicator such that the result will be the ratio of the left to the constant

value = left/constant

Parameters
leftThe left indicator
constantThe constant value denominator
Returns
The ratio of the left to the right indicator

Definition at line 206 of file IndicatorExtensions.cs.

Here is the caller graph for this function:

◆ Over() [2/5]

static CompositeIndicator QuantConnect.Indicators.IndicatorExtensions.Over ( this IndicatorBase  left,
IndicatorBase  right 
)
static

Creates a new CompositeIndicator such that the result will be the ratio of the left to the right

value = left/right

Parameters
leftThe left indicator
rightThe right indicator
Returns
The ratio of the left to the right indicator

Definition at line 221 of file IndicatorExtensions.cs.

◆ Over() [3/5]

static CompositeIndicator QuantConnect.Indicators.IndicatorExtensions.Over ( this IndicatorBase  left,
IndicatorBase  right,
string  name 
)
static

Creates a new CompositeIndicator such that the result will be the ratio of the left to the right

value = left/right

Parameters
leftThe left indicator
rightThe right indicator
nameThe name of this indicator
Returns
The ratio of the left to the right indicator

Definition at line 236 of file IndicatorExtensions.cs.

◆ Times() [1/5]

static CompositeIndicator QuantConnect.Indicators.IndicatorExtensions.Times ( this IndicatorBase  left,
decimal  constant 
)
static

Creates a new CompositeIndicator such that the result will be the product of the left and the constant

value = left*constant

Parameters
leftThe left indicator
constantThe constant value to multiple by
Returns
The product of the left to the right indicators

Definition at line 250 of file IndicatorExtensions.cs.

Here is the caller graph for this function:

◆ Times() [2/5]

static CompositeIndicator QuantConnect.Indicators.IndicatorExtensions.Times ( this IndicatorBase  left,
IndicatorBase  right 
)
static

Creates a new CompositeIndicator such that the result will be the product of the left to the right

value = left*right

Parameters
leftThe left indicator
rightThe right indicator
Returns
The product of the left to the right indicators

Definition at line 265 of file IndicatorExtensions.cs.

◆ Times() [3/5]

static CompositeIndicator QuantConnect.Indicators.IndicatorExtensions.Times ( this IndicatorBase  left,
IndicatorBase  right,
string  name 
)
static

Creates a new CompositeIndicator such that the result will be the product of the left to the right

value = left*right

Parameters
leftThe left indicator
rightThe right indicator
nameThe name of this indicator
Returns
The product of the left to the right indicators

Definition at line 280 of file IndicatorExtensions.cs.

◆ EMA< T >()

static ExponentialMovingAverage QuantConnect.Indicators.IndicatorExtensions.EMA< T > ( this IndicatorBase< T >  left,
int  period,
decimal?  smoothingFactor = null,
bool  waitForFirstToReady = true 
)
static

Creates a new ExponentialMovingAverage indicator with the specified period and smoothingFactor from the left indicator

Parameters
leftThe ExponentialMovingAverage indicator will be created using the data from left
periodThe period of the ExponentialMovingAverage indicators
smoothingFactorThe percentage of data from the previous value to be carried into the next value
waitForFirstToReadyTrue to only send updates to the second if left.IsReady returns true, false to always send updates
Returns
A reference to the ExponentialMovingAverage indicator to allow for method chaining
Type Constraints
T :IBaseData 

Definition at line 292 of file IndicatorExtensions.cs.

Here is the call graph for this function:

◆ MAX() [1/2]

static Maximum QuantConnect.Indicators.IndicatorExtensions.MAX ( this IIndicator  left,
int  period,
bool  waitForFirstToReady = true 
)
static

Creates a new Maximum indicator with the specified period from the left indicator

Parameters
leftThe Maximum indicator will be created using the data from left
periodThe period of the Maximum indicator
waitForFirstToReadyTrue to only send updates to the second if left.IsReady returns true, false to always send updates
Returns
A reference to the Maximum indicator to allow for method chaining

Definition at line 305 of file IndicatorExtensions.cs.

Here is the caller graph for this function:

◆ MIN< T >()

static Minimum QuantConnect.Indicators.IndicatorExtensions.MIN< T > ( this IndicatorBase< T >  left,
int  period,
bool  waitForFirstToReady = true 
)
static

Creates a new Minimum indicator with the specified period from the left indicator

Parameters
leftThe Minimum indicator will be created using the data from left
periodThe period of the Minimum indicator
waitForFirstToReadyTrue to only send updates to the second if left.IsReady returns true, false to always send updates
Returns
A reference to the Minimum indicator to allow for method chaining
Type Constraints
T :IBaseData 

Definition at line 316 of file IndicatorExtensions.cs.

◆ SMA< T >()

static SimpleMovingAverage QuantConnect.Indicators.IndicatorExtensions.SMA< T > ( this IndicatorBase< T >  left,
int  period,
bool  waitForFirstToReady = true 
)
static

Initializes a new instance of the SimpleMovingAverage class with the specified name and period from the left indicator

Parameters
leftThe SimpleMovingAverage indicator will be created using the data from left
periodThe period of the SMA
waitForFirstToReadyTrue to only send updates to the second if first.IsReady returns true, false to always send updates to second
Returns
The reference to the SimpleMovingAverage indicator to allow for method chaining
Type Constraints
T :IBaseData 

Definition at line 328 of file IndicatorExtensions.cs.

◆ Of()

static object QuantConnect.Indicators.IndicatorExtensions.Of ( PyObject  second,
PyObject  first,
bool  waitForFirstToReady = true 
)
static

The methods overloads bellow are due to python.net not being able to correctly solve generic methods overload.

Configures the second indicator to receive automatic updates from the first by attaching an event handler to first.DataConsolidated

Parameters
secondThe indicator that receives data from the first
firstThe indicator that sends data via DataConsolidated even to the second
waitForFirstToReadyTrue to only send updates to the second if first.IsReady returns true, false to always send updates to second
Returns
The reference to the second indicator to allow for method chaining

Definition at line 346 of file IndicatorExtensions.cs.

◆ WeightedBy()

static CompositeIndicator QuantConnect.Indicators.IndicatorExtensions.WeightedBy ( PyObject  value,
PyObject  weight,
int  period 
)
static

Creates a new CompositeIndicator such that the result will be average of a first indicator weighted by a second one

Parameters
valueIndicator that will be averaged
weightIndicator that provides the average weights
periodAverage period
Returns
Indicator that results of the average of first by weights given by second

Definition at line 361 of file IndicatorExtensions.cs.

◆ EMA()

static ExponentialMovingAverage QuantConnect.Indicators.IndicatorExtensions.EMA ( PyObject  left,
int  period,
decimal?  smoothingFactor = null,
bool  waitForFirstToReady = true 
)
static

Creates a new ExponentialMovingAverage indicator with the specified period and smoothingFactor from the left indicator

Parameters
leftThe ExponentialMovingAverage indicator will be created using the data from left
periodThe period of the ExponentialMovingAverage indicators
smoothingFactorThe percentage of data from the previous value to be carried into the next value
waitForFirstToReadyTrue to only send updates to the second if left.IsReady returns true, false to always send updates
Returns
A reference to the ExponentialMovingAverage indicator to allow for method chaining

Definition at line 376 of file IndicatorExtensions.cs.

◆ MAX() [2/2]

static Maximum QuantConnect.Indicators.IndicatorExtensions.MAX ( PyObject  left,
int  period,
bool  waitForFirstToReady = true 
)
static

Creates a new Maximum indicator with the specified period from the left indicator

Parameters
leftThe Maximum indicator will be created using the data from left
periodThe period of the Maximum indicator
waitForFirstToReadyTrue to only send updates to the second if left.IsReady returns true, false to always send updates
Returns
A reference to the Maximum indicator to allow for method chaining

Definition at line 389 of file IndicatorExtensions.cs.

Here is the call graph for this function:

◆ MIN()

static Minimum QuantConnect.Indicators.IndicatorExtensions.MIN ( PyObject  left,
int  period,
bool  waitForFirstToReady = true 
)
static

Creates a new Minimum indicator with the specified period from the left indicator

Parameters
leftThe Minimum indicator will be created using the data from left
periodThe period of the Minimum indicator
waitForFirstToReadyTrue to only send updates to the second if left.IsReady returns true, false to always send updates
Returns
A reference to the Minimum indicator to allow for method chaining

Definition at line 402 of file IndicatorExtensions.cs.

◆ SMA()

static SimpleMovingAverage QuantConnect.Indicators.IndicatorExtensions.SMA ( PyObject  left,
int  period,
bool  waitForFirstToReady = true 
)
static

Initializes a new instance of the SimpleMovingAverage class with the specified name and period from the left indicator

Parameters
leftThe SimpleMovingAverage indicator will be created using the data from left
periodThe period of the SMA
waitForFirstToReadyTrue to only send updates to the second if first.IsReady returns true, false to always send updates to second
Returns
The reference to the SimpleMovingAverage indicator to allow for method chaining

Definition at line 415 of file IndicatorExtensions.cs.

◆ Over() [4/5]

static object QuantConnect.Indicators.IndicatorExtensions.Over ( PyObject  left,
decimal  constant 
)
static

Creates a new CompositeIndicator such that the result will be the ratio of the left to the constant

value = left/constant

Parameters
leftThe left indicator
constantThe constant value denominator
Returns
The ratio of the left to the right indicator

Definition at line 430 of file IndicatorExtensions.cs.

Here is the call graph for this function:

◆ Over() [5/5]

static object QuantConnect.Indicators.IndicatorExtensions.Over ( PyObject  left,
PyObject  right,
string  name = "" 
)
static

Creates a new CompositeIndicator such that the result will be the ratio of the left to the right

value = left/right

Parameters
leftThe left indicator
rightThe right indicator
nameThe name of this indicator
Returns
The ratio of the left to the right indicator

Definition at line 446 of file IndicatorExtensions.cs.

Here is the call graph for this function:

◆ Minus() [4/5]

static object QuantConnect.Indicators.IndicatorExtensions.Minus ( PyObject  left,
decimal  constant 
)
static

Creates a new CompositeIndicator such that the result will be the difference of the left and constant

value = left - constant

Parameters
leftThe left indicator
constantThe subtrahend
Returns
The difference of the left and right indicators

Definition at line 466 of file IndicatorExtensions.cs.

Here is the call graph for this function:

◆ Minus() [5/5]

static object QuantConnect.Indicators.IndicatorExtensions.Minus ( PyObject  left,
PyObject  right,
string  name = "" 
)
static

Creates a new CompositeIndicator such that the result will be the difference of the left and right

value = left - right

Parameters
leftThe left indicator
rightThe right indicator
nameThe name of this indicator
Returns
The difference of the left and right indicators

Definition at line 482 of file IndicatorExtensions.cs.

Here is the call graph for this function:

◆ Times() [4/5]

static object QuantConnect.Indicators.IndicatorExtensions.Times ( PyObject  left,
decimal  constant 
)
static

Creates a new CompositeIndicator such that the result will be the product of the left and the constant

value = left*constant

Parameters
leftThe left indicator
constantThe constant value to multiple by
Returns
The product of the left to the right indicators

Definition at line 502 of file IndicatorExtensions.cs.

Here is the call graph for this function:

◆ Times() [5/5]

static object QuantConnect.Indicators.IndicatorExtensions.Times ( PyObject  left,
PyObject  right,
string  name = "" 
)
static

Creates a new CompositeIndicator such that the result will be the product of the left to the right

value = left*right

Parameters
leftThe left indicator
rightThe right indicator
nameThe name of this indicator
Returns
The product of the left to the right indicators

Definition at line 518 of file IndicatorExtensions.cs.

Here is the call graph for this function:

◆ Plus() [4/5]

static object QuantConnect.Indicators.IndicatorExtensions.Plus ( PyObject  left,
decimal  constant 
)
static

Creates a new CompositeIndicator such that the result will be the sum of the left and the constant

value = left + constant

Parameters
leftThe left indicator
constantThe addend
Returns
The sum of the left and right indicators

Definition at line 538 of file IndicatorExtensions.cs.

Here is the call graph for this function:

◆ Plus() [5/5]

static object QuantConnect.Indicators.IndicatorExtensions.Plus ( PyObject  left,
PyObject  right,
string  name = "" 
)
static

Creates a new CompositeIndicator such that the result will be the sum of the left and right

value = left + right

Parameters
leftThe left indicator
rightThe right indicator
nameThe name of this indicator
Returns
The sum of the left and right indicators

Definition at line 554 of file IndicatorExtensions.cs.

Here is the call graph for this function:

The documentation for this class was generated from the following file: