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

Buy method conditions

A buy order is allowed when the EMA spread decreases and slow EMA is above fast EMA. Additionally the spread must be at least as big as emaspread %.

Sell method conditions

A sell order is allowed when the EMA spread decreases and fast EMA is above slow EMA. Additionally the spread must be at least as big as emaspread %

:::Info Gain protection is optional for this strategy.

Be aware that this can lead to sell orders below your break-even point. :::

Trading example

Example of how trading with this strategy can perform. Details and settings.

The infographic below describes what triggers trades with this strategy.

Strategy settings for EMA spread

Buy settings

LabelConfig ParameterDefault ValueDetailed Description
Buy enabledBUY_ENABLEDtrueEnables the execution of buy or long orders. When enabled, the strategy can initiate buy orders.

Sell settings

LabelConfig ParameterDefault ValueDetailed Description
Sell enabledSELL_ENABLEDtrueEnables the execution of sell or short orders. When enabled, the strategy can initiate sell orders.
Double check gainDOUBLE_CHECK_GAINtrueVerifies that a positive gain has been achieved before allowing a sell order. Disabling this option permits the strategy to execute sell orders at a loss, based on other indicators’ signals.
GainGAIN1Defines the gain target above the break-even point that you aim to achieve before selling.
Count sellCOUNT_SELL9999Disables a trading pair after reaching a specified number of sell orders since the pair was added. This parameter is used to limit exposure to frequently traded pairs and prevent overtrading.

Indicators

LabelConfig ParameterDefault ValueDetailed Description
PeriodPERIOD15 minutesThe period defines the duration of candlesticks in minutes used for calculating the indicators. It's important to select a value that is supported by your exchange to ensure accurate data.
EMAxEMAx0.5%Sets the minimum percentage difference required between the fast and medium Exponential Moving Averages (EMAs) to consider it significant for the EMASPREAD strategy.
Medium EMAEMA116Specifies the number of candles used to calculate the medium Exponential Moving Average (EMA), which is crucial for smoothing out price data over a specified period.
Fast EMAEMA28Specifies the number of candles used to calculate the fast Exponential Moving Average (EMA), allowing for quicker response to price changes in your trading strategy.

Overview of effects on different order types

Config ParameterAffected Order TypesNot Affected Order Types
Buy EnabledStrategy buy, DCA buy, RT buy, RT buybackStrategy sell, Stop limit, Close, RT sell
Buy LevelStrategy buyStrategy sell, Stop limit, Close, RT sell, DCA buy, RT buy, RT buyback
Sell EnabledStrategy sell, Stop limit, RT sellStrategy buy, RT buy, RT buyback, Close, DCA buy
GainStrategy sellStrategy buy, RT buy, RT buyback, RT sell, Close, DCA buy, Stop limit
PeriodStrategy sell, Strategy buy, DCA buy (when using an indicator)RT buy, RT buyback, RT sell, Close, Stop limit
Slow EMA (EMA1)Strategy buyRT buy, RT buyback, RT sell, Close, Stop limit, Strategy sell, DCA buy
Medium EMA (EMA2)Strategy buyRT buy, RT buyback, RT sell, Close, Stop limit, Strategy sell, DCA buy
EMAxStrategy sell, Strategy buyRT buy, RT buyback, RT sell, Close, Stop limit, DCA buy