Algorithms from Base Indicators
Here the trading algorithms obtained directly from the base indicator are described.List of Algorithms
The trading algorithms derived directly from the base indicator are:- greater than threshold
- positive
- less than threshold
- negative
- between thresholds
- Base indicator greater than threshold
- Base indicator positive
- Base indicator less than threshold
- Base indicator negative
- Base indicator between thresholds
- Accumulation Distribution greater than threshold
- Accumulation Distribution positive
- Accumulation Distribution less than threshold
- Accumulation Distribution negative
- Accumulation Distribution between thresholds
Description
Base Indicator Greater Than Threshold
This algorithm checks whether the base indicator is greater than a threshold, i.e. a particular value, input by the user. So the algorithm is true if and only ifbase indicator > threshold
Base Indicator Positive
This algorithm checks whether the base indicator is positive. So the algorithm is true if and only ifbase indicator > 0
Base Indicator Less Than Threshold
This algorithm checks whether the base indicator is less than a threshold., i.e. a particular value, input by the user. So the algorithm is true if and only ifbase indicator < threshold
Base Indicator Negative
This algorithm checks whether the base indicator is negative. So the algorithm is true if and only ifbase indicator < 0
Base Indicator Between Thresholds
This algorithm checks whether the base indicator is between two thresholds, i.e. two particular values, input by the user. So the algorithm is true if and only iflower threshold < base indicator < upper threshold
Threshold
In general thethreshold
can take on any value:
threshold ∊ (-∞, + ∞)but for each algorithm can have its own bounds, detailed in the
Parameters
paragraph in the description pane.
Examples of Application
Greater Than Threshold: Strong Uptrend or Overbought
Thegreater than
algorithms are particularly useful for bounded indicators, like the RSI.
According to the literature, for instance, if the RSI is greater than 70, there is a strong uptrend or an overbought market.
So, select the algorithm
RSI greater than thresholdand input a threshold of 70.
As you can see, a lot of information is reported in the description pane. The
Literature signals
assume you are checking for a high threshold, not a low one.
This is exactly what we are doing here. But you can input any threshold, just ponder carefully its meaning in terms of signals.
The Parameters
section reminds you the range of the threshold, which corresponds to the range of the RSI.
If you run it, you can see the algorithm is true (equal to 1 in charts) whenever the RSI is greater than 70. Otherwise it is false (0 in charts). Where the algorithm is true, the market is classically considered in strong uptrend or overbought. If you favor the strong uptrend, you should use this algorithm in the
Long
tab, to enter a long position.
If you favor the overbought, you might consider using this algorithm in the Liquidate long
tab, to liquidate long positions.
Less Than Threshold: Strong Downtrend or Oversold
Analogously to the previous example, according to literature, if the RSI is less than 30, there is a strong downtrend or an oversold market. By selecting theRSI less than thresholdalgorithm and inputting a threshold of 30 you can see when this happens. Where the algorithm is true, the market is classically considered in strong downtrend or oversold. If you favor the strong downtrend, you should use this algorithm in the
Short
tab, to enter a short position.
If you favor the oversold, you might consider using this algorithm in the Liquidate short
tab, to liquidate short positions.
Between Thresholds: Congestion
According to literature, if the RSI is around 50, there is a congestion. By selecting theRSI between thresholdsalgorithm and inputting for instance:
lower threshold = 45 upper threshold = 55you can see when this happens. Where the algorithm is true, the market is classically considered in congestion. Conventional trend following algorithms assume a trending market. A typical example is to enter a long position when the close price goes above the moving average of the price. However, in a congestion phase, you might want to apply the opposite of the trend following algorithm, i.e. to enter a long position when the close price goes below the moving average of the price. You can do that by 'ANDing' the two algorithms together, in the
Long
tab.
Note that, in order to apply the opposite algorithm, you could use the 'straight' one
Close greater than MA of EMAand check its NOT checkbox. However, this always results in slower computation speed, so this is definitely not the recommended way.
Not Between Threshold: Not in Congestion
Usually, you should not trade trend following algorithms during a congestion phase of the market. As seen in the previous example, you can check whether the RSI is within a range of values. But if you select the NOT checkbox of the algorithm, the logic is inverted, and hence we can check whether the RSI is outside a range.If we do that, with the same thresholds as in the previous example, we obtain the inverted figure. Now we are checking when the market is not in a congestion phase.
You can 'AND' this algorithm with a trend following algorithm, to make sure you apply the trend following technique only out of congestion.
Greater Than Threshold: High Volatility
Through theGreater Than Threshold
algorithms you can spot periods of high volatility in the market.
Just pick up a volatility indicator and check when its value is higher than a threshold.
For instance the standard deviation is one of the most used; in order to make it more consistent throughout price ranges, we can use its percentage version.
When the algorithm is true, volatility is high.
If you want to liquidate your positions when volatility is high, put this indicator in the Liquidate tabs,
maybe in the only one present when not distinguishing between long and short.
Less Than Threshold: Low Volatility
If you want to spot where volatility is low, check when a volatility indicator is less than a threshold. As in the previous example, we can take the standard deviation in its percentage version. When the indicatorStandard deviation percentage less than thresholdis true, volatility is low. If you want to enter a long position only when volatility is low, 'AND' this algorithm with another algorithm saying when to go long, in the
Long
tab.
Positive: Uptrend
Examples of application for this kind of algorithms are checking whether the market is trending. An indicator like the Momentum is classically considered to indicate an uptrend when positive. So select this algorithm for the Momentum.Where the algorithm is true, the market is up-trending. You can use this algorithm in the
Long
tab, to enter a long position.
Negative: Downtrend
Similarly to the previous example, you can use this kind of algorithms to highlight down-trending market. E.g. select theMomentum negativealgorithm. Where the algorithm is true, the market is down-trending. You can use this algorithm in the
Short
tab, to enter a short position.
Note that this curve is the inverted of the previous example.
Greater Than Threshold: Bollinger Band Width
The Bollinger Band is thought to forecast an imminent strong trend when its width 'squeezes'. If you want to adopt this strategy, you want to detect when the squeeze is over. For this, the idea is to exploit theStep
checkbox of algorithms, where the transitions from false to true is detected.
If you select the
Bollinger Band width percentage greater than thresholdyou check where the width has a high value. If you select its
Step
checkbox, you detect where the width passes from small to big, i.e. when the squeeze finishes.
According to the literature, this is the time when a strong trend begins.
If you 'AND' this algorithm with a trend following one, you get a high probability to run the trend. One of such a trend following algorithm, classically is the breakout of the band. So you can pick up the
High greater than MA of Bollinger Band upper linemaybe with different input parameters.