Help Centre -

New to ShareInvestor?

Sign up and subscribe to one of ShareInvestor's membership plans.

Dynamic TA Charts

TA Formula Editor - Formula Language

TA Formula Editor – Functions
Functions Descriptions
@SETNAME(Name) Set formula line name. Should be start with @.
@SETNAME(Data,Name) Set formula line name. Should be start with @.
@SETTEXTVISIBLE(Visible) Set formula line name visibility. should be start with @.
@SET_ATTRIBUTE(Data, Attr) Set attribute of the formula. Should be start with @.
@SETYMINMAX(MinY,MaxY) Set min and max value of Y-axis. Should be start with @.
@SETCOLORSCRIPT(Data,Name,Script) Set customize color for Data based on Script. Should be start with @.
@COPYNUMERICATTR(Data1,Data2) Copy numerical attribute from Data1 to Data2. Should be start with @.
@COPYMISCATTR(Data1,Data2) Copy miscellenous attribute from Data1 to Data2. Should be start with @.
@GETNUMERICATTR(Data,Index) Get numerical attribute from Data. Should be start with @.
@SETNUMERICATTR(Data1,Index,Data2) Set Data2 as numerical attribute of Data1. Should be start with @.
CLONE(Data) Clone another copy of data.
TRUE True constant.
FALSE False constant.
NAN An array of nan.
TA Formula Editor – Basic Data
Basic Data Descriptions
CLOSE Get the counter's close price.
C Shortcut of CLOSE.
OPEN Get the counter's open price.
O Shortcut of OPEN.
HIGH Get the counter's highest price.
H Shortcut of HIGH.
LOW Get the counter's lowest price.
L Shortcut of LOW.
VOLUME Get the counter's volume.
VOL Shortcut of VOLUME.
V Shortcut of VOLUME.
TA Formula Editor – Reference Functions
Reference Functions Descriptions
MUL(Data) Multiple from the first bar.
SUM(Data,N) Sum last N days value.
SUM(Data) Sum from the first bar.
COUNT(Data,N) True count of last N days.
REF(Data,N) Reference value of N days before.
REF_EXPAND(Data,N) Reference value of N days before. (Extend into future data)
MA(N) N days moving average of Close price.
MA(Data,N) N days moving average.
MA(Price,N) N days moving average.
EMA(Data,N) N days exponential moving average.
EMA(Price,N) N days exponential moving average.
WMA(Data,N) N days weighted moving average.
WMA(Price,N) N days weighted moving average.
SMA(Data,N,M) M days simple moving average from Nth day onwards
WILDERSUM(Data,N) Wilder summation.
HHV(Data,N) N days highest value.
LLV(Data,N) N days lowest value.
HHVBARS(Data,N) N days highest value bars count.
LLVBARS(Data,N) N days lowest value bars count.
BARSCOUNT(Data) Bars count.
BARSSINCE(Data) Bars count since Data > 0 and reset when data == 0.
BACKSET(Data,N) Backset N bars to 1 when Data > 0.
VOLUMEOVERPRICE(N) Volume over price.
TA Formula Editor – Logic Functions
Logic Functions Descriptions
IF(Cond,Data1,Data2) If Cond > 0 return Data1, otherwise return Data2.
REPLACE(Cond1,Cond2,Data) If Cond1 == Cond2, replace with Data.
CROSS(Data1,Data2,N) If Data1 cross Data2 from below and the cross last N bars return 1, otherwise return 0.
ABOVE(Data1,Data2,N) If Data1 is above Data2 for last N bars return 1, otherwise return 0.
BELOW(Data1,Data2,N) If Data1 is below Data2 for last N bars return 1, otherwise return 0.
TA Formula Editor – Math Functions
Math Functions Descriptions
MAX(Data1,Data2) Maximum value.
MIN(Data1,Data2) Minimum value.
ABS(Data) Absolute value.
LOG(Data) 10 based Log.
LOG(Data,N) N based Log.
LOG10(Data) 10 based Log.
LN(Data) e based Log.
EXP(Data) e raised to the specified power.
SQRT(Data) Square root of the value.
SQR(Data) Square of the value.
TA Formula Editor – Statistic Functions
Statistic Functions Descriptions
STD(Data,N) N days standard deviation value.
VAR(Data,N) N days variant value.
AVEDEV(Data,N) N days average value.
SLOPE(Data,N) N days linear regression slope.
CORR(Data1,Data2,N) N days correlation factor between Data1 and Data2.
RECUSIVE_LOOP(Data1,N,M,Data2) Recursive calculate next item value by using the formula: (N * prev Data1) + (M * Data1) + Data2
RECUSIVE_LOOP(Data1,N,M,Data2,F) Recursive calculate next item value by using the formula: ((N * prev Data) + (M * Data1) + Data2) * F
TA Formula Editor – Index Functions
Index Functions Descriptions
LOWESTSINCE(Cond,Data,N) Return lowest of Data if Cond>0 on Nth most recent occurrences.
HIGHESTSINCE(Cond,Data,N) Return highest of Data if Cond>0 on Nth most recent occurrences.
ZIG(Data,N) N days Zig Zag.
ZIG(Data,Data2,N) N days Zig Zag percent value.
FINDPEAK(Data,Data2,N) Find Peak based on Zig(N).
FINDTROUGH(Data,Data2,N) Find Trough based on Zig(N).
SAR(N,STEP,MAXP) Parabolic Stop and Reversal.
PEAK(Data1,Data2,N,M) Find Mth Peak based on Zig(N).
TROUGH(Data1,Data2,N,M) Find Mth Trough based on Zig(N).
VALUEWHEN(Cond,Data,N) Return Data if Cond>0 on Nth most recent occurrences.
VALUEWHENBARS(Cond,Data,N) Return bar count if Cond>0 on Nth most recent occurrences.
TA Formula Editor – String Functions
String Functions Descriptions
CODE Return counter's symbol.
STKLABEL Return counter's symbol.
SYMBOL Return counter's symbol.
STOCKNAME Return counter's name.
STOCKNAME(Data) Return Data's name.
STKNAME Return counter's name.
STKNAME(Data) Return Data's name.
TA Formula Editor – Draw Functions
Draw Functions Descriptions
FILLRGN(Cond,Data1,Data2) Fill region Data1 to Data2 when Cond is True.
FILLAREA(Data) Fill area below Data.
PIVOTSEGMENT(Period,N,Data,M) Render pivot segment.
PIVOTSEGMENT(Period,N,Data,M,L) Render defined number of sets of pivot segment.
STOCK Draw counter bar based on O, C, H, L.
DRAWSIGNAL(Cond,Pos,Signal) Draw buy/sell arrow at position when Cond is True.
TA Formula Editor – Advanced Functions
Advanced Functions Descriptions
FML(FormulaScript) Reference other formula.
FML(Symbol, FormulaScript) Reference other formula.
FML(Symbol,FormulaName,Params) Reference other formula.
GETDATA(Period,N,Price) Get price data in defined period.
MERGEDATA(Period,N,Data) Merge data in defined period. Do note that when using this function, raw price data needs to be merged using GetData.
TA Formula Editor – Data Attributes
Data Attributes Descriptions
THIS_DATA Refer to current formula data.
COLORSTICK Render data as histogram.
VOLSTICK Render data as volume histogram.
SEGMENT_LINE Add segment line.
HORZLINE Add horizontal line.
VERTLINE Add vertical line.
NOVALUELABEL Do not show value label.
VALUEONLY Show value label only.
WIDTH Set line width.
HIGHSPEED Smooth line with no anti-aliasing.
ANTIALIAS Smooth line with anti-aliasing.
DASHDASH Render dash dash line.
DOTDASH Render dot dash line.
DASHDOTDASH Render dash dot dash line.
DASHDOTDOTDASH Render dash dot dot dash line.
CROSSDOT Render cross dot line.
POINTDOT Render point dot line.
CIRCLEDOT Render circle dot line.
FORMAT Set display string format to number of precision or decide.