Zorro algo trading functions by category

Time series analyis

Open Source
AC Accelerator Oscillator
ADO Accumulation/Distribution Oscillator
AGC Automatic gain control
ADX Average Directional Movement Index
ADXR Average Directional Movement Rating
Alligator Alligator 3-line indicator
ALMA Arnaud Legoux Moving Average
Amplitude Amplitude of series
AO Awesome Oscillator
APO Absolute Price Oscillator
Aroon Aroon Indicator
AroonOsc Aroon Oscillator
ATR Average True Range, original
ATRS Average True Range, simple MA
AvgPrice Average Price
BandPass Bandpass filter  
BBands Bollinger Bands
BBOsc Bollinger Bands oscillator
Beta Beta value
BOP Balance Of Power
Butterworth Butterworth filter
CBI Cold Blood Index  
CCI Commodity Channel Index
CCYI Correlation Cycle Indicator
CCYIR Correlation Cycle Indicator rate of change
CCYIState Correlation Cycle Market State
ccyMax Strongest Forex pair
ccyMin Weakest Forex pair
ccyReset Initialize currency strength
ccySet Define currency strength
ccyStrength Get currency strength
CDL... 60 traditional candle patterns
CGOsc Center Of Gravity oscillator
ChandelierLong Chandelier exit long
ChandelierShort Chandelier exit short
Chikou Ichimoku Chikou line
CI Choppiness Index
CMO Chande Momentum Oscillator
concave Curve concavity  
ConnorsRSI Connors RSI indicator
Coral Coral indicator
Correlation Pearson correlation coefficient
COT Commitment Of Traders report
COT_CommercialPos COT commercials net position
COT_CommercialIndex COT index
COT_OpenInterest COT open interest
Covariance Covariance coefficient
crossOver Curve cross over  
crossOverF Fuzzy cross over  
crossUnder Curve cross under  
crossUnderF Fuzzy cross under  
CTI Correlation Trend Indicator
dayClose Day close
dayHigh Day high
dayLow Day low
dayOpen Day open
dayPivot Day pivot
DChannel Donchian Channel
DCOsc Donchian Channel Oscillator
Decycle Ehlers' Decycler
DEMA Double Exponential Moving Average
Divergence Pricve / Oscillator peak line divergence
DominantPeriod Fundamental price oscillation  
DominantPhase Fundamental price phase  
DPO Detrended Price Oscillator
DX Directional Movement Index
EMA Exponential Moving Average
ER Efficiency Ratio
FIR3 Finite Impulse Response filter, 3 taps  
FIR4 Finite Impulse Response filter, 4 taps  
FIR6 Finite Impulse Response filter, 6 taps  
falling Curve falling  
fallingF Curve falling, fuzzy  
findIdx Find element  
Fisher Fisher transform
FisherInv Inverse Fisher transform
FisherN Fisher transform with normalization
FractalDimension Fractal Dimension
FractalHigh High Fractal indicator
FractalLow Low Fractal indicator
frechet Frechet pattern detection  
Gauss Gauss filter  
HAClose Haiken Ashi Close
HAHigh Haiken Ashi High
HALow Haiken Ashi Low
HAOpen Haiken Ashi Open
HH Highest High
HMA Hull Moving Average
HighPass Wide highpass filter  
HighPass1 1-pole highpass filter  
HighPass2 2-pole highpass filter
HTDcPeriod Hilbert transform cycle period
HTDcPhase Hilbert transform cycle phase
HTPhasor Hilbert transform phasor components
HTSine Hilbert transform sine wave
HTTrendline Hilbert transform instantaneous trendline
HTTrendMode Hilbert transform trend indicator
Hurst Hurst exponent
IBS Internal Bar Strength
Ichimoku Ichimoku indicator
KAMA Kaufman Adaptive Moving Average
KAMA2 KAMA with individual settings
Keltner Keltner channel
Laguerre Laguerre lowpass filter
line Line position at a given bar
LinearReg Linear regression
LinearRegAngle Linear regression angle
LinearRegIntercept Linear regression intercept
LinearRegSlope Linear regression slope
LL Lowest Low
LowPass Lowpass filter  
LSMA Least Squares Moving Average
MACD Moving Average Convergence/Divergence
MACDExt MACD with various MA types
MACDFix MACD with standard parameters
MAMA MESA Adaptive Moving Average
MovingAverage Moving Average with given type
Moving Average with variable period
MatchIndex Index of best match
MaxVal Highest value
MaxIndex Index of highest value
Median Median filter  
MedPrice Center price of candle
MidPoint Center value of period
MidPrice Center price of period
MinVal Lowest value
MinIndex Index of lowest value
MinMax Lowest and highest values
MinMaxIndex Indexes of lowest and highest values
MMI Market Meanness Index
MinusDI Minus Directional Indicator
MinusDM Minus Directional Movement
Mode Most frequent value
Mom Momentum
Moment Mean, variance, skew, kurtosis
MovingAverage Moving Average with various MA types
NATR Normalized Average True Range
Normalize Normalize to -1 .. +1
NumInRange Count ranges in interval
NumDn Count of falling elements
NumRiseFall Length of streak
NumUp Count of rising elements
NumWhiteBlack Difference of white and black candles
OBV On Balance Volume
peak Curve peak  
peakF Curve peak, fuzzy  
Percentile Percentile  
PercentRank Percent rank  
Pivot Pivot point
PlusDI Plus Directional Indicator
PlusDM Plus Directional Movement
polyfit Polynomial regression  
polynom Regression polynomial  
PPO Percentage Price Oscillator
predict Curve peak / crossover prediction  
predictMove Predict price move by statistics
predictSeason Predict price move by seasonal analysis
ProfitFactor Ratio of positive to negative returns
QLSMA Quadratic Least Squares Moving Average
R2 Determination coefficient  
Resistance Resistance line
RET Rate of change between two points
rising Curve rising  
risingF Curve rising, fuzzy  
ROC Rate of change
ROCP Rate of change percentage
ROCR Rate of change ratio
ROCL Logarithmic return
ROCR100 Rate of change ratio, 100 scale
Roof Ehlers' roofing filter
RSI Relative Strength Index, original
RSIS Relative Strength Index, simple MA
RVI Ehlers' Relative Vigor Index
SAR Parabolic SAR
SemiMoment Mean, downside variance, skew, kurtosis
SentimentLW Williams' Market Sentiment
SentimentG Genesis Sentiment Index
ShannonEntropy Randomness metric
ShannonGain Expected gain rate
Sharpe Sharpe ratio
SIROC Smoothed Rate of Change
slope Line through minima or maxima
SMA Simple Moving Average
SMAP Average of positive values
SMom Smoothed Momentum
Smooth Ehlers' super-smoother
Sortino Sortino ratio
Spearman Spearman's rank correlation coefficient
Spectrum Spectral analysis  
StdDev Standard deviation
Stoch Stochastic oscillator
StochEhlers Ehlers' predictive stochastic
StochF Stochastic Fast
StochRSI Stochastic RSI
Sum Sum of elements
SumDn Sum of falling elements
SumUp Sum of rising elements
Support Support line
T3 Triple smoothed MA
touch Curve touches another  
Trima Triangular Moving Average
Trix TEMA rate of change
TrueRange True range
TSF Time Series Forecast
TSI Trend Strength Index  
TypPrice Typical price
UltOsc Ultimate Oscillator
UO Universal Oscillator
Variance Variance
valley Curve valley  
valleyF Curve valley, fuzzy  
Volatility Annualized volatility
VolatilityC Chaikin Volatility indicator
VolatilityMM Min/Max volatility
VolatilityOV Empirical volatility
WCLPrice Weighted Close Price
WillR Williams' Percent Range
WMA Weighted Moving Average
yield Riskfree interest rate
ZigZag ZigZag indicator
ZMA Zero-lag Moving Average

