A library of functions for filtering and retrieving information of price curves, from traditional technical analysis up to more advanced transformation and statistics function: moving averages, oscillators, bands, momentum, strength indices, linear regression, signal processing, and exotic indicators. The functions are divided in several sections:

**Technical**- the most common financial market indicators, some modern, some traditional, listed below in alphabetical order.- Candle Patterns - library of fixed candle patterns used by Japanese rice market traders in the 18th century (if you're on the esoteric side).
- Statistics Functions - functions for transforming data series and retrieving statistical and other properties.
- Spectral Analysis - functions for analyzing or filtering data series by their spectral components.
- Normalization - functions for scaling and compressing data series, often needed for machine learning signals.

Aside from the indicators and data series functions, price curves and portfolio performance can also be analyzed with other methods:

- Trade Statistics and System Statistics
- Pattern Detection (finding special wave forms)
- Prediction (anticipating the crossing of indicators)
- Seasonal Strength
- Currency Strength
- Pivot Points
- Special Bars (Renko, Range, Point-and-Figure etc.)
- Polynomial Regression (adapting a polynomial to the price curve)
- Fuzzy Logic
- Markowitz (mean/variance optimization)
- Machine Learning (neural networks, decision trees and various data mining methods)
- Cold Blood Index (verifying the validity of a live trading system)

The indicators below are listed in alphabetical order. Traditional indicators are mostly based on the TA-Lib indicator library by Mario Fortier (**www.ta-lib.org**) that has established as a standard. The usage, algorithms, and source codes of TA-Lib indicators can be found online at www.tadoc.org; the source codes are also included in the **Zorro/Source** folder. The source code of most other indicators and analysis functions can be found in
**indicators.c**.

If you need an indicator that is is missing, simply add it. Most technical indicators are primitive and can be implemented in a few minutes with a few lines of code. The file **indicators.c** contains the source codes of many nonstandard indicators, so you can use it as learning material for adding more complex indicators.

Another line belonging to the Ichimoku, the

rMACDSignal = EMA(rMACD,SignalPeriod);

rMACDHist = rMACD - rMACDSignal;

Results in

FastK_Period

FastK_Period

FastD_Period

FastD_MAType

FastK_Period

FastD_Period

FastD_MAType

TimePeriod |
The number of bars for the time period of the function, if any; or 0 for using a default period. |

MAType |
The type of the moving average used by the function: MAType_SMA (default), MAType_EMA, MAType_WMA, MAType_DEMA, MAType_TEMA, MAType_TRIMA, MAType_KAMA, MAType_MAMA, MAType_T3. |

Data |
A data series in descending order (newest data first), f.i. derived from the price functions price(), priceClose() etc.. Alternatively a user created series or any other double float array with the given minimum length. If not mentioned otherwise, the minimum length of the Data series is TimePeriod. Some functions require a second data series Data2. |

Open, High,Low, Close |
Price data series in descending order can be explicitly given for some indicators, for using price series generated from a different asset or with a different TimeFrame. Otherwise the prices of the current asset with a time frame equivalent to the bar period are used. |

- The
**TA-Lib**function prototypes are defined in**include\ta.h**. Information about the usage and the indicator algorithms can be found online at www.tadoc.org. The C++ source code of all included TA-Lib indicators is contained in**Source\ta_lib.zip**and can be studied for examining the algorithms. Some TA-Lib indicators that originally didn't work properly - such as Correlation or SAR - have been replaced by working versions. The lite-C source code of most additional indicators that are not part the the TA-Lib is contained in**Source\indicators.c**. - All TA functions are applied on series and do normally not accept other data arrays. In the INITRUN, all TA functions return
**0**, and LookBack is automatically increased to the largest required lookback time by a TA function. - Recursive TA functions - f.i.
**EMA**or**ATR**- need a higher lookback period than their**TimePeriod**parameter (see UnstablePeriod). LookBack can be exceeded when TA functions are later called with a series offset or a different**TimePeriod**; this will generate an Error 046 message. Make sure that LookBack is always higher than the maximum**TimePeriod**plus the**UnstablePeriod**plus the highest possible offset of all used series. - Some functions return more than one value, f.i.
**MACD**. The returned results are stored in global variables beginning with "**r**"; they can be accessed after the function is called. - Some functions only require a single
**Data**value. Rather than creating a**Data**series of length**1**, simply a pointer to the**Data**value can be used. Example:**var Raw = MyIndicator(); var Transformed = AGC(&Raw,0);**. - TimeFrame affects subsequent data series and thus also affects all indicators that use the data series as input. The
**TimePeriod**is then not in Bar units, but in time frame units.**TimeFrame**has no effect on indicators that do not use data series. - Indicators that rely on the standard deviation (f.i. Bollinger Bands) become inaccurate when the standard deviation is below 0.0001, as it is then assumed to be zero by the TA-Lib. This can happen on very short bar periods when the price does (almost) not move.
- For writing your own indicators, have a look at the examples inside
**indicators.c**. But please do not modify**indicators.c**- write the indicators in your own script, or in a dedicated script that you can then include in your strategies. If you need a complex indicator that you can not be easily add, please ask for it on the Zorro user forum.

// plot some indicatorsfunction run() { set(PLOTNOW);var* Price = series(price());

// plot Bollinger bandsBBands(Price,30,2,2,MAType_SMA);

plot("Bollinger1",rRealUpperBand,BAND1,0x00CC00);

plot("Bollinger2",rRealLowerBand,BAND2,0xCC00FF00);

plot("SAR",SAR(0.02,0.02,0.2),DOT,RED);

ZigZag(Price,20*PIP,5,BLUE);

// plot some other indicators

plot("ATR (PIP)",ATR(20)/PIP,NEW,RED);

plot("Doji",CDLDoji(),NEW+BARS,BLUE);

plot("FractalDim",FractalDimension(Price,30),NEW,RED);

plot("ShannonGain",ShannonGain(Price,40),NEW,RED);

}

// compare the impulse responses of some low-lag MAsfunction run() { set(PLOTNOW); BarPeriod = 60; MaxBars = 500; LookBack = 150; asset("");// dummy assetColorUp = ColorDn = 0;// don't plot a price curve

PlotWidth = 800; PlotHeight1 = 400; vars Impulse = series(1-genSquare(400,400)); int Period = 50; plot("Impulse",Impulse[0],0,GREY); plot("SMA",SMA(Impulse,Period),0,BLACK); plot("EMA",EMA(Impulse,Period),0,0x800080); plot("ALMA",ALMA(Impulse,Period),0,0x008000);// best representation of the impulseplot("Hull MA",HMA(Impulse,Period),0,0x00FF00); plot("Zero-Lag MA",ZMA(Impulse,Period),0,0x00FFFF);// fastest MA with no overshootplot("Decycle",Decycle(Impulse,Period),0,0xFF00FF);// fastest MA with some overshootplot("LowPass",LowPass(Impulse,Period),0,0xFF0000); plot("Smooth",Smooth(Impulse,Period),0,0x0000FF); }

► latest version online