# Moving Average Blocks — How they work (Part 2)

### MAs blocks tutorial — Second part

Welcome back! On this second guide on Moving Averages, we will explain how each MA block works in Kryll.io. We will only discuss the basic functionalities with very simple examples, then it’s up to you to read the third part or try it out by yourself!

## Let’s begin!

For the sake of this tutorial, we’re going to use several simplifications, so here is a lexicon:
MA = Moving Average
SMA = Simple Moving Average
EMA = Exponential Moving Average
WMA = Weighted Moving Average
SMMA = Smoothed Moving Average
L = Number of candles (Length)
xMA = The kind of MA you selected.

The threshold is a conditional block that is triggered whenever the price is above or below the xMA(L) depending on which trigger you chose.

Parameters:

MA type : SMA, EMA, WMA, SMMA.
Analysis Period : The period that xMA will take into account (If you choose 4H, xMA will use 4H candles).
Length : Number of candles calculated.
Price Position : Above or Below.
Deviation Threshold : The minimum Percentage at which the price needs to be compared to the xMA to trigger the block.
Source choice : You can choose the source to calculate the MA on Low, High, Close or Open candle. More info about the use of High/Low source here

### USE CASE

In the following example, we are gonna BUY 100% when the price is 4 % above the EMA(9)4H and SELL 100% when the price is at least 4% below SMA(9)4H.

As you can see, we bought when the price was 4% above the SMA(9) and our sell triggered when the price was 4% below the SMA(9).

This block is a conditional block that is triggered when the trend on the period that you set is validated. For example, if you choose to trigger the block when there is a uptrend validation of 10 candles, the value of (xMA(L))(Current time) must be higher than the value of (xMA(L))(Current time-1) 10 times in a row. We know our example can be difficult to understand so here’s a graph.

Parameters:

MA type : SMA, EMA, WMA, SMMA.
Analysis Period : The period that xMA will take into account (If you choose 4H, xMA will use 4H candles).
Length : Number of candles calculated.
Trend type : Type of trend you want to identify, either Uptrend or Downtrend.
Trend Confirmations : Number of confirmations required to validate the uptrend or Downtrend.
Source choice : You can choose the source to calculate the MA on Low, High, Close or Open candle. More info about the use of High/Low source here

### USE CASE

In the following example, the strategy is gonna trigger a block whenever there is at least 10 confirmations to a trend. That way our block is getting triggered as long as xMA is situated between the 2 lines.

This block is a conditional block that is triggered whenever the price is crossing an xMA or whenever the price is approaching an xMA based on which parameters you chose.

Parameters:

MA type : SMA, EMA, WMA, SMMA.
Analysis Period : The period that xMA will take into account (If you choose 4H, xMA will use 4H candles).
Length : Number of candles calculated.
Analyzed Level : You can choose between Resistance (Above the price) and Support (Under the price)
Signal Type : Wether you want the block to be triggered when the price Tests the Resistance / Support, when it Breaks the Resistance / Support, or when it Rejects the Resistance / Support.
Zone : Minimum percentage to validate the Test/break/Rejection.
Source choice : You can choose the source to calculate the MA on Low, High, Close or Open candle. More info about the use of High/Low source here

### Moving Averages Support/Resistance/Rejection Behavior

This block is a conditional block that is triggered depending on the behavior of two differents xMA.

Parameters:

Fast MA type : SMA, EMA, WMA, SMMA. This xMA will be the one with the shorter period.
Fast MA Period : The period that xMA will take into account (If you choose 4H, xMA will use 4H candles).
Fast MA Length : Number of candles calculated.
Slow MA type : SMA, EMA, WMA, SMMA. This xMA will be the one with the longer period.
Slow MA Period : The period that xMA will take into account (If you choose 4H, xMA will use 4H candles).
Slow MA Length : Number of candles calculated (it must be higher than the Length of the Fast MA Length).
Trigger Type : Position or Crossover.
— Position : Depends on the current position of the Fast xMA compared to the Slow xMA, the position is either Bullish (Fast xMA is above the Slow xMA) or Bearish (Fast xMA is below the Slow xMA).
— Crossover : Is triggered when the Fast xMA crosses the Slow xMA. The cross is either Bullis (Fast xMA crosses the Slow xMA and is now above the Slow xMA) or Bearish (Fast xMA crosses the Slow xMA and is now below the Slow xMA).
Signal type : Either Bearish or Bullish (see above for further explanation)
Source choice : You can choose the source to calculate the MA on Low, High, Close or Open candle. More info about the use of High/Low source here

### USE CASE

Here’s a graph example on when and why the golden/death cross is triggered.

Here are two graphs that explain when the position bearish or bullish is triggered.

## Conclusion

As you can see on all the previous graphics, MAs are often “late” on what’s happening, and this is because it’s an average over a rather long period of time. Even if EMA and WMA put much more weight on the last candles, you need to keep this information in mind when designing strategies using MAs!

As MAs are based on pure mathematics, it is interesting to study them thoroughly in order to understand how they work, so do not hesitate to try and retry by backtesting on Kryll.io! However they are not always suitable for buy and sell triggers, so use them with caution and try to combine them with other analysis blocks.

### Here are some resources to get started with the Kryll platform :

Part 1: Basic tutorial for Kryll
Part 2 : Basic strategies and explanations
Part 4 : How to make the best out of Kryll.io
Bonus : 3 Free Kryll.io homemade Strategies !

See you on the platform ❤ https://platform.kryll.io

Be sure to follow us on all our social networks.
Our website: https://kryll.io
Telegram : https://t.me/kryll_io
Discord: https://discord.gg/PDcHd8K 