Skip to main content

EMA spread

Gunbot uses the Exponential Moving Average (EMA) to implement a method that aims to buy at the start of an uptrend and sell when prices begin to move down. This is achieved by monitoring the spread between fast and slow EMAs, with buying occurring when the spread starts decreasing and selling taking place when the spread decreases again as prices decline.

The spread is calculated each cycle by subtracting the lowest EMA value from the highest EMA. In addition to this core indicator, other tools can be used to refine the buying and selling signals. For example, you may choose to use the Relative Strength Index (RSI) as a confirmation signal

Spread calculation

The spread is calculated each cycle by subtracting the lowest EMA value from the highest EMA.

How to work with it

This page explains how futures trading operates with the emaspread method. The triggers for trades differ slightly from those used in spot trading.

Gunbot opens a single position, either long or short, and closes it when the target is met. If the stop is triggered before closing the trade at a profit, Gunbot will place a stop order at a loss. After closing a position, Gunbot will seek to open a new long or short position.

Buy method conditions

A long position is allowed when fast EMA is below slow EMA and the spread decreases.

Sell method conditions

A short position is allowed when fast EMA is above slow EMA and the spread decreases.

Conditions to close

A position is closed when the desired ROE is reached.

Conditions to stop

A position is closed at loss when negative ROE reaches the STOP_LIMIT target.

Long settings

Buy settings are the primary trigger for long orders. These parameters control the execution of long orders when using emaspread as buy method.

Buy enabled

Set this to false to prevent Gunbot from opening long positions.


Short settings

Buy settings are the primary trigger for short orders. These parameters control the execution of short orders when using emaspread as sell method.

Sell enabled

Set this to false to prevent Gunbot from opening short positions.


Indicator settings

Relevant indicators for trading with EMA spread

These settings have a direct effect on trading with emaspread.

Period

This sets the candlestick period used for trading, this affects all indicators within the strategy.

Only use supported values. The trading settings editor suggests valid values for the selected exchange..

Setting a short period allows you to trade on shorter trends, but be aware that these will be noisier than longer periods.


Slow EMA

Set this to the amount of candlesticks you want to use for your slow EMA. The closing price for each candle is used in the slow EMA calculation.

For example: when you set PERIOD to 5, and want to use 2h for slow EMA – you need to set EMA1 to 24 (24 * 5 mins).


Medium EMA

Set this to the amount of candlesticks you want to use for your medium EMA. The closing price for each candle is used in the fast EMA calculation.

For example: when you set PERIOD to 5, and want to use 1h for medium EMA – you need to set EMA2 to 12 (12 * 5 mins).


EMAx

Sets the minimum percentage difference between slow and fast EMA for emaspread.

When set to 1, the spread must reach at least 1% before emaspread can trigger a buy or sell.