Skip to main content

EMA spread (futures)

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.

Strategy settings for EMA spread (futures)

Long settings

LabelConfig ParameterDefault ValueDetailed Description
Buy enabledBUY_ENABLEDtrueThis setting allows you to enable or disable buy or long orders. When enabled, the strategy will execute buy orders as per its configuration.

Short settings

LabelConfig ParameterDefault ValueDetailed Description
Sell enabledSELL_ENABLEDtrueThis setting allows you to enable or disable sell or short orders. When enabled, the strategy will execute sell orders as per its configuration.

Indicators

LabelConfig ParameterDefault ValueDetailed Description
PeriodPERIOD15The period setting determines the candlestick size used for indicator calculations, measured in minutes. Ensure the selected value is supported by your exchange.
EMAxEMAx0.5This setting defines the minimum percentage difference between the fast and medium Exponential Moving Averages (EMAs) necessary for the EMASPREAD strategy to activate. For example, a value of 0.5% indicates that the fast EMA must be at least 0.5% different from the medium EMA for a trade signal.
Medium EMAEMA116This parameter sets the number of candles used to calculate the medium Exponential Moving Average (EMA), providing a basis for the indicator's slower moving average.
Fast EMAEMA28This parameter sets the number of candles used to calculate the fast Exponential Moving Average (EMA), which is used to generate quicker, more responsive trading signals compared to the medium EMA.