Lean  $LEAN_TAG$
QuantConnect.Indicators.RollingWindow< T > Class Template Reference

This is a window that allows for list access semantics, where this[0] refers to the most recent item in the window and this[Count-1] refers to the last item in the window More...

Inheritance diagram for QuantConnect.Indicators.RollingWindow< T >:
[legend]

Public Member Functions

 RollingWindow (int size)
 Initializes a new instance of the RollwingWindow class with the specified window size. More...
 
IEnumerator< T > GetEnumerator ()
 Returns an enumerator that iterates through the collection. More...
 
void Add (T item)
 Adds an item to this window and shifts all other elements More...
 
void Reset ()
 Clears this window of all data More...
 

Properties

int Size [get, set]
 Gets the size of this window More...
 
int Count [get]
 Gets the current number of elements in this window More...
 
int Samples [get]
 Gets the number of samples that have been added to this window over its lifetime More...
 
MostRecentlyRemoved [get]
 Gets the most recently removed item from the window. This is the piece of data that just 'fell off' as a result of the most recent add. If no items have been removed, this will throw an exception. More...
 
this[int i] [get, set]
 Indexes into this window, where index 0 is the most recently entered value More...
 
bool IsReady [get]
 Gets a value indicating whether or not this window is ready, i.e, it has been filled to its capacity More...
 
- Properties inherited from QuantConnect.Indicators.IReadOnlyWindow< T >
int Size [get]
 Gets the size of this window More...
 
int Count [get]
 Gets the current number of elements in this window More...
 
int Samples [get]
 Gets the number of samples that have been added to this window over its lifetime More...
 
this[int i] [get]
 Indexes into this window, where index 0 is the most recently entered value More...
 
bool IsReady [get]
 Gets a value indicating whether or not this window is ready, i.e, it has been filled to its capacity, this is when the Size==Count More...
 
MostRecentlyRemoved [get]
 Gets the most recently removed item from the window. This is the piece of data that just 'fell off' as a result of the most recent add. If no items have been removed, this will throw an exception. More...
 

Detailed Description

This is a window that allows for list access semantics, where this[0] refers to the most recent item in the window and this[Count-1] refers to the last item in the window

Template Parameters
TThe type of data in the window

Definition at line 29 of file RollingWindow.cs.

Constructor & Destructor Documentation

◆ RollingWindow()

Initializes a new instance of the RollwingWindow class with the specified window size.

Parameters
sizeThe number of items to hold in the window

Definition at line 48 of file RollingWindow.cs.

Member Function Documentation

◆ GetEnumerator()

IEnumerator<T> QuantConnect.Indicators.RollingWindow< T >.GetEnumerator ( )

Returns an enumerator that iterates through the collection.

Returns
A T:System.Collections.Generic.IEnumerator`1 that can be used to iterate through the collection.

<filterpriority>1</filterpriority>

Definition at line 245 of file RollingWindow.cs.

Here is the caller graph for this function:

◆ Add()

void QuantConnect.Indicators.RollingWindow< T >.Add ( item)

Adds an item to this window and shifts all other elements

Parameters
itemThe item to be added

Definition at line 283 of file RollingWindow.cs.

Here is the caller graph for this function:

◆ Reset()

Clears this window of all data

Definition at line 312 of file RollingWindow.cs.

Here is the caller graph for this function:

Property Documentation

◆ Size

Gets the size of this window

Definition at line 62 of file RollingWindow.cs.

◆ Count

Gets the current number of elements in this window

Definition at line 85 of file RollingWindow.cs.

◆ Samples

Gets the number of samples that have been added to this window over its lifetime

Definition at line 104 of file RollingWindow.cs.

◆ MostRecentlyRemoved

T QuantConnect.Indicators.RollingWindow< T >.MostRecentlyRemoved
get

Gets the most recently removed item from the window. This is the piece of data that just 'fell off' as a result of the most recent add. If no items have been removed, this will throw an exception.

Definition at line 125 of file RollingWindow.cs.

◆ this[int i]

T QuantConnect.Indicators.RollingWindow< T >.this[int i]
getset

Indexes into this window, where index 0 is the most recently entered value

Parameters
ithe index, i
Returns
the ith most recent entry

Definition at line 153 of file RollingWindow.cs.

◆ IsReady

Gets a value indicating whether or not this window is ready, i.e, it has been filled to its capacity

Definition at line 223 of file RollingWindow.cs.


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