Logo Compose your trading system through a user friendly
graphical interface and see when to go long, short or liquidate.

Algorithms From Derivatives

Here the elementary trading algorithms obtained from the derivatives of the base indicator are described.


Algorithms From Derivatives

List of Algorithms

The derivatives of the base indicator are:
  • Slope
  • Angle
  • Momentum
  • ROC (Rate of Change)
Remember that the derivative is calculated not on the base indicator itself, but on its moving average. For each derivative the following algorithms are implemented:
  • derivative greater than threshold
  • derivative positive
  • derivative less than threshold
  • derivative negative
  • derivative between thresholds
Hence, for each base indicator we have the following.
Slope of Indicator
  • Slope of MA of base indicator greater than threshold
  • Slope of MA of base indicator positive
  • Slope of MA of base indicator less than threshold
  • Slope of MA of base indicator negative
  • Slope of MA of base indicator between thresholds
For instance:
  • Slope of MA of Keltner channel lower line greater than threshold
  • Slope of MA of Keltner channel lower line positive
  • Slope of MA of Keltner channel lower line less than threshold
  • Slope of MA of Keltner channel lower line negative
  • Slope of MA of Keltner channel lower line between thresholds
Angle of Indicator
  • Angle of MA of base indicator greater than threshold
  • Angle of MA of base indicator positive
  • Angle of MA of base indicator less than threshold
  • Angle of MA of base indicator negative
  • Angle of MA of base indicator between thresholds
For instance:
  • Angle of MA of Keltner channel lower line greater than threshold
  • Angle of MA of Keltner channel lower line positive
  • Angle of MA of Keltner channel lower line less than threshold
  • Angle of MA of Keltner channel lower line negative
  • Angle of MA of Keltner channel lower line between thresholds
Momentum of Indicator
  • Momentum of MA of base indicator greater than threshold
  • Momentum of MA of base indicator positive
  • Momentum of MA of base indicator less than threshold
  • Momentum of MA of base indicator negative
  • Momentum of MA of base indicator between thresholds
For instance:
  • Momentum of MA of Keltner channel lower line greater than threshold
  • Momentum of MA of Keltner channel lower line positive
  • Momentum of MA of Keltner channel lower line less than threshold
  • Momentum of MA of Keltner channel lower line negative
  • Momentum of MA of Keltner channel lower line between thresholds
ROC of Overlay
  • ROC of MA of base indicator greater than threshold
  • ROC of MA of base indicator positive
  • ROC of MA of base indicator less than threshold
  • ROC of MA of base indicator negative
  • ROC of MA of base indicator between thresholds
For instance:
  • ROC of MA of Keltner channel lower line greater than threshold
  • ROC of MA of Keltner channel lower line positive
  • ROC of MA of Keltner channel lower line less than threshold
  • ROC of MA of Keltner channel lower line negative
  • ROC of MA of Keltner channel lower line between thresholds
Remember that the ROC is applied only to overlays, not indicators.

Description

Descriptions are the same for all 4 derivatives.
Derivative Greater Than Threshold
This algorithm checks whether the derivative of the MA of 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 if
  derivative (MA (base indicator)) > threshold
Derivative Positive
This algorithm checks whether the derivative of the MA of the base indicator is positive. So the algorithm is true if and only if
  derivative (MA (base indicator)) > 0
Derivative Less Than Threshold
This algorithm checks whether the derivative of the MA of 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 if
  derivative (MA (base indicator)) < threshold
Derivative Negative
This algorithm checks whether the derivative of the MA of the base indicator is negative. So the algorithm is true if and only if
  derivative (MA (base indicator)) < 0
Derivative Between Thresholds
This algorithm checks whether the derivative of the MA of the base indicator is between two thresholds, i.e. two particular values, input by the user. So the algorithm is true if and only if
  lower threshold < derivative (MA (base indicator)) < upper threshold

Examples of Application

Derivative Positive: Uptrend
Derivative Positive: Uptrend By definition, if the price is increasing, an uptrend is under way. If you want to locate a market uptrend, you can look at the derivative of an indicator following the price level. Basically any overlay does that. For instance you could consider the Keltner Channels. As all the channels, its algorithms are split into two parts: one for the upper line and the other for the lower line. Let's pick up the lower line. You can say that when the derivative of the lower line is positive, the price is increasing and hence the market is in an uptrend phase. Select the
  Slope of MA of Keltner channel
    lower line positive
