A large 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, Hilbert transforms, Ehlers indicators. Aside from indicators, advanced functions for analyzing price series available: Polynomial regression for anticipating a part of a price curve; spectral analysis for removing noise and detecting cycles; a pattern detector for finding price curve patterns; perceptron and decisions trees for generating trade rules from raw price data; and an interface to R for using machine learning functions and special financial math libraries.

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

If an indicator is missing, add it. Most indicators require only a few lines of code. The file **indicators.c** contains the source codes of almost all nonstandard indicators, so you can use it as learning material for adding new 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, often directly derived from the price functions price(), priceClose() etc.. Alternatively a user created series or any other double float array with the given minimum length can be used. If not mentioned otherwise, the minimum length of the Data series is TimePeriod. Some functions require a second data array Data2. |

Open, High,Low, Close |
Price data series 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**include\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