Moving Average Crossover Block

MA cross block - This block is a "conditional block" that is triggered when two moving averages cross. This block allows you to compare the behavior of two moving averages (the "fast" and the "slow" one) and to detect the crossings in order to identify trends or to extract trading signals.

Reminder of the basics

A moving average (or moving average) is an indicator used to analyze the evolution of a time series, removing transient fluctuations in order to highlight longer-term trends. It is called a moving average because it is recalculated continuously, using a subset of elements in which a new element replaces the oldest or is added to the subset.

There are several types, Kryll supports the following moving averages:

MA: The simple moving average is an unweighted moving average. This means that each day of the data set has the same importance and is equally weighted. At the end of each new day, the oldest data point is removed and the newest is added to the beginning.

WMA: The weighted moving average is similar to MA, except that it adds importance to more recent data points. Each point in the period is assigned a multiplier (the highest multiplier is assigned to the most recent data point and then decreases in order) that changes the weight or importance of that particular data point. Then, just like the SMA, as soon as a new data point is added at the beginning, the oldest data point is eliminated.

EMA: The exponential moving average is very similar to (and is a type of) the WMA. The main difference with EMA is that the old data points never leave the average. To clarify, old data points retain a multiplier (although it decreases to almost nothing) even if they are outside the length of the selected data series.

SMMA: The smoothed moving average compares recent prices to historical prices and ensures that they are weighted and considered equally. The calculation of this indicator does not refer to a specific or fixed time period, but rather uses all available data in the series for analysis. The smoothed moving average differs from the exponential moving average (EMA) in that it is generally used over a longer period.

To learn more we recommend the tutorials on ABCbourse, Investopedia and on Tradingview wiki.

Block configuration

In the block parameters you can configure your two moving averages by selecting the time units you want to study, the type and length of the two moving averages, the type of analysis (crossover or position) and configure the gaps from which you want to validate the block to move on.

MA Crossover block parameters

Moving average type: Here you can specify the type of moving average you want to use: Simple (MA), Exponential (EMA), Weighted (WMA), Smoothed (SMMA).

Lengths: Specify here the length of your moving average. This is the number of candles that will be used for its calculation.

Time Unit: You can specify the Time Unit of the moving average on which you want the block to operate (ranging from minutes to months).

Source: Specify here the source of the candle data among the different options.

- Closing: Instantaneous value when the candle is closed.  
- Opening: Instantaneous value when the candle opens
- Highest: Highest value of a candle - Lowest: Lowest value of a candle
- hl2: Average between highest and lowest value of a candle
- hlc3: Average between highest, lowest and closing
- ohlc4: Average between opening, highest, lowest and closing

This area allows you to select the condition that will trigger the block. Here you specify which signal you want to use and you can choose between :

  • Position trigger: the block is triggered when the "fast" moving average is above or below the "slow" moving average. These positions are called Bullish and Bearish
  • Triggering on Crossing: The block is triggered when the "fast" moving average crosses, in a certain direction, from one side to the other of the "slow" moving average.  These crosses are called Golden Cross and Death Cross.

In the case of a Crossover, an additional option is available: taking into account the past. This option allows you to take into account (or not) the previous candles for the validation of the block when it is initialized.

Example: Suppose you set up a block to detect an upside crossover in 1 hour, and the strategy arrives on this block at 5:30. Let's further assume that the signal occurs at the close of the candle (at 6am)
  • the block configured for 'Include the past' will be triggered because it detects a crossing between the 5 o'clock and the 6 o'clock candle.
  • the block configured for 'Ignore past' will not be triggered because it will wait for a cross only from the 6 o'clock candle and will ignore the past state of the indicator

In the case of the analysis between two curves (closing price and Supertrend in our case), Kryll provides by default a set of threshold tools to erase false signals

In the case of the analysis between two curves (fast average and slow average), Kryll provides by default a set of threshold tools to erase false signals.

Minimum threshold: This threshold allows you to define the minimum percentage above which the block will validate the crossing or the position. It is thus possible to erase the "false signals" which can appear in period of range, when the curves cross frequently on very small variations.

Maximum threshold: This threshold allows you to define the maximum percentage beyond which the block will no longer validate the crossing or the position. It is thus possible to avoid validating a condition on movements of extreme amplitudes or too late.

Behavior at initialization: Here you can define the behavior of the block at its initialization. You can either wait for the current candle to close (option "Wait for next close"), or instantly evaluate the block conditions on the last closed candle (option "Evaluate immediately"). This last option is particularly useful to perform analysis on several time units in parallel or to analyze an indicator on a macroscopic time unit (12H / Daily / Weekly...) without blocking the strategy by waiting for a candle to close.


Feel free to join us on our Telegram and Discord groups as well as our other social networks to share your opinion and your feedback on the Kryll.io platform.

Kryll.io

Happy Trading,

Website : https://kryll.io
Twitter : @Kryll.io
Telegram EN : https://t.me/kryll_io
Telegram FR: https://t.me/kryll_fr
Telegram ES: https://t.me/kryll_es
Discord : https://discord.gg/PDcHd8K
Facebook : https://www.facebook.com/kryll.io
Support : support@kryll.io

Author image

About MonsieurK

Is there a POAP for everything ?