Basic Quant Strategies

Kuants
Algorithmic Trading-Complete Guide by Kuants
3 min readSep 5, 2018

Technical Indicators

Simple Moving Average
Syntax:sma(parameter,n)

As the name, it gives the average of the parameter for the last n values of the parameter.It is called moving average because it is calculated at every minute, and a seperate series, same as that of price is formed in this indicator.

Example:sma(close,5) > sma(close,10)

Exponential Moving Average
Syntax: ema(parameter,n)

Almost similar to the simple moving average, the difference lies that in the Exponential Moving Average, rather than simple avearge, a weighted average is evaluated, which gives higher priority to the latest prices than the earlier prices. It leads to the series of Exponential Moving Average moving more closely to the price series than simple moving average.

Example:ema(close,5) > ema(close,10)
Relative Strength Index (RSI)
Syntax:rsi(n)

It gives an indication of reversal of a particular trend in a scale of 0 to 100. A value > 80 signifies the price of the stock is more than what it should have and will move down from then, and a value of < 30 indicates the reverse. It calculates the frequency of time frame when the prices have moved up and down within n time frame and converts to a scale of 100.

Example:rsi(10) < 30
Moving Acearge Convergence-Divergence (MACD)
Syntax:macd(parameter)

As the name, it gives an indication whether 2 differently times moving averages are moving close to each other or the opposite.It calculates 2 moving averages series of 9 and 14 time frames, i.e. sma(close,9) and sma(close,14) ; then creates a moving average of the difference over 9 time periods, i.e. sma( sma(close,9) — sma(close,14),9) and returns the difference between this and the latest difference between moving averages, i.e. (sma( close, 9 ) — sma ( close , 14) ) — sma( sma(close,9) — sma(close,14),9). Higher value indicates upward momentum and vice versa.

Example:macd(close) > 0
Bollinger Bands
Syntax:bb(parameter,n)

Its a reversal indicator that gives you an indication that the price has moved farther than the mean by 1-standard deviation and has higher probability to come back. It works well with RSI indicator.

Example:(bb(close,10) > 0) & ( rsi(10) > 70)
Volume Weighted Moving Average
Syntax:vwap(n)

Evaluates the average of recent n time period of prices with volume as weights to the corresponding price. It is considered to be a very strong parameter and can be used with multiple indicators to give a balance strong strategy.

Example:ema(vwap(10), 10) > ema(vwap(10), 20)
Rate of Change (ROC)
Syntax:roc(parameter,n)

Evaluates the change in value of a paramter in the last n time periods

Example:roc(sma(close,10),10) > 1
Money Flow Index (MFI)
Syntax:mfi(10)

Its an analogy of Relative Strength Index indicator in volume, wherein the ratio of frequency of ups and downs are adjusted with volume.

Example:mfi(10) > 30
Force Index
Syntax:force(10)

It tells you about the strength of the momentum with volume. Higher the value, more is probability of prices moving in a particular direction.

Example:mfi(10) > fi(20)
Average True Range(ATR)
Syntax:atr(n)

It tells you about the average range seen in the prices in the recent n time frames.

Example:atr(10) > atr(20)
On Balance Volume
Syntax:obv(n)

It is a ratio of sum of volumes at time frames of upward price movements and at down time movements

Example:obv(10) > 0

A few examples of Price-Volume based strategies are

Example:sma(rank(vwap(5),10),5) > sma(rank(vwap(5),10),10)
Logic:The idea behind this strategy is also to buy when the pricess are moving up. The above formula is an implementation for the same and combines the 4 point framework of a strategy in a single formula.

A stock is moving up can be indicated by the fact that its volume weighted moving avreage is moving upwards. So we have used vwap to represent the same. Now vwap would increase if its rank is increasing, i.e. the highest values of vwap are seen in the latest data. Hence if rank of vwap for n time frames is higher than rank of vwap for (n+ 1) time frames, it indicates that the price is rising. To remove any points that might come up due to a small erratic movement in price, we added the simple moving average term, i.e. sma. What it does is that it smoothens the data series. Hence, implementing the complete formula for the strategy, it might be possible to identify the stocks that are about to move up and buy them

Example:close > vwap(5)
Logic: Based on indentifying prices that are higher than they should be.
Example:(std(close,10) > std(close,15) ) & ( sma(close,5) > sma(close,10)
Logic: Based on indentifying the movement is there in the market and prices are moving up..

--

--