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.

Info

An Exponential Moving Average (EMA) is a type of moving average that places a greater weight and significance on the most recent data points. This makes it more responsive to new information compared to a Simple Moving Average (SMA).

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 the slow EMA is above the fast EMA. Additionally, the spread must be at least as large as emaspread %.

Sell Method Conditions​

A sell order is allowed when the EMA spread decreases and the fast EMA is above the slow EMA. Additionally, the spread must be at least as large 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​

EMA Spread strategy example showing trading performance based on EMA crossovers

Example of how trading with this strategy can perform. See details and settings on TradingView.

The infographic below describes what triggers trades with this strategy.

EMA Spread strategy diagram illustrating buy and sell triggers based on EMA spreads

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.
EMASpread PercentageEMAx0.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