- [email protected]
- Mon - Sat: 8.00 am - 7.00 pm
// s-trader
Quant Script
01.
Quant Script Overview
Simple syntax, powerful results.
02.
Core Features
Reliable code editor.
03.
Basic Applications
Your very own custom indicators.
04.
Advanced Applications
Simple trading algos.
// S-Trader Quant Script
Overview
At a glance
Primitives
Built-in Studies
SVA Studies
// at a glance
Simple syntax, powerful results.
No matter how complex your algo is, our scripting language lets you build it in the most efficient and effortless of ways.
Quant ScriptTM is a powerful and versatile programming language for traders. The language provides the framework required to build sophisticated trading programs piece by piece without extensive training or programming experience. Not only can the Quant ScriptTM syntax be mastered with almost no learning curve, the S-Trader application also allows you to create scripts using a versatile Quant ScriptTM Wizard.
Just as a spoken language gives you many ways to express each idea, the Quant ScriptTM programming language provides a wide variety of ways to program a trading system. Scripts can be very simple or extremely complex, consisting of many hundreds of lines of instructions. For most systems, individual scripts usually consist of just a few lines of code. Scripts can be further combined and utilized in unique ways using the existing S-Trader infrastructure to create the most powerful trading systems or trade supporting elements you can imagine.
Primitive Functions
- Logical operator primitives
- Extremes primitives
- Summation primitives
- Trend primitives
Math Functions
- Algebraic functions
- Trigonometric functions
Operators
- Comparison operators
- Logical operators
- Mathematical operators
Technical & Statistical studies
- Moving averages
- Envelopes
- Oscillators - price
- Oscillators – money flow
- Trend indicators
- Volatility indicators
- Statistical indicators
Valuation Studies
- SVA Equity valuation analysis functions
// primitives
Robust core functions library.
The core functions of the Quant Script programming language are called primitives. These important functions provide the basic framework to build complex trading systems.
Extremes
- HighestHighValue
- LowestLowValue
- Max
- MaxOf
- Min
- MinOf
Logical Operators
- CountIf
- If
- LastIf
Summation
- CummulativeSeries
- Sum
- SumIf
Trend
- Crossover
- Loop
- Ref
- Trend
Math functions - Algebraic
- Abs
- Exp
- Log
- Log10
- Rnd
Math Functions - Trigonometric
- Atn
- Cos
- Sin
- Tan
Operators - Comparison
- !=
- <
- <=
- =
- =<
- ==
- =>
- >
- >=
Operators - Logical
- !
- &
- &&
- |
- ||
- AND
- EQV
- NOT
- OR
- XOR
Operators - Mathematical
- -
- *
- /
- \
- ^
- +
// Built-in Studies
Extensive technical studies library.
The S-Trader desktop platform has over 100 built-in studies and functions you can use for developing scripts. Each study has a fact sheet detailing its parameters as well as the formula used for its calculation.
Moving Averages
- Exponential Moving Average
- Simple Moving Average
- Time Series Moving Average
- Triangular Moving Average
- Variable Moving Average
- Variable Index Dynamic Average
- Volume Weighted Moving Average
- Weighted Moving Average
- Welles Wilder Smoothing
Envelopes
- Bollinger Bands
- Fractal Chaos Bands
- High-Low Bands
- Keltner Channel
- Moving Average Envelope
- Prime Number Bands
- Stoller Average Range Channel
- Standard Error Bands
Price Oscillators
- Center of Gravity
- Chande Forecast Oscillator
- Chande Momentum Oscillator
- Commodity Channel Index
- Coppock Curve
- Detrended Price Oscillator
- Elder Ray Power
- Elder Thermometer ST
- Fractal Chaos Oscillator
- Intraday Momentum Index
- Moving Average Convergence Divergence (MACD)
- Moving Average Convergence Divergence (MACD) ST
- Momentum Oscillator
- Parabolic Stop & Reverse (SAR)
- Percentage Price Oscillator
- Performance Index
- Pretty Good Oscillator
- Prime Number Oscillator
- QStick Indicator
- Rainbow Oscillator
- Rate Of Change
- Relative Strength Index
- Stochastic Momentum Index
- Stochastic Oscillator
- Stochastic Oscillator ST
- True Strength Index
- Ultimate Oscillator
- Williams % R
Money Flow Oscillators
- Accumulation Distribution
- Chaikin Money Flow
- Ease Of Movement
- Elder Force Index
- Klinger Volume Oscillators
- Market Facilitation Index
- Money Flow Index
- Negative Volume Index
- On-Balance Volume
- Positive Volume Index
- Price Volume Trend
- Trade Volume Index
- Twiggs Money Flow
- Volume Oscillator
- Volume Rate Of Change
- Williams Accumulation Distribution
- Williams Variable Accumulation Distribution
Trend Indicators
- Accumulative Swing Index
- (Welles Wilder) Swing Index
- Aroon
- Directional Movement Index
- Gopalakrishnan Range Index
- Linear Regression Forecast
- Linear Regression Intercept
- Linear Regression Slope
- Linear Regression R2
- Random Walk Index
- Range Action Verification Index (RAVI)
- Scaff Trend Cycle MACD
- Schaff Trend Cycle MACDS
- Time Series Forecast
- Tripple Exponential Average (TRIX)
- Vertical Horizontal Filter
Volatility Indicators
- Chaikin Volatility
- Ehler Fisher Transform
- High Minus Low
- Historical Volatility Index
- Mass Index
- True Range
- Average True Range
- Z Value
Statistics
- Average
- Median
- Typical Price
- Weighted Close
- Kurtosis
- Skewness
- Standard Deviation
- Standard Error
- Correlation Analysis
// SVA Studies
Equity valuation studies.
Valuation studies derived directly from company balance sheet data to understand and model intrinsic values. Compare benchmark and actual valuation multiples to understand how fundamental value is created or eroded.
The SVA equity valuation studies are extremely relevant to equity traders and investors. Thanks to our partnership with our friends at Strategic Analysis Corporation (1994), the S-Trader platform gives you the ability to plot popular technical studies and fundamental studies based on balance sheet analysis all in the same frame / window. In addition, the Quant ScriptTM engine allows you to write scripts using the built-in technical and statistical functions, the SVA equity valuation functions or a combination of both. The SVA equity valuation functions can in fact be nested at any iteration inside any other technical and statistical function for some truly powerful and objective analysis and scripting on the firm’s intrinsic value and stability, as they result directly from the firm’s balance sheet.
SVA Price Multiple function
This function returns the relevant price multiples of the stock.
Bubble Valuation Multiples
- High Bubble 8 (HB8)
- High Bubble 7 (HB7)
- High Bubble 6 (HB6)
- High Bubble 5 (HB5)
- High Bubble 4 (HB8)
- High Bubble 3 (HB3)
- High Bubble 2 (HB2)
- High Bubble 1 (HB1)
- Bubble (BB)
Growth Valuation Multiples
- Mid Super Growth (MSG)
- Low Super Growth (LSG)
- Super Growth (SG)
- Mid Growth (MG)
- Growth (G)
Normal Valuation Multiples
- High Conservation (HC)
- High-Mid (HM)
- Normal (G)
- Low-Mid (LM)
- Low Conservation (LC)
Blue Valuation Multiples
- Blue (BL)
- Deep Blue 1 (DB1)
- Deep Blue 2 (DB2)
- Deep Blue 3 (DB3)
- Deep Blue 4 (DB4)
- Deep Blue 5 (DB5)
- Deep Blue 6 (DB6)
Future Market Value function
This function returns the inferred future fair value of the stock.
Stability Ratio function
This function measures the balance sheet stability of the stock and can be viewed as a forward-looking measure of future stock price volatility.
// s-trader quant script
Core Features
Code Editor
Code Wizard
// Code editor.
Reliable code editor.
Create any algorithm by writing code in the easy-to-master, zero learning curve Quant Script language.
The Quant ScriptTM language is not only powerful and versatile but also easy to use. There is a minimal learning curve to climb for beginning to use the Quant ScriptTM Code Editor; and there is a ZERO learning curve for beginning to use the Quant ScriptTM Code Wizard. Scripts built with either tool will achieve the exact same result and will behave the exact same way so using one or the other is strictly a matter of personal preference.
Very importantly, whether you use the Code Editor or the Code Wizard, for scripts to be usable and compatible with all S-Trader modules, they must return a result function as well as its inverse, i.e. a reverse result function. The script structure should therefore be:
- All script code and programming logic;
- SET RESULT = code and portion of the script for the function the script is supposed to return;
- SET REVERSE_RESULT = code and portion of the script for the inverse of the function the script is supposed to return.
Let us look at an example of a simple script measuring the average percentage deviation of three moving averages for 10, 20 and 30 periods, respectively, from closing prices:
Step 1
Defining the 10, 20 and 30 Exponential Moving Averages of Closing Prices
- SET EMA10 = ExponentialMovingAverage(CLOSE,10)
- SET EMA20 = ExponentialMovingAverage(CLOSE,20)
- SET EMA30 = ExponentialMovingAverage(CLOSE,30)
Step 2
Defining the SUM deviation of the three Exponential Moving Averages from Closing Prices
- SET EMASUM = EMA10 + EMA20 + EMA30 – (3)*(CLOSE)
Step 3
Defining the RESULT function, i.e. the average percentage deviation of the three Exponential Moving Averages from Closing Prices
- SET RESULT = (EMASUM) / ( (3)*(CLOSE) )
Step 4
Defining the REVERSE_RESULT inverse function
- SET REVERSE_RESULT = (-1) * (RESULT)
// Code Wizard
Intuitive code wizard.
Create any algorithm line-by-line using the drag and drop functionality of the code wizard.
While there is a tiny learning curve to climb in order to begin using the Quant ScriptTM Code Editor, there is a ZERO learning curve to begin using the Quant ScriptTM Code Wizard. Scripts built with either tool will achieve the exact same result and will behave the exact same way so using one or the other is strictly a matter of personal preference.
Very importantly, whether you use the Code Editor or the Code Wizard, for scripts to be usable and compatible with all S-Trader modules, they must return a result function as well as its inverse, i.e. a reverse result function. The script structure should therefore be:
- All script code and programming logic;
- SET RESULT = code and portion of the script for the function the script is supposed to return;
- SET REVERSE_RESULT = code and portion of the script for the inverse of the function the script is supposed to return.
Let us look at an example of a simple script built using the script wizard measuring the average percentage deviation of three moving averages for 10, 20 and 30 periods, respectively, from closing prices:
Step 1
Defining the 10, 20 and 30 Exponential Moving Averages of Closing Prices
Step 2
Defining the SUM deviation of the three Exponential Moving Averages from Closing Prices.
Step 3
Defining the RESULT function, i.e. the average percentage deviation of the three Exponential Moving Averages from Closing Prices
Step 4
Defining the REVERSE_RESULT inverse function.
// S-Trader Quant Script
Basic Applications
Custom Studies
Expert Advisers
Consensus Reports
Your very own custom indicators.
Build your own custom indicators to plot on charts or use inside other algo-trading modules.
Computed Custom Studies
You can define any custom study as an actual function with a calculated value. There is no restriction as to how complex the studies can be. Hundreds of lines of code will compute just fine even on tick time frames.Such studies are typically built to be plotted on charts or ran as the benchmark property to evaluate matrices and relative strength patterns inside portfolio systems.
Validation Custom Studies
You can also define any custom study as a +1 (bullish) / -1 (bearish) validation of certain technical events. There is again no restriction as to how complex the studies can be, with hundreds of lines of code computing just fine even on tick charts.Such studies would typically be used as part of expert advisers, scripted alerts or loop trading systems to determine the timing of the buy/sell decisions.
Managing Custom Studies
Custom studies can be easily managed and re-arranged in groups by mere drag-and-drop inside the Quant Script Studies dialog. Both the editor-based and the wizard-based ones can be password protected in which case their users will be able to use them inside the S-Trader platform but not see their content.
The different types of custom studies – local or server-hosted, editor or wizard-based, password protected or not – can be easily identified by the color of their icons:
- – Local | Editor-based | No password protection;
- – Local | Editor-based | Password protected;
- – Local | Wizard-based | No password protection;
- – Local | Wizard-based | Password protected;
- – Server-hosted | Editor-based | Password protected.
Powerful expert advisers.
Build your own expert advisers to spot market occurrences you deem significant. Combine script-triggered signals with advanced visuals, pop-up messages and sound alerts to stay on top of developments.
Bar Color
Create bullish and bearish scripts and color the bars and candles on your chart with something that will help you distinguish between bullish and bearish occurrences. These kind of expert advisers would normally be used to generically assess uptrends and downtrends.
Symbol Plot
Create event-specific bullish and bearish scripts and plot their occurrences on charts using any symbol you want. These kind of expert advisers would normally be used to identify certain bullish or bearish triggers whose fulfillment normally leads to important changes in the direction of market moves and/or their pace.
Banner Plot
Create bullish and bearish scripts and plot colored banners at the bottom of the chart that would help you distinguish between bullish and bearish occurrences. These kind of expert advisers would normally be used to generically assess high profile uptrends and downtrends.
Sound & Text Alerts
In addition to the visuals you can create by coloring bars, plotting symbols or creating banners directly on charts, you can set your expert advisers to trigger pop up and/or sound alerts. Expert advisers which would pertain to important occurrences that require some kind of action be taken would normally have their pop up and sound alert options enabled.
Managing Expert Advisers
Expert advisers can be easily managed and re-arranged in groups by mere drag-and-drop inside the Expert Advisers dialog. The EAs can be password protected in which case their users will be able to use them inside the S-Trader platform but not see their content. Distinguishing between password-protected and unprotected EAs is done by observing the color of their icons: - No password protection; - Password protected.
Frequency of occurrence matters.
Gauge the frequency of occurrence of bullish or bearish events as defined inside your expert advisers.
Asses the balance of bullish or bearish occurrences of any expert adviser, over any period of time in any time frame. The consensus report formula is:
- If bearish occurrences outnumber bullish occurrences:
-1 + (bullish #)/(bearish #)
- If bullish occurrences outnumber bearish occurrences:
+1 – (bearish#)/(bullish #)
Consensus reports in fact identify when things are becoming extreme and thus when a market move is becoming overextended and due to either cool off or reverse. They are normally used as an “early warning system”.
// s-trader quant script
Advanced Applications
Scripted Alerts
Loop Systems
Portfolio Systems
Simple trading algos.
Build simple, four-step buy and sell algorithms on any equity, interest rate, forex or commodity product. Back-test your ideas, run them live or auto-execute them directly to your brokerage account.
Scripted alerts are simple, four-step (buy / sell / exit long / exit short) algorithms used to trade single instruments such as individual stocks, futures or currency pairs. Because fulfillment of the algorithms leads to clear-cut buy or sell signals that require action be taken , the algos would normally be written like validation custom studies – a buy or sell signal is either triggered or it isn’t.The difference here is that the algos employed on any leg of a scripted alert will only have a RESULT function and will simply skip the REVERSE_RESULT inverse function.
You can type your buy / sell / exit long / exit short scripts in the appropriate sections or, easier yet, you can “call the code in” from inside any editor-based or wizard-based custom study.
Complex trading algorithms.
Combine validation custom studies any way you want to build complex trading algorithms. Build multi-leg / multi step trading systems with advanced step-leg dependencies and fully customizable logical sequences.
We break-down a full position cycle into specific steps. We allow for the possibility of having step fulfillment in more than one way, i.e. through more than one set of conditions – or legs.
Leg fulfillment occurs with the simultaneous fulfillment of multiple conditions evaluated in different time frames on a print, or, as the case may be, on a closing basis. The conditions are in fact validation custom studies whose RESULT function returning +1 leads to buy-side fulfillment and whose REVERSE_RESULT inverse function returning -1 leads to sell-side fulfillment.
Rule-based portfolio construction.
Analyze patterns of relative strength based on any property you want inside any investment universe you deem appropriate. Build inclusion / exclusion rules for increased objectivity and improved portfolio results.
You can evaluate any universe of investments based on the property / properties measured by any local or server-hosted custom study. The evaluation can be conducted in any time frame and at any point in time. The matrix calculation is optimized based on both the RESULT and the REVERSE_RESULT functions. It is thus very important that custom studies used inside portfolio systems have both a function and its inverse correctly defined.
Computing the matrices will yield individual relative strength numbers and thus objective peer and universe ranking. Each individual constituent’s rank will be given by how well it does relative to constituents in its group or in the entire investment universe, as measured by the custom study chosen to evaluate the portfolio for.