Moving Average Gap Block

MA threshold block - This block is a "conditional block" that is triggered when the price is above or below a moving average of a certain spread.

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 to the beginning, the oldest data point is discarded.

EMA: The exponential moving average is very similar to (and a type of) the WMA. The main difference with the 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 follow these tutorials Investopedia and Tradingview wiki.

Block configuration

In the parameters of the block you can select the type of average used, the unit of time you want to study, the length (the number of candles studied) of the moving average and configure the deviation from which you want to validate the block to go on.

The different options of the Spacing threshold block

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

Length: 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

Price position: the MA threshold block is triggered when the price is above or below the moving average. Here you can specify the conditions for the block to be activated.

Spread Threshold: This threshold allows you to define the minimum percentage above which the block will validate the position. It is thus possible to erase the "false signals" which can appear in period of range, when the price and the moving averages frequently intersect on small variations.

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.

Do not hesitate 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 platform.

Happy Trading,

Website :
Twitter :
Telegram EN :
Telegram FR:
ESTelegram :‌
Discord :
Facebook :
Support :

Author image

About MonsieurK

Is there a POAP for everything ?