and put it in one of the slots of the Long tab. By appropriately choosing the lookback periods, you can decide if you are looking at a short, medium or long term uptrend. You can act on the lookback of the derivative, of the MA or of the Keltner Channels.
Derivative Greater Than Threshold: Surge
Surge If you want to detect a surge in the market, you can watch for high values of the derivative of a price following indicator, like an overlay. In this case you can use the
  Derivative greater than threshold
algorithms. Arguably, the best derivative for this purpose is the ROC, because its values are a percentage version of the difference of input values. So let's select the
  ROC of MA of Keltner channel
    lower line greater than threshold
and trim its input parameters. When the algorithm is true, there is a surge in prices.
Strong Uptrend Or Overbought
You can consider it both as a signal of strength of the market or as an overbought signal. In the first case you might want to keep a long position open; in the second you might want to close it.
Derivative Less Than Threshold: Liquidate After a Surge
Liquidate After a Surge If you take the opposite algorithm of the preceding example
  ROC of MA of Keltner channel
    lower line less than threshold
with same input parameters, you get the inverted algorithm. This time when the algorithm is true, there is no surge in the market; when it is false, there is a surge. That means that when it passes from false to true, it signals that the surge in progress is over. If you activate the
  Step
checkbox, that's exactly what would be evidenced, i.e. when the algorithm transitions from false to true. You could think of liquidating long positions when an upsurge is over. So you could put this algorithm in the Liquidate long tab.
Derivative Between Thresholds: Congestion
Congestion When the derivative is near zero, it means the indicator it is applied to is basically constant. If the indicator is price following, then the price is constant, i.e. the market is in a congestion phase. So if you take an overlay, you can say that when its derivative is almost zero, there is a congestion. For this purpose you can use the
  Derivative between thresholds
algorithms. Let's take the Keltner Channel lower line again, select the
  Angle of MA of Keltner channel
    lower line between thresholds
with appropriate input parameters. Maybe you don't want to trade during a congestion phase of the market. So you can put this algorithm in the Liquidate long tab, to liquidate long positions when in congestion.
Derivative Not Between Threshold: Not in Congestion
Not in Congestion If, in the previous example, you select the NOT checkbox of the algorithm, the logic is inverted, and hence we can check whether the derivative is outside a range. So 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.
Derivative Positive: Increasing Indicator
Increasing Indicator For some indicator, their value is not important, but their trend is. One of such indicators is the On Balance Volume (OBV). Through the derivatives you can implement the recommendations found in literature. For the On Balance Volume it is thought that when it is increasing, then an uptrend is under way. In this case you can select the
  Momentum of MA of
    On Balance Volume positive
to check when its derivative is positive. When the algorithm is true, there is an uptrend. You can put this algorithm in the Long tab.
Derivative Negative: Second Derivative
Second Derivative The second derivative is the derivative of the derivative. It expresses when the first derivative is increasing or decreasing.

You can implement this concept by applying a derivative indicator to a derivative indicator, as:
  Momentum of MA of Momentum
In this case the Momentum is the first derivative and the Momentum of Momentum is the second derivative. Or you can use a 'mix' of indicators, like
  Angle of MA of Momentum

You might want to liquidate a long position soon enough, without waiting for a decline in price, but as soon as the price rising decelerates. For this, you can check when the second derivative becomes negative. It means that the first derivative is decreasing, although it might still have a positive value, meaning the price is still rising.

In the picture you can see that while the Momentum is still positive, i.e. the price is rising, at a certain point it becomes flat and, consequently, the second derivative becomes zero, foreshadowing a probable stop in increasing prices. When the Momentum starts declining, the second derivative is negative. It's as if the second derivative anticipates the first derivative. So you don't wait for the Momentum to become negative to liquidate the long position; you act right away as soon as the second derivative becomes negative, and this happens much sooner. If you put, in the Liquidate long tab, the
  Momentum of MA of Momentum negative
you can liquidate the long position basically at the peak of the price, maximizing the profit.