Formula Quick Reference

Market Data | Date Functions | Reference Functions | Logical Functions | Math Functions | Statistic Functions | Indicator Functions | Drawing Functions | Drawing Descriptors | Miscellaneous Functions | Formula Forum


Miscellaneous Functions

sigperform

sigperform(x, signal):

x: an array of numbers representing, in most cases, close prices,
signal: an array of numbers containing 1, -1, 0, where 1 stands for buy signals, -1 for sell signals and 0 for no trading activity.

return gain/loss percentage numbers as the performance of signal.

# compare performance with S&P 500 Index
polyline(1, 0), colorblack;
valid := sgn(barssince(isfirstbar)+1);
sig := valid;
performance : sigperform(close, sig), linethick2;
sp500: sigperform("^gspc$ochl.c", sig);
# compare performance with buy-and-hold strategy
polyline(1, 0), colorblack;
v1 := ma(close, 30);
valid := sgn(barssince(isfirstbar)+1);
buy_hold_signal := valid;
signal := if(close > v1, 1, if(close < v1, -1, 0)) * valid;
performance : sigperform(close, signal);
buy_hold: sigperform(close, buy_hold_signal);

 

Function Index
abs | align | avedev | backset | barscount | barslast | barssince | between | capital | ceiling | circledot | close | color | colorstick | cost | count | cross | crossdot | date | datediff | day | dma | drawicon | drawline | drawnumber | drawtext | ema | every | exist | fillrgn | filter | finance | floor | hhv | hhvbars | high | if | intpart | iscamarket | isdown | isequal | islastbar | isup | isusmarket | last | linestick | linestyle | linethick | llv | llvbars | ln | log | longcross | low | ma | max | min | mod | month | not | open | partline | peak | peakbars | peaktrough | peaktroughbars | pointdot | polyline | pow | range | ref | relate | reverse | sar | sarturn | sgn | sigperform | slope | sma | std | stick | stickline | sum | sumbars | transparency | trough | troughbars | var | vertline | vol | volstick | weekday | winner | year | zig