AFL Function Reference - Alphabetical list of functions
- #include ( Miscellaneous functions) -
preprocessor include command (AFL 2.2)
- #pragma ( Miscellaneous functions) -
sets AFL pre-processor option (AFL 2.4)
- abs ( Math functions) -
absolute value
- AccDist ( Indicators) -
accumulation/distribution
- AddColumn (Exploration /Indicator Builder) -
add numeric exploration column (AFL 1.8)
- AddTextColumn (Exploration /Indicator Builder) -
add text exploration column (AFL 1.8)
- AddToComposite ( Composites) -
add value to composite ticker (AFL 2.0)
- ADLine ( Composites) -
advance/decline line (AFL 1.2)
- AdvIssues ( Composites) -
advancing issues (AFL 1.2)
- AdvVolume ( Composites) -
advancing issues volume (AFL 1.2)
- ADX ( Indicators) -
average directional movement index (AFL 1.3)
- AlertIf ( Trading system toolbox) -
trigger alerts (AFL 2.1)
- AMA ( Moving averages, summation) -
adaptive moving average (AFL 1.5)
- AMA2 ( Moving averages, summation) -
adaptive moving average (AFL 1.5)
- ApplyStop ( Trading system toolbox) -
apply built-in stop (AFL 1.7)
- atan ( Math functions) -
arc tan
- ATR ( Indicators) -
average true range (AFL 1.3)
- BarIndex ( Date/Time) -
get zero-based bar number (AFL 2.3)
- BarsSince ( Trading system toolbox) -
bars since
- BBandBot ( Indicators) -
bottom bollinger band
- BBandTop ( Indicators) -
top bollinger band
- BeginValue ( Date/Time) -
Value of the array at the begin of the range (AFL 2.3)
- CategoryAddSymbol ( Information / Categories) -
adds a symbol to a category (AFL 2.5)
- CategoryGetName ( Information / Categories) -
get the name of a category (AFL 2.5)
- CategoryGetSymbols ( Information / Categories) -
retrieves comma-separated list of symbols belonging to given category (AFL 2.5)
- CategoryRemoveSymbol ( Information / Categories) -
remove a symbol from a category (AFL 2.5)
- CCI ( Indicators) -
commodity channel index
- CEIL ( Math functions) -
ceil value
- CHAIKIN ( Indicators) -
chaikin oscillator
- CORRELATION ( Statistical functions) -
correlation (AFL 1.4)
- COS ( Math functions) -
cosine
- CREATEOBJECT ( Miscellaneous functions) -
create COM object (AFL 1.8)
- CREATESTATICOBJECT ( Miscellaneous functions) -
create static COM object (AFL 1.8)
- CROSS ( Trading system toolbox) -
crossover check
- CUM ( Moving averages, summation) -
cumulative sum
- DATE ( Date/Time) -
date (AFL 1.1)
- DATENUM ( Date/Time) -
date number (AFL 1.4)
- DATETIME ( Date/Time) -
retrieves encoded date time (AFL 2.3)
- DAY ( Date/Time) -
day of month (AFL 1.4)
- DAYOFWEEK ( Date/Time) -
day of week (AFL 1.4)
- DAYOFYEAR ( Date/Time) -
get ordinal number of day in a year (AFL 2.4)
- DECISSUES ( Composites) -
declining issues (AFL 1.2)
- DECVOLUME ( Composites) -
declining issues volume (AFL 1.2)
- DEMA ( Moving averages, summation) -
double exponential moving average (AFL 2.0)
- EMA ( Moving averages, summation) -
exponential moving average
- EnableRotationalTrading ( Trading system toolbox) -
Turns on rotational-trading mode of the backtester (AFL 2.5)
- ENABLESCRIPT ( Miscellaneous functions) -
enable scripting engine
- ENABLETEXTOUTPUT ( Miscellaneous functions) -
enables/disables text output in the Chart Commentary window (AFL 2.2)
- ENCODECOLOR (Exploration /Indicator Builder) -
encodes color for indicator title (AFL 2.2)
- ENDVALUE ( Date/Time) -
value of the array at the begin of the selected range (AFL 2.3)
- EQUITY ( Trading system toolbox) -
calculate equity line (AFL 2.0)
- EXP ( Math functions) -
exponential function
- EXREM ( Trading system toolbox) -
remove excessive signals (AFL 1.5)
- EXREMSPAN ( Trading system toolbox) -
remove excessive signals spanning given number of bars (AFL 2.0)
- fclose (File Input/Output functions) -
close a file (AFL 2.5)
- feof (File Input/Output functions) -
test for end-of-file (AFL 2.5)
- fgets (File Input/Output functions) -
get a string from a file (AFL 2.5)
- FLIP ( Trading system toolbox) -
(AFL 1.5)
- FLOOR ( Math functions) -
floor value
- fopen (File Input/Output functions) -
open a file (AFL 2.5)
- FOREIGN (Referencing other symbol data) -
access foreign security data (AFL 1.5)
- fputs (File Input/Output functions) -
write a string to a file (AFL 2.5)
- FRAC ( Math functions) -
fractional part
- FullName ( Information / Categories) -
full name of the symbol (AFL 1.1)
- GAPDOWN ( Basic price pattern detection) -
gap down
- GAPUP ( Basic price pattern detection) -
gap up
- GETBASEINDEX (Referencing other symbol data) -
retrieves symbol of relative strength base index (AFL 2.1)
- GetCategorySymbols ( Information / Categories) -
retrieves comma-separated list of symbols belonging to given category (AFL 2.4)
- GETCHARTID (Exploration /Indicator Builder) -
get current chart ID (AFL 2.3)
- GetDatabaseName ( Information / Categories) -
retrieves folder name of current database (AFL 2.3)
- GETEXTRADATA ( Miscellaneous functions) -
get extra data from external data source (AFL 1.9)
- GETSCRIPTOBJECT ( Miscellaneous functions) -
get access to script COM object (AFL 1.8)
- GROUPID ( Information / Categories) -
get group ID/name (AFL 1.8)
- HHV ( Lowest/Highest) -
highest high value
- HHVBARS ( Lowest/Highest) -
bars since highest high
- HIGHEST ( Lowest/Highest) -
highest value
- HIGHESTBARS ( Lowest/Highest) -
bars since highest value
- HIGHESTSINCE ( Lowest/Highest) -
highest value since condition met (AFL 1.4)
- HIGHESTSINCEBARS ( Lowest/Highest) -
bars since highest value since condition met (AFL 1.4)
- HOLD ( Trading system toolbox) -
hold the alert signal
- HOUR ( Date/Time) -
get current bar's hour (AFL 2.0)
- IIF ( Trading system toolbox) -
immediate IF function
- INDUSTRYID ( Information / Categories) -
get industry ID / name (AFL 1.8)
- INSIDE ( Basic price pattern detection) -
inside day
- INT ( Math functions) -
integer part
- INTERVAL ( Date/Time) -
get bar interval (in seconds) (AFL 2.1)
- INWATCHLIST ( Information / Categories) -
watch list membership test
- ISEMPTY ( Miscellaneous functions) -
empty value check (AFL 1.5)
- IsFavorite ( Information / Categories) -
check if current symbol belongs to favorites (AFL 2.5)
- ISFINITE ( Miscellaneous functions) -
check if value is not infinite (AFL 2.3)
- IsIndex ( Information / Categories) -
check if current symbol is an index (AFL 2.5)
- ISNAN ( Miscellaneous functions) -
checks for NaN (not a number) (AFL 2.3)
- ISNULL ( Miscellaneous functions) -
check for Null (empty) value (AFL 2.3)
- ISTRUE ( Miscellaneous functions) -
true value (non-empty and non-zero) check (AFL 1.5)
- LASTVALUE ( Trading system toolbox) -
last value of the array
- LineArray (Exploration /Indicator Builder) -
generate trend-line array (AFL 2.5)
- LINEARREG ( Statistical functions) -
linear regression end-point (AFL 2.2)
- LINREGINTERCEPT ( Statistical functions) -
(AFL 2.2)
- LINREGSLOPE ( Statistical functions) -
linear regression slope (AFL 1.4)
- LLV ( Lowest/Highest) -
lowest low value
- LLVBARS ( Lowest/Highest) -
bars since lowest low
- LOG ( Math functions) -
natural logarithm
- LOG10 ( Math functions) -
decimal logarithm
- LOWEST ( Lowest/Highest) -
lowest value
- LOWESTBARS ( Lowest/Highest) -
bars since lowest
- LOWESTSINCE ( Lowest/Highest) -
lowest value since condition met (AFL 1.4)
- LOWESTSINCEBARS ( Lowest/Highest) -
barssince lowest value since condition met (AFL 1.4)
- MA ( Moving averages, summation) -
simple moving average
- MACD ( Indicators) -
moving average convergence/divergence
- MARKETID ( Information / Categories) -
market ID / name (AFL 1.8)
- MAX ( Math functions) -
maximum value of two numbers / arrays
- MDI ( Indicators) -
minus directional movement indicator (-DI) (AFL 1.3)
- Median ( Statistical functions) -
calculate median (middle element) (AFL 2.5)
- MFI ( Indicators) -
money flow index
- MIN ( Math functions) -
minimum value of two numbers / arrays
- MINUTE ( Date/Time) -
get current bar's minute (AFL 2.0)
- MONTH ( Date/Time) -
month (AFL 1.4)
- NAME ( Information / Categories) -
ticker symbol (AFL 1.1)
- NOW ( Date/Time) -
gets current system date/time (AFL 2.3)
- NumToStr ( String manipulation) -
convert number to string (AFL 2.5)
- NVI ( Indicators) -
negative volume index
- NZ ( Miscellaneous functions) -
Null (Null/Nan/Infinity) to zero (AFL 2.3)
- OBV ( Indicators) -
on balance volume
- OPTIMIZE ( Trading system toolbox) -
define optimization variable (AFL 1.7)
- OSCP ( Indicators) -
price oscillator
- OSCV ( Indicators) -
volume oscillator
- OUTSIDE ( Basic price pattern detection) -
outside bar
- PARAM (Exploration /Indicator Builder) -
add user user-definable numeric parameter (AFL 2.3)
- PARAMCOLOR (Exploration /Indicator Builder) -
add user user-definable color parameter (AFL 2.3)
- PARAMSTR (Exploration /Indicator Builder) -
add user user-definable string parameter (AFL 2.3)
- PDI ( Indicators) -
plus directional movement indicator (AFL 1.3)
- PEAK ( Basic price pattern detection) -
peak (AFL 1.1)
- PEAKBARS ( Basic price pattern detection) -
bars since peak (AFL 1.1)
- Percentile ( Statistical functions) -
calculate percentile (AFL 2.5)
- PLOT (Exploration /Indicator Builder) -
plot indicator graph (AFL 1.8)
- PLOTFOREIGN (Referencing other symbol data) -
plot foreign security data (AFL 2.2)
- PLOTGRID (Exploration /Indicator Builder) -
Plot horizontal grid line (AFL 2.3)
- PLOTOHLC (Exploration /Indicator Builder) -
plot custom OHLC chart (AFL 2.2)
- PLOTSHAPES (Exploration /Indicator Builder) -
plots arrows and other shapes (AFL 2.3)
- PLOTVAPOVERLAY (Exploration /Indicator Builder) -
plot Volume-At-Price overlay chart (AFL 2.4)
- PREC ( Math functions) -
adjust number of decimal points of floating point number
- PREFS ( Miscellaneous functions) -
retrieve preferences settings (AFL 1.4)
- printf ( String manipulation) -
Print formatted output to the output window. (AFL 2.5)
- PVI ( Indicators) -
positive volume index
- RANDOM ( Statistical functions) -
random number (AFL 1.9)
- REF ( Trading system toolbox) -
reference past/future values of the array
- RELSTRENGTH (Referencing other symbol data) -
comparative relative strength (AFL 1.3)
- RestorePriceArrays (Referencing other symbol data) -
restore price arrays to original symbol (AFL 2.5)
- RMI ( Indicators) -
Relative Momentum Index (AFL 2.1)
- ROC ( Indicators) -
percentage rate of change
- ROUND ( Math functions) -
round number to nearest integer
- RSI ( Indicators) -
relative strength index
- RWI ( Indicators) -
random walk index
- RWIHI ( Indicators) -
random walk index of highs
- RWILO ( Indicators) -
random walk index of lows
- SAR ( Indicators) -
parabolic stop-and-reverse (AFL 1.3)
- SECOND ( Date/Time) -
get current bar's second (AFL 2.0)
- SECTORID ( Information / Categories) -
get sector ID / name (AFL 1.8)
- SELECTEDVALUE (Exploration /Indicator Builder) -
retrieves value of the array at currently selected date/time point (AFL 2.1)
- SETBARSREQUIRED ( Miscellaneous functions) -
set number of previous and future bars needed for script/DLL to properly execute (AFL 2.1)
- SetForeign (Referencing other symbol data) -
replace current price arrays with those of foreign security (AFL 2.5)
- SetFormulaName ( Trading system toolbox) -
set the name of the formula (AFL 2.5)
- SetOption ( Trading system toolbox) -
sets options in automatic analysis settings (AFL 2.3)
- SETTRADEDELAYS ( Trading system toolbox) -
allows to control trade delays applied by the backtester (AFL 2.1)
- SIGNAL ( Indicators) -
macd signal line
- SIN ( Math functions) -
sine function
- SQRT ( Math functions) -
square root
- STATUS ( Miscellaneous functions) -
get run-time AFL status information (AFL 1.65)
- STDERR ( Statistical functions) -
standard error (AFL 1.4)
- STDEV ( Statistical functions) -
standard deviation (AFL 1.4)
- STOCHD ( Indicators) -
stochastic slow %D
- STOCHK ( Indicators) -
stochastic slow %K
- StrExtract ( String manipulation) -
extracts given item (substring) from comma-separated string (AFL 2.4)
- StrFind ( String manipulation) -
find substring in a string (AFL 2.5)
- StrFormat ( String manipulation) -
Write formatted output to the string (AFL 2.5)
- StrLeft ( String manipulation) -
extracts the leftmost part (AFL 2.0)
- StrLen ( String manipulation) -
string length (AFL 1.5)
- StrMid ( String manipulation) -
extracts part of the string (AFL 2.0)
- StrRight ( String manipulation) -
extracts the rightmost part of the string (AFL 2.0)
- StrToNum ( String manipulation) -
convert string to number (AFL 2.5)
- STUDY ( Miscellaneous functions) -
reference hand-drawn study (AFL 1.5)
- SUM ( Moving averages, summation) -
sum data over specified number of bars
- TEMA ( Moving averages, summation) -
triple exponential moving average (AFL 2.0)
- TimeFrameCompress (Time Frame functions) -
compress single array to given time frame (AFL 2.5)
- TimeFrameExpand (Time Frame functions) -
expand time frame compressed array (AFL 2.5)
- TimeFrameGetPrice (Time Frame functions) -
retrieve O, H, L, C, V values from other time frame (AFL 2.5)
- TimeFrameRestore (Time Frame functions) -
restores price arrays to original time frame (AFL 2.5)
- TimeFrameSet (Time Frame functions) -
switch price arrays to a different time frame (AFL 2.5)
- TIMENUM ( Date/Time) -
get current bar time (AFL 2.0)
- TRIN ( Composites) -
traders (Arms) index (AFL 1.2)
- TRIX ( Indicators) -
triple exponential smoothed price
- TROUGH ( Basic price pattern detection) -
trough (AFL 1.1)
- TROUGHBARS ( Basic price pattern detection) -
bars since trough (AFL 1.1)
- TSF ( Statistical functions) -
time series forecast (AFL 2.2)
- ULTIMATE ( Indicators) -
ultimate oscillator
- UNCISSUES ( Composites) -
unchanged issues (AFL 1.2)
- UNCVOLUME ( Composites) -
unchaged issues volume (AFL 1.2)
- VALUEWHEN ( Trading system toolbox) -
get value of the array when condition met (AFL 1.1)
- VERSION ( Miscellaneous functions) -
get version info (AFL 1.9)
- WILDERS ( Moving averages, summation) -
Wilder's smoothing (AFL 1.4)
- WMA ( Moving averages, summation) -
weighted moving average (AFL 2.0)
- WRITEIF (Exploration /Indicator Builder) -
commentary conditional text output
- WriteVal (Exploration /Indicator Builder) -
write number or value of the array
- YEAR ( Date/Time) -
year (AFL 1.4)
- ZIG ( Basic price pattern detection) -
zig-zag indicator (AFL 1.1)
- _N (Exploration /Indicator Builder) -
no text output (AFL 2.1)
- _TRACE ( Miscellaneous functions) -
print text to system debug viewer (AFL 2.4)