Markets & trading

adviseLong/Short Machine learning indicator  
algo Select algorithm  
asset Select asset  
assetAdd Add asset to list  
assetHistory Download price history  
assetList Select asset list  
assetSource Set up online data source  
assetType Type of asset  
assign Convert portfolio weights  
brokerAccount Retrieve account status  
brokerAsset Download asset parameters  
brokerCommand Send special command to broker
brokerRequest Send a REST API request to broker  
brokerTrades Download list of open positons  
cancelTrade Undo trade  
combo Combine options to a combo
comboAdd Add option to a combo  
comboContract Return contract of a combo leg
comboLeg Select a combo leg  
comboLegs Return number of combo legs  
comboMargin Calculate the margin cost of a combo
comboStrike Return strike of given combo leg
comboPremium Calculate combo premium
comboProfit Calculate combo profit
comboRisk Calculate maximum possible loss
comboType Detect type of a combo
contract Select option/future contract  
contractCheck Check for termination  
contractCPD Price probability analysis  
contractDays Contract duration  
contractDelta Delta value from strike
contractExercise Exercise option  
contractFind Find contract by parameter  
contractIntrinsic Intrinsic value
contractMargin Calculate contract margin
contractNext Next contract in chain  
contractPosition Get current position size  
contractPrice Get current value  
contractProfit Get current profit/loss  
contractRecord Save contract chain to history
contractRoll Roll expired contract forward
contractSellUnderlying Sell assigned stock from exercised contracts
contractStrike Strike value from Delta
contractUnderlying Unadjusted underlying price
contractUpdate Load contract chain  
contractVal Calculate option value
contractVol Calculate implied volatiltiy
cpd Predicted price probability  
cpdv Price at given probability  
dataDownload Market data from online source  
dataFromCSV Market data from CSV file  
dataFromQuandl Market reports from Quandl™
distribute Calculate portfolio weights  
enterLong/Short Open position  
enterTrade Add position from template  
exitLong/Short Close one or several positions  
exitTrade Close selected position  
for(trades...) Enumerate trades, assets, algos  
frame Timeframe state  
frameSync Timeframe synchronization  
knapsack Optimize asset amounts  
loadStatus Load system status  
login Connect to broker  
loop Loop through assets/algos  
marketVal Bar value (spread)  
marketVol Bar value (volume)  
markowitz Mean-variance optimization  
markowitzReturn Max return for given variance  
markowitzVariance Min variance for given return  
optimize Optimal parameter value  
orderCVD Order flow analysis  
orderUpdate Read order book  
price Mean price at bar  
priceClose Close at bar  
priceHigh High at bar  
priceLow Low at bar  
priceOpen Open at bar  
priceQuote Enter current price  
priceRecord Save price to history  
priceSet Modify price at bar  
results Statistics of trade results  
saveStatus Save system status  
seriesO/H/L/C Price series  
suspended Trading permission  
tradeUpdate Resize or update trade parameters  
tradeUpdatePool Synchronize virtual and pool trades  

