![]() |
Trading System API
3.0
Library for Simulating and Deploying Trading and Investment Strategies
|
Functions | |
sref< double > | tsa::AD (sref< double > &open, sref< double > &highs, sref< double > &lows, sref< double > &closes, sref< double > vol) |
sref< double > | tsa::AD (sref< double > &highs, sref< double > &lows, sref< double > &closes, sref< double > &vol) |
sref< double > | tsa::ADX (sref< double > highs, sref< double > lows, sref< double > closes, size_t period, size_t period_smooth) |
Average Directional Index by Welles Wilder. More... | |
series_tuple< double > | tsa::BANDPASSFILTER (sref< double > data, size_t period, double bandwidth) |
Returns Bandpass Filter. More... | |
series_tuple< double > | tsa::BB (sref< double > highs, sref< double > lows, sref< double > closes, size_t period, double stdev=2.0) |
Bollinger Bands are volatility bands located a given standard deviation above and below the moving average. They were developed by John Bollinger. More... | |
series_tuple< double > | tsa::BEAR_POWER (sref< double > highs, sref< double > lows, sref< double > closes, size_t period=13) |
Returns the 'Bear Power' as developed by Alexander Elder. More... | |
series_tuple< double > | tsa::BULL_POWER (sref< double > highs, sref< double > lows, sref< double > closes, size_t period=13) |
Returns the 'Bull Power' as developed by Alexander Elder. More... | |
sref< double > | tsa::BUTTERWORTHMA (sref< double > data, sref< size_t > period, size_t max_period) |
Returns Dynamic Butterworth MA, 2 poles. More... | |
sref< double > | tsa::BUTTERWORTHMA (sref< double > data, size_t period, size_t max_period) |
Returns Static Butterworth MA, 2 poles. More... | |
sref< double > | tsa::BUTTERWORTHMA_3P (sref< double > data, sref< size_t > period, size_t max_period) |
Returns Dynamic Butterworth MA, 3 poles. More... | |
sref< double > | tsa::BUTTERWORTHMA_3P (sref< double > data, size_t period, size_t max_period) |
Returns Static Butterworth MA, 3 poles. More... | |
sref< double > | tsa::CCI (sref< double > highs, sref< double > lows, sref< double > closes, size_t period) |
Returns the Commodity Channel Index (CCI) as developed by Donald Lambert. It represents the difference of the current price and an average over the given period adjusted by the average deviation from the average over the given period. More... | |
sref< double > | tsa::CGO (sref< double > data, sref< size_t > period, size_t max_period) |
Returns Center of Gravity Oscillator (CGO), dynamic period. More... | |
sref< double > | tsa::CGO (sref< double > data, size_t period, size_t max_period) |
Returns Center of Gravity Oscillator (CGO), static period. More... | |
sref< double > | tsa::CGO_ADAPTIVE (sref< double > data, double alpha) |
Returns Adapptive Center of Gravity Oscillator (CGO). More... | |
sref< double > | tsa::CHAIKIN_ADL (sref< double > highs, sref< double > lows, sref< double > closes, sref< double > volumes) |
'Chaiking Accumulation Distribution'. Measures the cummulative 'Money Flow Volume' (CHAIKIN_MFV()) into and out of a security. More... | |
sref< double > | tsa::CHAIKIN_MF (sref< double > highs, sref< double > lows, sref< double > closes, sref< double > volumes, size_t period) |
'Chaikin Money Flow'. Represents the 'Money Flow Volume' (CHAIKING_MFV()) over a given period of time. More... | |
sref< double > | tsa::CHAIKIN_MFV (sref< double > highs, sref< double > lows, sref< double > closes, sref< double > volumes) |
'Chaikin Money Flow Volume'. Measures the amount of money flowing into and out of a traded security on a given price bar. More... | |
sref< double > | tsa::CHAIKIN_OSC (sref< double > highs, sref< double > lows, sref< double > closes, sref< double > volumes, size_t period) |
Returns the 'Chaikin Oscilator'. More... | |
sref< double > | tsa::CHAIKIN_VOLAT (sref< double > highs, sref< double > lows, size_t period) |
Returns the 'Chaikin Volatility'. More... | |
sref< double > | tsa::CYBERCYCLE (sref< double > data, double alpha) |
Returns Cyber Cycle. More... | |
sref< double > | tsa::CYBERCYCLE_ADAPTIVE (sref< double > data, double alpha) |
Returns Adaptive Cyber Cycle. More... | |
sref< double > | tsa::CYBERCYCLE_P (sref< double > data, sref< size_t > period, size_t max_period) |
Returns Dynamic Cyber Cycle with period. More... | |
sref< double > | tsa::CYBERCYCLE_P (sref< double > data, size_t period, size_t max_period) |
Returns Static Cyber Cycle with period. More... | |
sref< double > | tsa::DCMA (sref< double > data, sref< size_t > period, size_t max_period) |
Returns Dynamic DCMA. More... | |
sref< double > | tsa::DCMA (sref< double > data, size_t period, size_t max_period) |
Returns Static DCMA. More... | |
sref< double > | tsa::DECYCLEROSC (sref< double > data, size_t hp_period1, size_t hp_period2) |
Returns Decycler Oscillator (CAT). More... | |
sref< double > | tsa::DI_DN (sref< double > highs, sref< double > lows, sref< double > closes, size_t period) |
sref< double > | tsa::DI_UP (sref< double > highs, sref< double > lows, sref< double > closes, size_t period) |
sref< double > | tsa::DM_DN (sref< double > highs, sref< double > lows, size_t period) |
sref< double > | tsa::DM_DN_RAW (sref< double > highs, sref< double > low) |
sref< double > | tsa::DM_UP (sref< double > highs, sref< double > lows, size_t period) |
sref< double > | tsa::DM_UP_RAW (sref< double > highs, sref< double > low) |
sref< double > | tsa::DMI (sref< double > highs, sref< double > lows, sref< double > closes, size_t period) |
sref< size_t > | tsa::DOMINANTCYCLEPERIOD_AC (sref< double > close) |
Returns Autocorrelation Dominant Cycle Period. More... | |
sref< size_t > | tsa::DOMINANTCYCLEPERIOD_HILBERT (sref< double > data) |
Returns Dominant Cycle Period using the Hilbert Transform. More... | |
sref< size_t > | tsa::DOMINANTCYCLEPERIOD_HOMODYNE (sref< double > data) |
Returns Dominant Cycle Period using Homodyne Discriminator. More... | |
sref< double > | tsa::EASE_OF_MOV (sref< double > highs, sref< double > lows, sref< double > vol, size_t smooth_period) |
Ease of Movement. More... | |
sref< double > | tsa::EASE_OF_MOV_RAW (sref< double > highs, sref< double > lows, sref< double > vol) |
Ease of Movement (Raw) More... | |
sref< double > | tsa::EMA_WILDER (sref< double > data, size_t period) |
Exponential moving average by Welles Wilder. Differs from regular EMA(). More... | |
sref< double > | tsa::FISHERCGO (sref< double > data, sref< size_t > period, size_t max_period) |
Returns Fisher Center of Gravity Oscillator (FCGO). More... | |
sref< double > | tsa::FISHERCGO (sref< double > data, size_t period, size_t max_period) |
Returns Fisher Center of Gravity Oscillator (FCGO). More... | |
sref< double > | tsa::FISHERRVI (sref< double > op, sref< double > hi, sref< double > lo, sref< double > cl, sref< size_t > period, size_t max_period) |
Returns Dynamic Fisher Relative Vigour Index (FISHERRVI). More... | |
sref< double > | tsa::FISHERRVI (sref< double > op, sref< double > hi, sref< double > lo, sref< double > cl, size_t period, size_t max_period) |
Returns Static Fisher Relative Vigour Index (FISHERRVI). More... | |
sref< double > | tsa::FISHERTRANSFORM (sref< double > data, sref< size_t > period, size_t max_period) |
Returns Dynamic Fisher Transform. More... | |
sref< double > | tsa::FISHERTRANSFORM (sref< double > data, size_t period, size_t max_period) |
Returns Static Fisher Transform. More... | |
sref< double > | tsa::FORCE_INDEX (sref< double > closes, sref< double > volumes, size_t period) |
Returns the 'Force Index'. It represents a smoothing of the value returned by RAW_FORCE_INDEX(). More... | |
sref< double > | tsa::FORCE_INDEX_RAW (sref< double > closes, sref< double > volumes) |
Returns the 'Raw Force Index'. It represents the price change from the previous bar multiplied by volume, to provide a measure of 'force'. Developed by Alexander Elder. More... | |
series_tuple< double > | tsa::HILBERT_OSC (sref< double > data) |
Returns Ehlers' Hilbet Oscillator. More... | |
sref< double > | tsa::IFISHERCYBERCYCLE (sref< double > data, double alpha) |
Returns Inverse Fisher Cyber Cycle. More... | |
sref< double > | tsa::IFISHERCYBERCYCLE_P (sref< double > data, sref< size_t > period, size_t max_period) |
Returns Dynamic Inverse Fisher Cyber Cycle with period. More... | |
sref< double > | tsa::IFISHERCYBERCYCLE_P (sref< double > data, size_t period, size_t max_period) |
Returns Static Inverse Fisher Cyber Cycle with period. More... | |
sref< double > | tsa::ITREND_RST (sref< double > data) |
Returns Instantaneous Trendline. More... | |
sref< double > | tsa::KALMANMA (sref< double > data, sref< size_t > period, size_t max_period) |
Returns Dynamic Kalman MA. More... | |
sref< double > | tsa::KALMANMA (sref< double > data, size_t period, size_t max_period) |
Returns Static Kalman MA. More... | |
sref< double > | tsa::LAGUERREMA (sref< double > data, double gamma) |
Returns Laguerre MA. More... | |
sref< double > | tsa::LAGUERRERSI (sref< double > data, double gamma) |
Returns Laguerre RSI. More... | |
series_tuple< double > | tsa::MACD (sref< double > closes, size_t short_period=12, size_t long_period=26, size_t signal_period=9) |
Moving Average Convergence Divergence (MACD) as developed by Thomas Aspray. It measures the difference between two moving averages. The indicator is often shown as a histogram which is the difference between the MACD and a signal line (moving average of MACD). More... | |
series_tuple< double > | tsa::MAMA_FAMA (sref< double > data, double fast_limit, double slow_limit) |
Returns Ehlers' MAMA and FAMA. More... | |
sref< double > | tsa::MASS_INDEX (sref< double > closes, size_t avg_period=9, size_t avg_of_avg_period=9, size_t ratio_sum_period=25) |
Mass Index. A measure of range expansion developed by Donald Dorsey. More... | |
sref< double > | tsa::MFI (sref< double > highs, sref< double > lows, sref< double > closes, sref< double > vol, size_t period=14) |
Money Flow Index. More... | |
sref< double > | tsa::ROOFINGFILTER (sref< double > data, size_t lp_period, size_t hp_period) |
Returns Roofing Filter. More... | |
sref< double > | tsa::RSI (sref< double > data, size_t period) |
Relative Strength Index. More... | |
sref< double > | tsa::RSI_MOD (sref< double > data, sref< size_t > period, size_t max_period) |
Returns Dynamic Modified RSI. More... | |
sref< double > | tsa::RSI_MOD (sref< double > data, size_t period, size_t max_period) |
Returns Static Modified RSI. More... | |
sref< double > | tsa::RVI (sref< double > op, sref< double > hi, sref< double > lo, sref< double > cl, sref< size_t > period, size_t max_period) |
Returns Dynamic Relative Vigour Index (RVI). More... | |
sref< double > | tsa::RVI (sref< double > op, sref< double > hi, sref< double > lo, sref< double > cl, size_t period, size_t max_period) |
Returns Static Relative Vigour Index (RVI). More... | |
sref< double > | tsa::RVI_ADAPTIVE (sref< double > op, sref< double > hi, sref< double > lo, sref< double > cl, double alpha) |
Returns Adaptive Relative Vigour Index (RVI). More... | |
sref< double > | tsa::SAM (sref< double > data, double alpha, size_t cutoff) |
Returns Smoothed Adative Momentum (SAM). More... | |
series_tuple< double > | tsa::SINEWAVE_RST (sref< double > data) |
Returns Ehlers' Sinewave. More... | |
sref< double > | tsa::SNR_HILBERT (sref< double > high, sref< double > low, size_t period) |
Returns Static SNR (HILBERT). More... | |
sref< double > | tsa::SNR_RST (sref< double > high, sref< double > low) |
Returns Signal to Noise Ratio (SNR). More... | |
sref< double > | tsa::SRSI (sref< double > data, sref< size_t > period, size_t max_period) |
Returns Dynamic SRSI. More... | |
sref< double > | tsa::SRSI (sref< double > data, size_t period, size_t max_period) |
Returns Static SRSI. More... | |
series_tuple< double > | tsa::STOCH (sref< double > highs, sref< double > lows, sref< double > closes, size_t period, size_t k_smooth_period=3, size_t d_smooth_period=3) |
Returns the 'smoothed' Stochastic K and D where K is a smoothed version of the Stochastic-Oscillator (STOCH_OSC()) and D is a smoothed version on K. More... | |
sref< double > | tsa::STOCH_OSC (sref< double > highs, sref< double > lows, sref< double > closes, size_t period) |
Returns the Stochastic Oscillator (raw Stochastic) as developed by George C. Lane. It measures the current price in relation to the given period's price range. More... | |
sref< double > | tsa::STOCHASTIC_MOD (sref< double > data, sref< size_t > period, size_t max_period) |
Returns Dynamic Modified Stochastic. More... | |
sref< double > | tsa::STOCHASTIC_MOD (sref< double > data, size_t period, size_t max_period) |
Returns Static Modified Stochastic. More... | |
sref< double > | tsa::SUPERSMOOTHERMA (sref< double > data, sref< size_t > period, size_t max_period) |
Returns Dynamic Supersmoother MA. More... | |
sref< double > | tsa::SUPERSMOOTHERMA (sref< double > data, size_t period, size_t max_period) |
Returns Static Supersmoother MA. More... | |
sref< double > | tsa::SUPERSMOOTHERMA_3P (sref< double > data, sref< size_t > period, size_t max_period) |
Returns Dynamic Supersmoother MA, 3 poles. More... | |
sref< double > | tsa::SUPERSMOOTHERMA_3P (sref< double > data, size_t period, size_t max_period) |
Returns Static Supersmoother MA, 3 poles. More... | |
sref< double > | tsa::TP (sref< double > highs, sref< double > lows, sref< double > closes) |
Alias for TYPICAL_PRICE(). More... | |
series_tuple< double > | tsa::TRIX (sref< double > closes, size_t smooth_1_period=15, size_t smooth_2_period=15, size_t smooth_3_period=15, size_t signal_period=9) |
TRIX. Represents the percent-rate-of-change of a triple exponentially smoothed average. Developed by Jack Hutson. More... | |
sref< double > | tsa::TRUE_RANGE (sref< double > highs, sref< double > lows, sref< double > closes) |
Returns the 'true range'. More... | |
sref< double > | tsa::TSI (sref< double > series, size_t smooth_1_period=25, size_t smooth_2_period=13) |
'True Strenght Indicator'. A momentum oscillator developed by William Blau. More... | |
sref< double > | tsa::TWIGGS_MF (sref< double > highs, sref< double > lows, sref< double > closes, sref< double > vol, size_t period=14) |
Twiggs Money Flow. More... | |
sref< double > | tsa::TYPICAL_PRICE (sref< double > highs, sref< double > lows, sref< double > closes) |
Returns the 'typical price'. ((hi + lo + cl) / 3.0). More... | |
sref< double > | tsa::ULCER_INDEX (sref< double > closes, size_t period=14) |
Ulcer Index. More... | |
sref< double > | tsa::ULTIMATE_OSC (sref< double > highs, sref< double > lows, sref< double > closes, size_t short_period=7, size_t medium_period=14, size_t long_period=28) |
'Ultimate Oscillator'. Developed by Larry Williams.It is a momentum indicators designed to capture the momentum across multiple timeframes. More... | |
sref< double > | tsa::VOLATILITY (sref< double > data, size_t period, size_t num_intervals_in_year) |
Returns the annualized volatility over the given period. More... | |
sref< double > | tsa::VOLATILITY_ALT (sref< double > data, size_t period) |
Alternative Volatility calculated as: STDEVP(close, period) / AVERAGE(close, period);. More... | |
sref< double > | tsa::WILLIAMS_R (sref< double > highs, sref< double > lows, sref< double > closes, size_t period=14) |
Returns the 'Williams R' indicator as developed by Larry Williams. It represents the inverse of the stochastic indicator STOCH(). More... | |
sref< double > tsa::ADX | ( | sref< double > | highs, |
sref< double > | lows, | ||
sref< double > | closes, | ||
size_t | period, | ||
size_t | period_smooth | ||
) |
Average Directional Index by Welles Wilder.
highs | The highs. |
lows | The lows. |
closes | The closes. |
period | The period over which the indicator is calculated. |
period_smooth | The period with which the raw indicator is smoothed. |
series_tuple< double > tsa::BANDPASSFILTER | ( | sref< double > | data, |
size_t | period, | ||
double | bandwidth | ||
) |
Returns Bandpass Filter.
This particular Bandpass Filter was created by John Ehlers. The code is from the book "Cycle Analytics for Traders" by John Ehlers.
data | Data series |
period | Period, normally set to 20. |
bandwidth | Bandwidth factor, normally set to 0.3. |
series_tuple< double > tsa::BB | ( | sref< double > | highs, |
sref< double > | lows, | ||
sref< double > | closes, | ||
size_t | period, | ||
double | stdev = 2.0 |
||
) |
Bollinger Bands are volatility bands located a given standard deviation above and below the moving average. They were developed by John Bollinger.
Note that the function returns a tuple of 3 series named 'upper', 'lower' and 'avg' respectively. In order to access each individual series use operator() as in:
highs | The highs. |
lows | The lows. |
closes | The closes. |
period | The period. |
stdev | The standard deviation multiplier. The default value is 2.0. |
series_tuple< double > tsa::BEAR_POWER | ( | sref< double > | highs, |
sref< double > | lows, | ||
sref< double > | closes, | ||
size_t | period = 13 |
||
) |
Returns the 'Bear Power' as developed by Alexander Elder.
highs | The highs. |
lows | The lows. |
closes | The closes. |
period | The period. |
series_tuple< double > tsa::BULL_POWER | ( | sref< double > | highs, |
sref< double > | lows, | ||
sref< double > | closes, | ||
size_t | period = 13 |
||
) |
Returns the 'Bull Power' as developed by Alexander Elder.
highs | The highs. |
lows | The lows. |
closes | The closes. |
period | The period. |
Returns Dynamic Butterworth MA, 2 poles.
Butterworth MA is a well known moving average. This particular implementation is by John Ehlers. The code is from the book "Cycle Analytics for Traders" by John Ehlers.
data | Data series |
period | Dynamic lookback period. |
max_period | Maximum lookback period. |
sref< double > tsa::BUTTERWORTHMA | ( | sref< double > | data, |
size_t | period, | ||
size_t | max_period | ||
) |
Returns Static Butterworth MA, 2 poles.
Butterworth MA is a well known moving average. This particular implementation is by John Ehlers. The code is from the book "Cycle Analytics for Traders" by John Ehlers.
data | Data series |
period | Static lookback period. |
max_period | Maximum lookback period. |
sref< double > tsa::BUTTERWORTHMA_3P | ( | sref< double > | data, |
sref< size_t > | period, | ||
size_t | max_period | ||
) |
Returns Dynamic Butterworth MA, 3 poles.
Butterworth MA is a well known moving average. This particular implementation is by John Ehlers. The code is from the book "Cycle Analytics for Traders" by John Ehlers.
data | Data series |
period | Dynamic lookback period. |
max_period | Maximum lookback period. |
sref< double > tsa::BUTTERWORTHMA_3P | ( | sref< double > | data, |
size_t | period, | ||
size_t | max_period | ||
) |
Returns Static Butterworth MA, 3 poles.
Butterworth MA is a well known moving average. This particular implementation is by John Ehlers. The code is from the book "Cycle Analytics for Traders" by John Ehlers.
data | Data series |
period | Static lookback period. |
max_period | Maximum lookback period. |
sref< double > tsa::CCI | ( | sref< double > | highs, |
sref< double > | lows, | ||
sref< double > | closes, | ||
size_t | period | ||
) |
Returns the Commodity Channel Index (CCI) as developed by Donald Lambert. It represents the difference of the current price and an average over the given period adjusted by the average deviation from the average over the given period.
highs | The highs. |
lows | The lows. |
closes | The closes. |
period | The period. |
Returns Center of Gravity Oscillator (CGO), dynamic period.
CGO was created by John Ehlers. It's a momentum type oscillator with little lag. TSAPI provides a normalised version which oscillates around zero. This is the dynamic period version.
data | Data series. |
period | Dynamic lookback period. |
max_period | Maximum Lookback period. |
sref< double > tsa::CGO | ( | sref< double > | data, |
size_t | period, | ||
size_t | max_period | ||
) |
Returns Center of Gravity Oscillator (CGO), static period.
CGO was created by John Ehlers. It's a momentum type oscillator with little lag. TSAPI provides a normalised version which oscillates around zero. This is the static period version.
data | Data series. |
period | Static lookback period. |
max_period | Maximum Lookback period. |
sref< double > tsa::CGO_ADAPTIVE | ( | sref< double > | data, |
double | alpha | ||
) |
Returns Adapptive Center of Gravity Oscillator (CGO).
CGO was created by John Ehlers. It's a momentum type oscillator with little lag. TSAPI provides a normalised version which oscillates around zero. This adaptive version is from the book "Cybernetic Analysis for Stocks and Futures".
data | Data series. |
alpha | Smoothing factor, usually set to 0.07. |
sref< double > tsa::CHAIKIN_ADL | ( | sref< double > | highs, |
sref< double > | lows, | ||
sref< double > | closes, | ||
sref< double > | volumes | ||
) |
'Chaiking Accumulation Distribution'. Measures the cummulative 'Money Flow Volume' (CHAIKIN_MFV()) into and out of a security.
highs | The highs. |
lows | The lows. |
closes | The closes. |
volumes | The volume. |
sref< double > tsa::CHAIKIN_MF | ( | sref< double > | highs, |
sref< double > | lows, | ||
sref< double > | closes, | ||
sref< double > | volumes, | ||
size_t | period | ||
) |
'Chaikin Money Flow'. Represents the 'Money Flow Volume' (CHAIKING_MFV()) over a given period of time.
highs | The highs. |
lows | The lows. |
closes | The closes. |
volumes | The volumes. |
period | The period. |
sref< double > tsa::CHAIKIN_MFV | ( | sref< double > | highs, |
sref< double > | lows, | ||
sref< double > | closes, | ||
sref< double > | volumes | ||
) |
'Chaikin Money Flow Volume'. Measures the amount of money flowing into and out of a traded security on a given price bar.
highs | The highs. |
lows | The lows. |
closes | The closes. |
volumes | The volumes. |
sref<double> tsa::CHAIKIN_OSC | ( | sref< double > | highs, |
sref< double > | lows, | ||
sref< double > | closes, | ||
sref< double > | volumes, | ||
size_t | period | ||
) |
Returns the 'Chaikin Oscilator'.
highs | The highs. |
lows | The lows. |
closes | The closes. |
volumes | The volumes. |
period | The period. |
Returns the 'Chaikin Volatility'.
highs | The highs. |
lows | The lows. |
period | The period. |
sref< double > tsa::CYBERCYCLE | ( | sref< double > | data, |
double | alpha | ||
) |
Returns Cyber Cycle.
Cyber Cycle was created by John Ehlers. It extracts, in a simple way, the cycle component of a data series.
data | Data series. |
alpha | Smoothing factor, 0.07 normally used. |
sref< double > tsa::CYBERCYCLE_ADAPTIVE | ( | sref< double > | data, |
double | alpha | ||
) |
Returns Adaptive Cyber Cycle.
Cyber Cycle was created by John Ehlers. It extracts, in a simple way, the cycle component of a data series. This adaptive version is from the book "Cybernetic Analysis for Stocks and Futures".
data | Data series. |
alpha | Smoothing factor, 0.07 normally used. |
Returns Dynamic Cyber Cycle with period.
Cyber Cycle was created by John Ehlers. It extracts, in a simple way, the cycle component of a data series. This is a TSAPI version using a lookback period instead of alpha smoothing factor. A period of 14 is about the same as an alpha of 0.07.
data | Data series. |
period | Dynamic lookback period. |
max_period | Maximum lookback period. |
sref< double > tsa::CYBERCYCLE_P | ( | sref< double > | data, |
size_t | period, | ||
size_t | max_period | ||
) |
Returns Static Cyber Cycle with period.
Cyber Cycle was created by John Ehlers. It extracts, in a simple way, the cycle component of a data series. This is a TSAPI version using a lookback period instead of alpha smoothing factor. A period of 14 is about the same as an alpha of 0.07.
data | Data series. |
period | Static lookback period. |
max_period | Maximum lookback period. |
Returns Dynamic DCMA.
Distance Coefficent MA (DCMA) was created by John Ehlers. It's an adaptive type of MA. It uses the distance between current and previous prices to adjust the MA coefficients making it more responsive in a fast market.
data | Data series. |
period | Dynamic lookback period. |
max_period | Maximum lookback period. |
sref< double > tsa::DCMA | ( | sref< double > | data, |
size_t | period, | ||
size_t | max_period | ||
) |
Returns Static DCMA.
Distance Coefficent MA (DCMA) was created by John Ehlers. It's an adaptive type of MA. It uses the distance between current and previous prices to adjust the MA coefficients making it more responsive in a fast market.
data | Data series. |
period | Static lookback period. |
max_period | Maximum lookback period. |
sref< double > tsa::DECYCLEROSC | ( | sref< double > | data, |
size_t | hp_period1, | ||
size_t | hp_period2 | ||
) |
Returns Decycler Oscillator (CAT).
Decycler Oscillator was created by John Ehlers. This code is from the code in the book "Cycle Analytics for Traders" by John Ehlers.
data | Data series |
hpperiod1 | Highpass period 1, usually set to 30. |
hpperiod2 | Highpass period 2, usually set to 60. |
sref< size_t > tsa::DOMINANTCYCLEPERIOD_AC | ( | sref< double > | close | ) |
Returns Autocorrelation Dominant Cycle Period.
Autocorrelation Dominant Cycle Period is a well known Spectral Analysis method. This particular implementation was created by John Ehlers. The code is from the book "Cycle Analytics for Traders" by John Ehlers.
close | Close Data series |
sref< size_t > tsa::DOMINANTCYCLEPERIOD_HILBERT | ( | sref< double > | data | ) |
Returns Dominant Cycle Period using the Hilbert Transform.
Dominant Cycle Period using the Hilbert Transform was created by John Ehlers. TSAPI is using the version from S&C November 2000, which is slightly different from the original version. This version is preferred by John Ehlers.
data | Data series. |
sref< size_t > tsa::DOMINANTCYCLEPERIOD_HOMODYNE | ( | sref< double > | data | ) |
Returns Dominant Cycle Period using Homodyne Discriminator.
Dominant Cycle Period using the Homodyne Discriminator was created by John Ehlers. The code is from the book "Rocket Science For Traders" by John Ehlers.
data | Data series. |
sref< double > tsa::EASE_OF_MOV | ( | sref< double > | highs, |
sref< double > | lows, | ||
sref< double > | vol, | ||
size_t | smooth_period | ||
) |
Ease of Movement.
highs | The highs. |
lows | The lows. |
vol | The volume. |
smooth_period | The smooth period. |
sref< double > tsa::EASE_OF_MOV_RAW | ( | sref< double > | highs, |
sref< double > | lows, | ||
sref< double > | vol | ||
) |
Ease of Movement (Raw)
highs | The highs. |
lows | The lows. |
vol | The volume. |
sref< double > tsa::EMA_WILDER | ( | sref< double > | data, |
size_t | period | ||
) |
Exponential moving average by Welles Wilder. Differs from regular EMA().
data | The data. |
period | The period. |
Returns Fisher Center of Gravity Oscillator (FCGO).
CGO was created by John Ehlers. It's a momentum type oscillator with little lag. TSAPI provides a normalised version which oscillates around zero. Fisher Transform will normalize the values of CGO between -1 and 1 and make the pdf (probability density function) of the returned values Gaussian.
data | Data series. |
period | Dynamic lookback period. |
max_period | Maximum Lookback period. |
sref< double > tsa::FISHERCGO | ( | sref< double > | data, |
size_t | period, | ||
size_t | max_period | ||
) |
Returns Fisher Center of Gravity Oscillator (FCGO).
CGO was created by John Ehlers. It's a momentum type oscillator with little lag. TSAPI provides a normalised version which oscillates around zero. Fisher Transform will normalize the values of CGO between -1 and 1 and make the pdf (probability density function) of the returned values Gaussian.
data | Data series. |
period | Static lookback period. |
max_period | Maximum Lookback period. |
sref< double > tsa::FISHERRVI | ( | sref< double > | op, |
sref< double > | hi, | ||
sref< double > | lo, | ||
sref< double > | cl, | ||
sref< size_t > | period, | ||
size_t | max_period | ||
) |
Returns Dynamic Fisher Relative Vigour Index (FISHERRVI).
RVI was created by John Ehlers. It's a momentum type oscillator, returning the relationship between wick and body of a candle. Fisher Transform will normalize the values of RVI between -1 and 1 and make the pdf (probability density function) of the returned values Gaussian.
open | Open series. |
high | High series. |
low | Low series. |
close | Close series. |
period | Dynamic lookback period. |
max_period | Maximum lookback period. |
sref< double > tsa::FISHERRVI | ( | sref< double > | op, |
sref< double > | hi, | ||
sref< double > | lo, | ||
sref< double > | cl, | ||
size_t | period, | ||
size_t | max_period | ||
) |
Returns Static Fisher Relative Vigour Index (FISHERRVI).
RVI was created by John Ehlers. It's a momentum type oscillator, returning the relationship between wick and body of a candle. Fisher Transform will normalize the values of RVI between -1 and 1 and make the pdf (probability density function) of the returned values Gaussian.
open | Open series. |
high | High series. |
low | Low series. |
close | Close series. |
period | Static lookback period. |
max_period | Maximum lookback period. |
sref< double > tsa::FISHERTRANSFORM | ( | sref< double > | data, |
sref< size_t > | period, | ||
size_t | max_period | ||
) |
Returns Dynamic Fisher Transform.
Fisher Transform was introduced to the trading community by John Ehlers. Fisher Transform will normalize the values between -1 and 1 and make the pdf (probability density function) of the returned values Gaussian.
data | Data series. |
period | Dynamic lookback period. |
max_period | Maximum lookback period. |
sref< double > tsa::FISHERTRANSFORM | ( | sref< double > | data, |
size_t | period, | ||
size_t | max_period | ||
) |
Returns Static Fisher Transform.
Fisher Transform was introduced to the trading community by John Ehlers. Fisher Transform will normalize the values between -1 and 1 and make the pdf (probability density function) of the returned values Gaussian.
data | Data series. |
period | Static lookback period. |
max_period | Maximum lookback period. |
Returns the 'Force Index'. It represents a smoothing of the value returned by RAW_FORCE_INDEX().
closes | The closes. |
volumes | The volumes. |
period | The period. |
Returns the 'Raw Force Index'. It represents the price change from the previous bar multiplied by volume, to provide a measure of 'force'. Developed by Alexander Elder.
closes | The closes. |
volumes | The volumes. |
series_tuple< double > tsa::HILBERT_OSC | ( | sref< double > | data | ) |
Returns Ehlers' Hilbet Oscillator.
The Hilbert Oscillator was develoed by John Ehlers. This indicator could be used to identify turning points. The code is from the book "Cybernetic Analysis for Stocks and Futures" by John Ehlers.
data | Data series. |
sref< double > tsa::IFISHERCYBERCYCLE | ( | sref< double > | data, |
double | alpha | ||
) |
Returns Inverse Fisher Cyber Cycle.
Cyber Cycle created by John Ehlers. It extracts, in a simple way, the cycle component of a data series. Inverse Fisher Transform will normalize the values of Cyber Cycle between -1 and 1.
data | Data series. |
alpha | Smoothing factor, 0.07 normally used. |
sref< double > tsa::IFISHERCYBERCYCLE_P | ( | sref< double > | data, |
sref< size_t > | period, | ||
size_t | max_period | ||
) |
Returns Dynamic Inverse Fisher Cyber Cycle with period.
Cyber Cycle created by John Ehlers. It extracts, in a simple way, the cycle component of a data series. Inverse Fisher Transform will normalize the values of Cyber Cycle between -1 and 1. This is a TSAPI version using a lookback period instead of alpha smoothing factor. A period of 14 is about the same as an alpha of 0.07.
data | Data series. |
period | Dynamic lookback period. |
max_period | Maximum lookback period. |
sref< double > tsa::IFISHERCYBERCYCLE_P | ( | sref< double > | data, |
size_t | period, | ||
size_t | max_period | ||
) |
Returns Static Inverse Fisher Cyber Cycle with period.
Cyber Cycle created by John Ehlers. It extracts, in a simple way, the cycle component of a data series. Inverse Fisher Transform will normalize the values of Cyber Cycle between -1 and 1. This is a TSAPI version using a lookback period instead of alpha smoothing factor. A period of 14 is about the same as an alpha of 0.07.
data | Data series. |
period | Static lookback period. |
max_period | Maximum lookback period. |
sref< double > tsa::ITREND_RST | ( | sref< double > | data | ) |
Returns Instantaneous Trendline.
Instantaneous Trendline was created by John Ehlers. The code is from the book "Rocket Science For Traders" by John Ehlers.
data | Data series. |
Returns Dynamic Kalman MA.
Kalman MA is a well known moving average. In the past it was used for tracking in missiles.
data | Data series. |
period | Dynamic lookback period. |
max_period | Maximum lookback period. |
sref< double > tsa::KALMANMA | ( | sref< double > | data, |
size_t | period, | ||
size_t | max_period | ||
) |
Returns Static Kalman MA.
Kalman MA is a well known moving average. In the past it was used for tracking in missiles.
data | Data series. |
period | Static lookback period. |
max_period | Maximum lookback period. |
sref< double > tsa::LAGUERREMA | ( | sref< double > | data, |
double | gamma | ||
) |
Returns Laguerre MA.
Laguerre MA was introduced to the trading community by John Ehlers. The code is from the book "Cycle Analytics for Traders" by John Ehlers.
data | Data series |
gamma | smoothing factor, usually set to 0.5. |
sref< double > tsa::LAGUERRERSI | ( | sref< double > | data, |
double | gamma | ||
) |
Returns Laguerre RSI.
Laguerre RSI was introduced to the trading community by John Ehlers. It's based on the Laguerre MA. The code is from the book "Cycle Analytics for Traders" by John Ehlers.
data | Data series |
gamma | smoothing factor, usually set to 0.5. |
series_tuple< double > tsa::MACD | ( | sref< double > | closes, |
size_t | short_period = 12 , |
||
size_t | long_period = 26 , |
||
size_t | signal_period = 9 |
||
) |
Moving Average Convergence Divergence (MACD) as developed by Thomas Aspray. It measures the difference between two moving averages. The indicator is often shown as a histogram which is the difference between the MACD and a signal line (moving average of MACD).
Note that the function returns a tuple of 3 series named 'macd', 'signal' and 'hist' respectively. In order to access each individual series use operator() as in:
.
closes | The closes. |
short_period | The short period. |
long_period | The long period. |
signal_period | The signal period. |
series_tuple< double > tsa::MAMA_FAMA | ( | sref< double > | data, |
double | fast_limit, | ||
double | slow_limit | ||
) |
Returns Ehlers' MAMA and FAMA.
Mother of All Moving Averages (MAMA) and Following Adaptive Moving Average (FAMA) was created by John Ehlers. The code is from the book "Cybernetic Analysis for Stocks and Futures" by John Ehlers.
data | Data series. |
fast_limit | Max value, usually 0.5. |
slow_limit | Min value, usually 0.05. |
sref< double > tsa::MASS_INDEX | ( | sref< double > | closes, |
size_t | avg_period = 9 , |
||
size_t | avg_of_avg_period = 9 , |
||
size_t | ratio_sum_period = 25 |
||
) |
Mass Index. A measure of range expansion developed by Donald Dorsey.
closes | The closes. |
avg_period | The average period. |
avg_of_avg_period | The average of average period. |
ratio_sum_period | The ratio sum period. |
sref< double > tsa::MFI | ( | sref< double > | highs, |
sref< double > | lows, | ||
sref< double > | closes, | ||
sref< double > | vol, | ||
size_t | period = 14 |
||
) |
Money Flow Index.
highs | The highs. |
lows | The lows. |
closes | The closes. |
vol | The volume. |
period | The period. |
sref< double > tsa::ROOFINGFILTER | ( | sref< double > | data, |
size_t | lp_period, | ||
size_t | hp_period | ||
) |
Returns Roofing Filter.
Roofing Filter was created by John Ehlers. The code is from the book "Cycle Analytics for Traders" by John Ehlers.
data | Data series |
period | Lowpass period, normally set to 10. |
period | Highpass period, normally set to 48. |
sref< double > tsa::RSI | ( | sref< double > | data, |
size_t | period | ||
) |
Relative Strength Index.
data | The data series. |
period | The period. |
Returns Dynamic Modified RSI.
Modified RSI was created by John Ehlers. The code is from the book "Cycle Analytics for Traders" by John Ehlers.
data | Data series |
period | Dynamic lookback period. |
max_period | Maximum lookback period. |
sref< double > tsa::RSI_MOD | ( | sref< double > | data, |
size_t | period, | ||
size_t | max_period | ||
) |
Returns Static Modified RSI.
Modified RSI was created by John Ehlers. The code is from the book "Cycle Analytics for Traders" by John Ehlers.
data | Data series |
period | Static lookback period, normally set to 20. |
max_period | Maximum lookback period. |
sref< double > tsa::RVI | ( | sref< double > | op, |
sref< double > | hi, | ||
sref< double > | lo, | ||
sref< double > | cl, | ||
sref< size_t > | period, | ||
size_t | max_period | ||
) |
Returns Dynamic Relative Vigour Index (RVI).
RVI was created by John Ehlers. It's a momentum type oscillator, returning the relationship between wick and body of a candle.
open | Open series. |
high | High series. |
low | Low series. |
close | Close series. |
period | Dynamic lookback period. |
max_period | Maximum lookback period. |
sref< double > tsa::RVI | ( | sref< double > | op, |
sref< double > | hi, | ||
sref< double > | lo, | ||
sref< double > | cl, | ||
size_t | period, | ||
size_t | max_period | ||
) |
Returns Static Relative Vigour Index (RVI).
RVI was created by John Ehlers. It's a momentum type oscillator, returning the relationship between wick and body of a candle.
open | Open series. |
high | High series. |
low | Low series. |
close | Close series. |
period | Static lookback period. |
max_period | Maximum lookback period. |
sref< double > tsa::RVI_ADAPTIVE | ( | sref< double > | op, |
sref< double > | hi, | ||
sref< double > | lo, | ||
sref< double > | cl, | ||
double | alpha | ||
) |
Returns Adaptive Relative Vigour Index (RVI).
RVI was created by John Ehlers. It's a momentum type oscillator, returning the relationship between wick and body of a candle. This adaptive version is from the book "Cybernetic Analysis for Stocks and Futures".
open | Open series. |
high | High series. |
low | Low series. |
close | Close series. |
alpha | Smoothing factor, usually set to 0.07. |
sref< double > tsa::SAM | ( | sref< double > | data, |
double | alpha, | ||
size_t | cutoff | ||
) |
Returns Smoothed Adative Momentum (SAM).
Smoothed Adative Momentum was created by John Ehlers. It's basically just momentum but smoothed and made adaptive. This version is from the book "Cybernetic Analysis for Stocks and Futures".
data | Data series. |
alpha | Smoothing factor, 0.07 normally used. |
cutoff | Period cutoff, 8 is normally used |
series_tuple< double > tsa::SINEWAVE_RST | ( | sref< double > | data | ) |
Returns Ehlers' Sinewave.
The Sinewave was develoed by John Ehlers. This indicator could be used to identify turning points. The code is from the book "Rocket Sience For Traders" by John Ehlers.
data | Data series. |
Returns Static SNR (HILBERT).
Signal to Noise Ratio (SNR) using the Hilbert Transform was created by John Ehlers. In the TSAPI version the lookback period can be changed. Ehlers used a fixed 7 bar lookback period for normalizing input data. A SNR value above 6 dB indicates the signal is twice as strong as the noise. Noise is defined as High-Low range.
data | Data series. |
period | Static lookback period, usually set to 7. |
max_period | Maximum lookback period. |
Returns Signal to Noise Ratio (SNR).
Signal to Noise Ratio (SNR) using the Homodyne Discriminator was created by John Ehlers. A SNR value above 6 dB indicates the signal is twice as strong as the noise. Noise is defined as High-Low range. The code is from the book "Rocket Science For Traders" by John Ehlers.
data | Data series. |
period | Lookback period, normally set to 7. |
Returns Dynamic SRSI.
Smoothed RSI (SRSI) was created by John Ehlers. Please note that Ehlers version of RSI is not calculated exactly the same way as the original RSI.
data | Data series. |
period | Dynamic lookback period. |
max_period | Maximum lookback period. |
sref< double > tsa::SRSI | ( | sref< double > | data, |
size_t | period, | ||
size_t | max_period | ||
) |
Returns Static SRSI.
Smoothed RSI (SRSI) was created by John Ehlers. Please note that Ehlers version of RSI is not calculated exactly the same way as the original RSI.
data | Data series. |
period | Static lookback period. |
max_period | Maximum lookback period. |
series_tuple< double > tsa::STOCH | ( | sref< double > | highs, |
sref< double > | lows, | ||
sref< double > | closes, | ||
size_t | period, | ||
size_t | k_smooth_period = 3 , |
||
size_t | d_smooth_period = 3 |
||
) |
Returns the 'smoothed' Stochastic K and D where K is a smoothed version of the Stochastic-Oscillator (STOCH_OSC()) and D is a smoothed version on K.
Note that the function returns a tuple of 2 series named 'K', 'D' respectively. In order to access each individual series use operator() as in:
.
highs | The highs. |
lows | The lows. |
closes | The closes. |
period | The period. |
k_smooth_period | The K smooth period. |
d_smooth_period | The D smooth period. |
sref< double > tsa::STOCH_OSC | ( | sref< double > | highs, |
sref< double > | lows, | ||
sref< double > | closes, | ||
size_t | period | ||
) |
Returns the Stochastic Oscillator (raw Stochastic) as developed by George C. Lane. It measures the current price in relation to the given period's price range.
highs | The highs. |
lows | The lows. |
closes | The closes. |
period | The period. |
sref< double > tsa::STOCHASTIC_MOD | ( | sref< double > | data, |
sref< size_t > | period, | ||
size_t | max_period | ||
) |
Returns Dynamic Modified Stochastic.
Modified Stochastic was created by John Ehlers. The code is from the book "Cycle Analytics for Traders" by John Ehlers.
data | Data series |
period | Dynamic lookback period. |
max_period | Maximum lookback period. |
sref< double > tsa::STOCHASTIC_MOD | ( | sref< double > | data, |
size_t | period, | ||
size_t | max_period | ||
) |
Returns Static Modified Stochastic.
Modified Stochastic was created by John Ehlers. The code is from the book "Cycle Analytics for Traders" by John Ehlers.
data | Data series |
period | Static lookback period, normally set to 20. |
max_period | Maximum lookback period. |
sref< double > tsa::SUPERSMOOTHERMA | ( | sref< double > | data, |
sref< size_t > | period, | ||
size_t | max_period | ||
) |
Returns Dynamic Supersmoother MA.
Supersmoother MA was created by John Ehlers. The code is from the book "Cycle Analytics for Traders" by John Ehlers.
data | Data series |
period | Dynamic lookback period. |
max_period | Maximum lookback period. |
sref< double > tsa::SUPERSMOOTHERMA | ( | sref< double > | data, |
size_t | period, | ||
size_t | max_period | ||
) |
Returns Static Supersmoother MA.
Supersmoother MA was created by John Ehlers. The code is from the book "Cycle Analytics for Traders" by John Ehlers.
data | Data series |
period | Static lookback period. |
max_period | Maximum lookback period. |
sref< double > tsa::SUPERSMOOTHERMA_3P | ( | sref< double > | data, |
sref< size_t > | period, | ||
size_t | max_period | ||
) |
Returns Dynamic Supersmoother MA, 3 poles.
Supersmoother MA was created by John Ehlers. The code is from the book "Cycle Analytics for Traders" by John Ehlers.
data | Data series |
period | Dynamic lookback period. |
max_period | Maximum lookback period. |
sref< double > tsa::SUPERSMOOTHERMA_3P | ( | sref< double > | data, |
size_t | period, | ||
size_t | max_period | ||
) |
Returns Static Supersmoother MA, 3 poles.
Supersmoother MA was created by John Ehlers. The code is from the book "Cycle Analytics for Traders" by John Ehlers.
data | Data series |
period | Static lookback period. |
max_period | Maximum lookback period. |
Alias for TYPICAL_PRICE().
highs | The highs. |
lows | The lows. |
closes | The closes. |
series_tuple< double > tsa::TRIX | ( | sref< double > | closes, |
size_t | smooth_1_period = 15 , |
||
size_t | smooth_2_period = 15 , |
||
size_t | smooth_3_period = 15 , |
||
size_t | signal_period = 9 |
||
) |
TRIX. Represents the percent-rate-of-change of a triple exponentially smoothed average. Developed by Jack Hutson.
closes | The closes. |
smooth_1_period | The smooth 1 period. |
smooth_2_period | The smooth 2 period. |
smooth_3_period | The smooth 3 period. |
signal_period | The signal period. |
Returns the 'true range'.
Calculated as: a = hi[0] - lo[0]; b = hi[0] - cl[1]; c = cl[1] - lo[0]; true_range = max( max(a, b), c);
highs | The highs. |
lows | The lows. |
closes | The closes. |
sref< double > tsa::TSI | ( | sref< double > | series, |
size_t | smooth_1_period = 25 , |
||
size_t | smooth_2_period = 13 |
||
) |
'True Strenght Indicator'. A momentum oscillator developed by William Blau.
series | The series |
smooth_1_period | The first period smooth. |
smooth_2_period | The second period smooth. |
sref< double > tsa::TWIGGS_MF | ( | sref< double > | highs, |
sref< double > | lows, | ||
sref< double > | closes, | ||
sref< double > | vol, | ||
size_t | period = 14 |
||
) |
Twiggs Money Flow.
highs | The highs. |
lows | The lows. |
closes | The closes. |
vol | The volume. |
period | The period. |
sref< double > tsa::TYPICAL_PRICE | ( | sref< double > | highs, |
sref< double > | lows, | ||
sref< double > | closes | ||
) |
Returns the 'typical price'. ((hi + lo + cl) / 3.0).
highs | The highs. |
lows | The lows. |
closes | The closes. |
sref< double > tsa::ULCER_INDEX | ( | sref< double > | closes, |
size_t | period = 14 |
||
) |
Ulcer Index.
closes | The closes. |
period | The period. |
sref< double > tsa::ULTIMATE_OSC | ( | sref< double > | highs, |
sref< double > | lows, | ||
sref< double > | closes, | ||
size_t | short_period = 7 , |
||
size_t | medium_period = 14 , |
||
size_t | long_period = 28 |
||
) |
'Ultimate Oscillator'. Developed by Larry Williams.It is a momentum indicators designed to capture the momentum across multiple timeframes.
highs | The highs. |
lows | The lows. |
closes | The closes. |
short_period | The short period. |
medium_period | The medium period. |
long_period | The long period. |
sref< double > tsa::VOLATILITY | ( | sref< double > | data, |
size_t | period, | ||
size_t | num_intervals_in_year | ||
) |
Returns the annualized volatility over the given period.
A return value of 0.15 corresponds to an annualized volatility of 15%.
data | The data. |
period | The period. |
num_intervals_in_year | Number of intervals in years. |
sref< double > tsa::VOLATILITY_ALT | ( | sref< double > | data, |
size_t | period | ||
) |
Alternative Volatility calculated as: STDEVP(close, period) / AVERAGE(close, period);.
data | The data. |
period | The period. |
sref< double > tsa::WILLIAMS_R | ( | sref< double > | highs, |
sref< double > | lows, | ||
sref< double > | closes, | ||
size_t | period = 14 |
||
) |
Returns the 'Williams R' indicator as developed by Larry Williams. It represents the inverse of the stochastic indicator STOCH().
highs | The highs. |
lows | The lows. |
closes | The closes. |
period | The period. |