Class IndicatorsBasic
Collection of basic indicators.
Inheritance
Inherited Members
Namespace: TuringTrader.Indicators
Assembly: TuringTrader.Simulator.dll
Syntax
public static class IndicatorsBasic
Methods
| Improve this Doc View SourceAbsValue(ITimeSeries<double>, CacheId, string, int)
Calculate absolute value of time series.
Declaration
public static ITimeSeries<double> AbsValue(this ITimeSeries<double> series, CacheId parentId = null, string memberName = "", int lineNumber = 0)
Parameters
Type | Name | Description |
---|---|---|
ITimeSeries<double> | series | input time series |
CacheId | parentId | caller cache id, optional |
string | memberName | caller's member name, optional |
int | lineNumber | caller line number, optional |
Returns
Type | Description |
---|---|
ITimeSeries<double> | absolue value of input time series |
BufferedLambda(Func<double, double>, double, CacheId, string, int)
Create time series based on lambda, with lambda being executed once for every new bar.
Declaration
public static ITimeSeries<double> BufferedLambda(Func<double, double> lambda, double first, CacheId parentId = null, string memberName = "", int lineNumber = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Func<T, TResult><double, double> | lambda | lambda, with previous value as parameter and returning current time series value |
double | first | first value to return |
CacheId | parentId | caller cache id, optional |
string | memberName | caller's member name, optional |
int | lineNumber | caller line number, optional |
Returns
Type | Description |
---|---|
ITimeSeries<double> | lambda time series |
BufferedLambda<T>(Func<T, T>, T, CacheId, string, int)
Create time series based on lambda, with lambda being executed once fore every new bar.
Declaration
public static ITimeSeries<T> BufferedLambda<T>(Func<T, T> lambda, T first, CacheId parentId = null, string memberName = "", int lineNumber = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Func<T, TResult><T, T> | lambda | lambda, with previous value as parameter and returning current time series value |
T | first | first value to return |
CacheId | parentId | caller cache id, optional |
string | memberName | caller's member name, optional |
int | lineNumber | caller line number, optional |
Returns
Type | Description |
---|---|
ITimeSeries<T> | lambda time series |
Type Parameters
Name | Description |
---|---|
T | type of time series |
Const(double, CacheId, string, int)
Return constant value time series.
Declaration
public static ITimeSeries<double> Const(double constantValue, CacheId parentId = null, string memberName = "", int lineNumber = 0)
Parameters
Type | Name | Description |
---|---|---|
double | constantValue | value of time series |
CacheId | parentId | caller cache id, optional |
string | memberName | caller's member name, optional |
int | lineNumber | caller line number, optional |
Returns
Type | Description |
---|---|
ITimeSeries<double> | value as time series |
Delay(ITimeSeries<double>, int, CacheId, string, int)
Delay time series by number of bars.
Declaration
public static ITimeSeries<double> Delay(this ITimeSeries<double> series, int delay, CacheId parentId = null, string memberName = "", int lineNumber = 0)
Parameters
Type | Name | Description |
---|---|---|
ITimeSeries<double> | series | input time series |
int | delay | delay length |
CacheId | parentId | caller cache id, optional |
string | memberName | caller's member name, optional |
int | lineNumber | caller line number, optional |
Returns
Type | Description |
---|---|
ITimeSeries<double> | delayed time series |
Highest(ITimeSeries<double>, int, CacheId, string, int)
Calculate highest value of the specified number of past bars.
Declaration
public static ITimeSeries<double> Highest(this ITimeSeries<double> series, int n, CacheId parentId = null, string memberName = "", int lineNumber = 0)
Parameters
Type | Name | Description |
---|---|---|
ITimeSeries<double> | series | input time series |
int | n | number of bars to search |
CacheId | parentId | caller cache id, optional |
string | memberName | caller's member name, optional |
int | lineNumber | caller line number, optional |
Returns
Type | Description |
---|---|
ITimeSeries<double> | highest value of past n bars |
Lambda(Func<int, double>, CacheId, string, int)
Create time series based on lambda, with lambda being executed once for every call to the indexer method. Use this for leight-weight lambdas.
Declaration
public static ITimeSeries<double> Lambda(Func<int, double> lambda, CacheId parentId = null, string memberName = "", int lineNumber = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Func<T, TResult><int, double> | lambda | lambda, taking bars back as parameter and returning time series value |
CacheId | parentId | cache id used to identify functor |
string | memberName | caller's member name, optional |
int | lineNumber | caller line number, optional |
Returns
Type | Description |
---|---|
ITimeSeries<double> | lambda time series |
Log(ITimeSeries<double>, CacheId, string, int)
Calculate natural logarithm of time series.
Declaration
public static ITimeSeries<double> Log(this ITimeSeries<double> series, CacheId parentId = null, string memberName = "", int lineNumber = 0)
Parameters
Type | Name | Description |
---|---|---|
ITimeSeries<double> | series | input time series |
CacheId | parentId | caller cache id, optional |
string | memberName | caller's member name, optional |
int | lineNumber | caller line number, optional |
Returns
Type | Description |
---|---|
ITimeSeries<double> | logarithmic time series |
LogReturn(ITimeSeries<double>, CacheId, string, int)
Calculate logarithmic return from the previous to the current value of the time series.
Declaration
public static ITimeSeries<double> LogReturn(this ITimeSeries<double> series, CacheId parentId = null, string memberName = "", int lineNumber = 0)
Parameters
Type | Name | Description |
---|---|---|
ITimeSeries<double> | series | input time series |
CacheId | parentId | caller cache id, optional |
string | memberName | caller's member name, optional |
int | lineNumber | caller line number, optional |
Returns
Type | Description |
---|---|
ITimeSeries<double> | logarithm of relative return |
Lowest(ITimeSeries<double>, int, CacheId, string, int)
Calculate lowest value of the specified number of past bars.
Declaration
public static ITimeSeries<double> Lowest(this ITimeSeries<double> series, int n, CacheId parentId = null, string memberName = "", int lineNumber = 0)
Parameters
Type | Name | Description |
---|---|---|
ITimeSeries<double> | series | input time series |
int | n | number of bars to search |
CacheId | parentId | caller cache id, optional |
string | memberName | caller's member name, optional |
int | lineNumber | caller line number, optional |
Returns
Type | Description |
---|---|
ITimeSeries<double> | lowest value of past n bars |
Normalize(ITimeSeries<double>, int, CacheId, string, int)
Normalize time series over number of bars; 1.0 being the average.
Declaration
public static ITimeSeries<double> Normalize(this ITimeSeries<double> series, int n, CacheId parentId = null, string memberName = "", int lineNumber = 0)
Parameters
Type | Name | Description |
---|---|---|
ITimeSeries<double> | series | input time series |
int | n | normalizing period |
CacheId | parentId | caller cache id, optional |
string | memberName | caller's member name, optional |
int | lineNumber | caller line number, optional |
Returns
Type | Description |
---|---|
ITimeSeries<double> | normalized time series |
Range(Instrument, int, CacheId, string, int)
Calculate range over the specified number of past bars.
Declaration
public static ITimeSeries<double> Range(this Instrument series, int n, CacheId parentId = null, string memberName = "", int lineNumber = 0)
Parameters
Type | Name | Description |
---|---|---|
Instrument | series | input time series (OHLC) |
int | n | number of bars to search |
CacheId | parentId | caller cache id, optional |
string | memberName | caller's member name, optional |
int | lineNumber | caller line number, optional |
Returns
Type | Description |
---|---|
ITimeSeries<double> | range between highest and lowest value of past n bars |
Range(ITimeSeries<double>, int, CacheId, string, int)
Calculate range over the specified number of past bars.
Declaration
public static ITimeSeries<double> Range(this ITimeSeries<double> series, int n, CacheId parentId = null, string memberName = "", int lineNumber = 0)
Parameters
Type | Name | Description |
---|---|---|
ITimeSeries<double> | series | input time series |
int | n | number of bars to search |
CacheId | parentId | caller cache id, optional |
string | memberName | caller's member name, optional |
int | lineNumber | caller line number, optional |
Returns
Type | Description |
---|---|
ITimeSeries<double> | range between highest and lowest value of past n bars |
Return(ITimeSeries<double>, CacheId, string, int)
Calculate absolute return, as difference from the previous to the current value of the time series.
Declaration
public static ITimeSeries<double> Return(this ITimeSeries<double> series, CacheId parentId = null, string memberName = "", int lineNumber = 0)
Parameters
Type | Name | Description |
---|---|---|
ITimeSeries<double> | series | input time series |
CacheId | parentId | caller cache id, optional |
string | memberName | caller's member name, optional |
int | lineNumber | caller line number, optional |
Returns
Type | Description |
---|---|
ITimeSeries<double> | absolute return |
Sqrt(ITimeSeries<double>, CacheId, string, int)
Calculate square root of time series.
Declaration
public static ITimeSeries<double> Sqrt(this ITimeSeries<double> series, CacheId parentId = null, string memberName = "", int lineNumber = 0)
Parameters
Type | Name | Description |
---|---|---|
ITimeSeries<double> | series | input time series |
CacheId | parentId | caller cache id, optional |
string | memberName | caller's member name, optional |
int | lineNumber | caller line number, optional |
Returns
Type | Description |
---|---|
ITimeSeries<double> | square root time series |
Square(ITimeSeries<double>, CacheId, string, int)
Calculate square of time series.
Declaration
public static ITimeSeries<double> Square(this ITimeSeries<double> series, CacheId parentId = null, string memberName = "", int lineNumber = 0)
Parameters
Type | Name | Description |
---|---|---|
ITimeSeries<double> | series | input time series |
CacheId | parentId | caller cache id, optional |
string | memberName | caller's member name, optional |
int | lineNumber | caller line number, optional |
Returns
Type | Description |
---|---|
ITimeSeries<double> | squared input time series |
ToDouble(ITimeSeries<long>, CacheId, string, int)
Cast time series to double
Declaration
public static ITimeSeries<double> ToDouble(this ITimeSeries<long> series, CacheId parentId = null, string memberName = "", int lineNumber = 0)
Parameters
Type | Name | Description |
---|---|---|
ITimeSeries<long> | series | input series of long |
CacheId | parentId | caller cache id, optional |
string | memberName | caller's member name, optional |
int | lineNumber | caller line number, optional |
Returns
Type | Description |
---|---|
ITimeSeries<double> | output series of double |