Math & misc

abs Magnitude  
aboveF Fuzzy >=  
andF Fuzzy && (and)  
asin Arc sine  
acos Arc cosine  
atan Arc tangent  
atan2 Arc tangent, high precision  
belowF Fuzzy <=  
between Range check  
betweenF Fuzzy range check  
cdf Gaussian cumulative distribution  
ceil Round up  
center Center about median  
changed Change of value
clamp Limits  
compress Scale to +/-100  
cos Cosine  
cosh Hyperbolic cosine
cum Accumulation function
diff Change since last bar  
dnorm Gaussian probability  
equalF Fuzzy ==  
erf Statistical error function  
exp Exponential  
filter 1D covolution filter  
fix0 Safe division
floor Round down  
fmod Fractional modulo  
fuzzy Defuzzyfication  
genNoise Random noise
genSine Sine wave chirp
genSquare Square wave chirp
hmac Cryptographic hash  
ifelse Conditional assignment  
invalid Invalid value  
log Logarithm  
max Maximum  
min Minimum  
modf Fractional part  
normalize Normalize to +/-100  
notF Fuzzy ! (not)  
once First occurrence  
orF Fuzzy || (or)  
pow Nth power, Nth root  
qnorm Gaussian distribution value  
random Random number generator  
ref Value at bar
renorm Multiply and normalize  
round Round to next integer  
roundto Round to next step  
scale Center and scale to +/-100  
seed Random number initialization  
sign Sign  
sin Sine  
sinh Hyperbolic sine  
sqrt Square root  
tan Tangent  
tanh Hyperbolic tangent  
valuewhen Conditional array access
zscore Z-Score  

