The amStudies Library is a collection of functions
that extend the EFS language.
All the functions
included in the amStudies Library can be used with any other
function that accepts a series, eSignal built-in or otherwise.
§
eSignal
version 7.9.1 build 732 or later is required to use the amStudies
library.
§
Save
the amStudies.efsLib file in the FunctionLibrary folder of the eSignal
directory.
§ To include the amStudies library in a script use the addLibrary() call (see examples here).
CMO (Chande Momentum Oscillator)
DEMA (Double
Exponential Moving Average)
KAMA (Kaufmann Adaptive
Moving Average)
LSMA (Least Squares
Moving Average)
TEMA (Triple Exponential Moving Average)
Time Series Forecast (Metastock version)
VIDYA (Variable Index Dynamic Average)
VWAP Approximation (Volume Weighted Average Price)
VWAP2 Approximation (Volume Weighted Average Price)
* denotes new item
CMO (Chande Momentum Oscillator)
syntax |
amCMO( length [, source | sym() | inv()] [,
barIndex] ) |
|
length |
the period used for the calculation |
|
source |
optional, the source used for the calculation can be any eSignal or custom series |
default: close |
sym() |
optional. specify a symbol to use |
default: current symbol |
inv() |
optional. specify a bar interval to use |
default: current interval |
barIndex |
optional. bar index of value to retrieve |
default: current value |
See examples here
syntax |
amCT( length, barsBack [, source | sym() |
inv()] [, barIndex] ) |
|
length |
the period used for the calculation |
|
barsBack |
the number of bars back from which to begin
the calculation |
suggested: 10 |
source |
optional, the source used for the calculation can be any eSignal or custom series |
default: close |
sym() |
optional. specify a symbol to use |
default: current symbol |
inv() |
optional. specify a bar interval to use |
default: current interval |
barIndex |
optional. bar index of value to retrieve |
default: current value |
See
examples here
DEMA (Double Exponential Moving Average)
syntax |
amDEMA( length [, source | sym() | inv()] [,
barIndex] ) |
|
length |
the period used for the calculation |
|
source |
optional, the source used for the calculation can be any eSignal or custom series |
default: close |
sym() |
optional. specify a symbol to use |
default: current symbol |
inv() |
optional. specify a bar interval to use |
default: current interval |
barIndex |
optional. bar index of value to retrieve |
default: current value |
See examples here
KAMA (Kaufmann Adaptive Moving Average)
syntax |
amKAMA( length, fast, slow [, source | sym() |
inv()] [, barIndex] ) |
|
length |
the period used for the calculation |
|
fast |
the period used to calculate the fast
smoothing constant |
suggested: 2 |
slow |
the period used to calculate the slow
smoothing constant |
suggested: 30 |
source |
optional, the source used for the calculation can be any eSignal or custom series |
default: close |
sym() |
optional. specify a symbol to use |
default: current symbol |
inv() |
optional. specify a bar interval to use |
default: current interval |
barIndex |
optional. bar index of value to retrieve |
default: current value |
See
examples here
syntax |
amKST( period, type [, source | sym() | inv()]
[, barIndex] ) |
|
period (string) |
the period(s) used for the calculation this parameter must be one of the following: • a string containing the periods of each roc and ma study ORd together in the following sequence “roc1|ma1|roc2|ma2|roc3|ma3|roc4|ma4” e.g. amKST( “3|3|4|4|6|6|10|8”, false); • any one of the following strings “ShortD”, “ShortW”, “IntermediateW”,
“LongM”, “LongW”
e.g. amKST( “ShortW”, false); these call preset
period combinations based on Pring’s suggested settings (re: TAS&C Vol. 10:9 p. 365-369) |
|
type (boolean) |
type of moving average used false = simple; true = exponential |
|
source |
optional, the source used for the calculation can be any eSignal or custom series |
default: close |
sym() |
optional. specify a symbol to use |
default: current symbol |
inv() |
optional. specify a bar interval to use |
default: current interval |
barIndex |
optional. bar index of value to retrieve |
default: current value |
See examples here
LSMA (Least Squares Moving Average)
syntax |
amLSMA( length [, source | sym() | inv()] [,
barIndex] ) |
|
length |
the period used for the calculation |
|
source |
optional, the source used for the calculation can be any eSignal or custom series |
default: close |
sym() |
optional. specify a symbol to use |
default: current symbol |
inv() |
optional. specify a bar interval to use |
default: current interval |
barIndex |
optional. bar index of value to retrieve |
default: current value |
See
examples here
syntax |
amMMA( length [, source | sym() | inv()] [,
barIndex] ) |
|
length |
the period used for the calculation |
|
source |
optional, the source used for the calculation can be any eSignal or custom series |
default: close |
sym() |
optional. specify a symbol to use |
default: current symbol |
inv() |
optional. specify a bar interval to use |
default: current interval |
barIndex |
optional. bar index of value to retrieve |
default: current value |
See examples here
syntax |
amOsc( fast, slow, type [, source | sym() |
inv()] [, barIndex] ) |
|
fast |
the period used for the fast average |
|
slow |
the period used for the slow average |
|
type |
type of moving average used 0 = simple; 1 = exponential |
|
source |
optional, the source used for the calculation can be any eSignal or custom series |
default: close |
sym() |
optional. specify a symbol to use |
default: current symbol |
inv() |
optional. specify a bar interval to use |
default: current interval |
barIndex |
optional. bar index of value to retrieve |
default: current value |
See
examples here
syntax |
amSWMA( length [, source | sym() | inv()] [,
barIndex] ) |
|
length |
the period used for the calculation |
|
source |
optional, the source used for the calculation can be any eSignal or custom series |
default: close |
sym() |
optional. specify a symbol to use |
default: current symbol |
inv() |
optional. specify a bar interval to use |
default: current interval |
barIndex |
optional. bar index of value to retrieve |
default: current value |
See
examples here
syntax |
amSmooth( length [, source | sym() | inv()] [,
barIndex] ) |
|
length |
the period used for the calculation |
|
source |
optional, the source used for the calculation can be any eSignal or custom series |
default: close |
sym() |
optional. specify a symbol to use |
default: current symbol |
inv() |
optional. specify a bar interval to use |
default: current interval |
barIndex |
optional. bar index of value to retrieve |
default: current value |
See
examples here
syntax |
amT3( length, factor [, source | sym() | inv()]
[, barIndex] ) |
|
length |
the period used for the calculation |
|
factor |
the factor used for the calculation must be a value > 0 and <= 1 |
suggested: 0.7 |
source |
optional, the source used for the calculation can be any eSignal or custom series |
default: close |
sym() |
optional. specify a symbol to use |
default: current symbol |
inv() |
optional. specify a bar interval to use |
default: current interval |
barIndex |
optional. bar index of value to retrieve |
default: current value |
See
examples here
TEMA (Triple Exponential Moving Average)
syntax |
amTEMA( length [, source | sym() | inv()] [,
barIndex] ) |
|
length |
the period used for the calculation |
|
source |
optional, the source used for the calculation can be any eSignal or custom series |
default: close |
sym() |
optional. specify a symbol to use |
default: current symbol |
inv() |
optional. specify a bar interval to use |
default: current interval |
barIndex |
optional. bar index of value to retrieve |
default: current value |
See
examples here
syntax |
amTSF( length, forecast [, source | sym() |
inv()] [, barIndex] ) |
|
length |
the period used for
the calculation |
|
forecast |
the period used for the forecast |
|
source |
optional, the source used for the calculation can be any eSignal or custom series |
default: close |
sym() |
optional. specify a symbol to use |
default: current symbol |
inv() |
optional. specify a bar interval to use |
default: current interval |
barIndex |
optional. bar index of value to retrieve |
default: current value |
Time Series Forecast (Metastock version)
syntax |
amTSFX( length [, source | sym() | inv()] [,
barIndex] ) |
|
length |
the period used for
the calculation |
|
source |
optional, the source used for the calculation can be any eSignal or custom series |
default: close |
sym() |
optional. specify a symbol to use |
default: current symbol |
inv() |
optional. specify a bar interval to use |
default: current interval |
barIndex |
optional. bar index of value to retrieve |
default: current value |
syntax |
amTMA( length [, source | sym() | inv()] [,
barIndex] ) |
|
length |
the period used for the calculation |
|
source |
optional, the source used for the calculation can be any eSignal or custom series |
default: close |
sym() |
optional. specify a symbol to use |
default: current symbol |
inv() |
optional. specify a bar interval to use |
default: current interval |
barIndex |
optional. bar index of value to retrieve |
default: current value |
See
examples here
syntax |
amTRIX( length [, source | sym() | inv()] [,
barIndex] ) |
|
length |
the period used for the calculation |
|
source |
optional, the source used for the calculation can be any eSignal or custom series |
default: close |
sym() |
optional. specify a symbol to use |
default: current symbol |
inv() |
optional. specify a bar interval to use |
default: current interval |
barIndex |
optional. bar index of value to retrieve |
default: current value |
See
examples here
VIDYA (Variable Index Dynamic Average)
syntax |
amVIDYA( length, smooth [, source | sym() | inv()] [, barIndex] ) |
|
length |
the period used for the calculation |
|
smooth |
the period used to calculate the smoothing
constant |
|
source |
optional, the source used for the calculation can be any eSignal or custom series |
default: close |
sym() |
optional. specify a symbol to use |
default: current symbol |
inv() |
optional. specify a bar interval to use |
default: current interval |
barIndex |
optional. bar index of value to retrieve |
default: current value |
See
examples here
VWAP Approximation (Volume Weighted Average Price)
syntax |
amVWAP( [sym() | inv() ] [, barIndex] ) |
|
sym() |
optional. specify a symbol to use |
default: current symbol |
inv() |
optional. specify a bar interval to use (*) (*)
only minute-based intervals |
default: current interval |
barIndex |
optional. bar index of value to retrieve |
default: current value |
VWAP2 Approximation (Volume Weighted Average Price)
syntax |
amVWAP2(time [, sym() | inv() ] [, barIndex] ) |
|
time |
the starting time for the calculation Note: This parameter must be a string containing the starting
time in 24hr clock without the separator (e.g. 930, 1245, 1630) |
|
sym() |
optional. specify a symbol to use |
default: current symbol |
inv() |
optional. specify a bar interval to use (*) (*)
only minute-based intervals |
default: current interval |
barIndex |
optional. bar index of value to retrieve |
default: current value |
syntax |
amWilder( length [, source | sym() | inv()] [,
barIndex] ) |
|
length |
the period used for the calculation |
|
source |
optional, the source used for the calculation can be any eSignal or custom series |
default: close |
sym() |
optional. specify a symbol to use |
default: current symbol |
inv() |
optional. specify a bar interval to use |
default: current interval |
barIndex |
optional. bar index of value to retrieve |
default: current value |
See examples here
syntax |
amZlag( length [, source | sym() | inv()] [,
barIndex] ) |
|
length |
the period used for
the calculation |
|
source |
optional, the source used for the calculation can be any eSignal or custom series |
default: (high+low)/2 |
sym() |
optional. specify a symbol to use |
default: current symbol |
inv() |
optional. specify a bar interval to use |
default: current interval |
barIndex |
optional. bar index of value to retrieve |
default: current value |
To retrieve a single value:
Example 1:
function
preMain() {
setPriceStudy(true);
}
var
myLib = addLibrary("amStudies.efsLib");
var myStudy = null;
function
main() {
if (myStudy ==
null) myStudy = myLib.amLSMA(25);
var myVar =
myStudy.getValue(0);
return myVar;
}
To
create a series:
Example 2:
function preMain() {
setPriceStudy(true);
}
var myLib =
addLibrary("amStudies.efsLib");
var myStudy = null;
function main() {
if(myStudy == null) myStudy = myLib.amLSMA(25,hlc3());
return getSeries(myStudy);
}
Example 3 (study of a study):
function preMain() {
setPriceStudy(true);
}
var myLib =
addLibrary("amStudies.efsLib");
var myStudy = null;
var bInit = false;
function main() {
if (bInit == false) {
with (myLib) {
myStudy = amLSMA(25,sma(3,hl2()));
}
bInit = true;
}
return getSeries(myStudy);
}
DISCLAIMER: The amStudies Library is for
personal use only and is provided as-is with no warranties and/or guarantees.
Reproduction, duplication, or redistribution of the amStudies Library, in any
form, without prior written permission from the author, is strictly prohibited.
The author reserves the right to change at any time part or all of the
amStudies Library.