Time / date

at Event at time of day
barssince Bars since condition became true
day Day of month  
dmy YYYYMMDD to OLE time/date
dom Days in month  
dow Day of week  
dst Daylight saving time  
hour UTC hour  
ldow Day of week at time zone  
lhour Hour at time zone  
ltod HHMM at time zone  
market Market open time  
minute Minute  
minutesAgo Bar distance in minutes  
minutesWithin Bar length in minutes
month Month at given bar  
mtu OLE time/date from Unix time  
ndow N-th weekday of month  
nthDay Date of n-th weekday of month
second Second with microseconds  
tdm Trading day of month  
timeOffset Bar at given time  
tom Trading days in month  
tod HHMM time of day  
tow DHHMM time of week  
ltow DHHMM at time zone  
utm Unix time  
wdate OLE time/date  
wdateBar OLE time/date at bar  
wdatef OLE time/date from string  
week Week number  
workday Workday or holiday  
year Year at given bar  
ymd OLE time/date to YYYYMMDD

Data structures

atof String to var  
atoi String to int  
conv Convert array or time series  
dataAppend Extend dataset  
dataAppendRow Extend dataset by row  
dataChart Plot dataset content  
dataClip Remove records  
dataCol Extract data column  
dataCompress Remove duplicates  
dataFind Find date/time in dataset  
dataLoad Load dataset  
dataInt Get integer from field  
dataMerge Merge two datasets  
dataNew Create dataset  
dataParse Create dataset from CSV  
dataParseJSON Create OHLC dataset from JSON  
dataSave Save dataset  
dataSaveCSV Save dataset to CSV  
dataSet Set dataset field  
dataSize Get dataset format  
dataSort Sort dataset by date  
dataStr Get string from field  
dataVar Get variable from field  
filter Convolution filter  
matrix Matrix / vector creation  
me Matrix element  
matAdd Matrix addition  
matMul Matrix multiplication  
matScale Matrix scaling  
matSet Matrix copy  
matSub Matrix subtraction  
matTrans Matrix transpose  
randomize Shuffle array or time series  
renorm Normalize array  
ref Reference past value  
rev Reverse array or time series  
series Create time series  
sftoa Convert number to string  
shift Shift array or time series  
sortData Sort array  
sortIdx Create sort index  
sortRank Create ranking list  
strcat Append string  
strcmp Compare strings  
strcpy Copy string  
strlen String length  
strstr Find substring  
strchr Find character  
strrchr Find character from end  
strtok Tokenize string  
strvar Variable from ini string  
strtext Text from ini string  
strdate Time/date to string  
strf Variables to string  
strx Replace substrings  
strxc Replace characters  
strmid Strip string  
strcount Count characters  
strw Wide string  
stridx String to index  
strxid Index to string  
strtr Trade ID string  
strcon Contract ID string  
sprintf Print into string  
sscanf Parse string  
ve Vector element  

Input / output

color Define color range  
colorScale Brighten / darken color  
dataParse Create dataset from CSV  
dataParseJSON Create OHLC dataset from JSON  
email Send email  
file_append Append data to end of file  
file_appendfront Append data to begin of file  
file_content Read content of file  
file_copy Copy file  
file_date File date  
file_delete Delete file  
file_length File size  
file_next Read directory  
file_read Read file to string  
file_select Open file dialog box  
file_write Write string to file  
ftp_download Download file from FTP server  
ftp_upload Upload file to FTP server  
ftp_getdate Get file date and size from FTP server  
ftp_stop Stop the current FTP transfer  
ftp_size Size of the received file  
ftp_sent Size of the sent file  
ftp_timestamp Get file timestamp  
ftp_status FTP transfer status  
ftp_log Enables FTP logging  
getvar Get system-wide variable  
http_transfer Load data from website  
http_request Send HTTP request  
http_post Start HTTP POST transfer  
http_proxy Define a proxy server  
http_status HTTP transfer status  
http_result Retrieve received file  
http_free Stop current HTTP transfer  
keys Send keystrokes to window  
mouse Mouse position  
msg Message box  
panel Create user panel from spreadsheet  
panelFix Determine panel scroll area  
panelGet Get data from user panel  
panelLoad Load panel state  
panelMerge Merge cells on panel  
panelSave Save panel state  
panelSet Update user panel or action scrollbox  
plot Plot curve  
plotBar Plot histogram bar  
plotBuyHold Plot a buy-and-hold benchmark
plotChart Update histogram  
plotContract Plot option payoff diagram
plotCorrelogram Plot autocorrelation histogram
plotData Get plot data for export  
plotDay Daily seasonal analysis
plotDayProfit Daily profit histogram
plotGraph Plot symbol  
plotHeatmap Plot heatmap matrix
plotHistogram Plot a general histogram
plotMAEGraph Max adverse excursions histogram
plotMAEPercentGraph Max adverse excursions in percent
plotMFEGraph Max favorable excursion histogram
plotMFEPercentGraph Max favorable excursions in percent
plotMonth Monthly seasonal analysis
plotMonthProfit Monthly profit histogram
plotPriceProfile Price difference histogram
plotQuarterProfit Quarterly profit histogram
plotTradeProfile Profit distribution histogram
plotWeek Weekly seasonal analysis
plotWeekProfit Weekly profit histogram
plotWFOCycle WFO cycle analysis
plotWFOProfit Per-cycle profit histogram
plotYear Annual seasonal analysis
printf Print message  
print Print to target  
progress Progress bar  
putvar Set system-wide variable  
pyInt Integer from Python variable  
pySet Send variables to Python  
pyStart Start Python session  
pyVar Double float from Python variable  
pyVec Array from Python variable  
pyX Execute Python code  
Rd Double float from R expression  
Ri Integer from R expression  
Rrun R status  
Rset Send variables to R  
Rstart Start R session  
Rv Array from R expression  
Rx Execute R expression  
report Generate performance report  
slider Slider input  
sound Play WAV file  
window Find active window  


call Run function at event  
exec Run external program  
free Free memory area  
GetProcAddress Get DLL function  
ignore Suppress error message  
ifelse Conditional assignment  
is System flag state  
isf Flag state of a variable  
LoadLibrary Open DLL  
lock Protect code against interruption  
malloc Allocate memory area  
memcmp Compare memory  
memcpy Copy memory area  
memory Get memory allocation  
memset Fill memory area  
of Enumerate elements in a loop  
once First condition change  
quit Terminate simulation  
realloc Change memory area  
require Require software version  
resf Reset flag of a variable
set Set or reset system flag  
setf Set flag of a variable  
timer Performance timer  
unlock Unlock code  
version Software version  
wait Pause  
watch Debugging info  
Win32 API Windows API functions  
zalloc Allocate temporary memory space  
zInit Initialize multiprocess communication  
zClose Stop process  
zData Exchange process information  
zOpen Start process  
zStatus Get process status  

Optional user-supplied functions

bar Special bar definition (Renko, Kagi, etc)  
click Button click function  
callback Callback for broker API and messages  
cleanup Run once at the end  
error Run at any error  
evaluate Evaluate strategy results  
manage Trade micromanagement  
main Run once at the begin.  
neural External machine learning and prediction  
objective Parameter optimization target  
order Special order transmission  
parameters Parameter optimization setup  
run Run at any bar  
tick Run at any incoming price  
tock Run at fixed time intervals  




Zorro Home, Zorro Manual

► latest version online