Skip to main content

MACD

This approach utilizes the MACD indicator, which identifies possible shifts in momentum by analyzing signals.

The Moving Average Convergence Divergence (MACD) is a technical indicator that helps traders determine potential changes in an asset's momentum. The indicator is based on the convergence and divergence of two exponential moving averages, typically a 12-period EMA and a 26-period EMA. Traders use the MACD to identify whether an asset is likely to experience a bullish or bearish trend, as well as potential trend reversals. When the MACD line crosses above the signal line, it is considered a buy signal, while a crossover below the signal line indicates a sell signal.

How to work with it​

Buy method conditions​

A buy order is allowed when the MACD line crosses up the signal line.

tip

Normal constraints like "buy once, sell once" don't apply to this strategy: each time buying criteria occur, Gunbot will place a buy order as high as set in your balance settings.

Sell method conditions​

A sell order is allowed when the MACD line crosses down the signal line.

info

Gain protection is optional for this strategy. Be aware that this can lead to sell orders below your break-even point.

Trading example​

MACD strategy example showing momentum-based trading performance

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

The infographic below describes what triggers trades with this strategy.

MACD strategy diagram illustrating crossover-based buy and sell signals

Strategy settings for MACD​

Buy settings​

LabelConfig ParameterDefault ValueDetailed Description
Buy enabledBUY_ENABLEDtrueEnables the ability to place buy or long orders. If enabled, you can initiate buy orders according to your strategy's criteria.
Single buySINGLE_BUYfalseLimits the strategy to only one buy order. This setting is useful if you want to restrict the strategy to a single transaction per criteria fulfillment.

Sell settings​

LabelConfig ParameterDefault ValueDetailed Description
Sell enabledSELL_ENABLEDtrueEnables the ability to place sell or short orders. If enabled, you can execute sell orders based on your strategy's indicators.
Double check gainDOUBLE_CHECK_GAINtrueEnsures that a positive gain is achieved before allowing a sell order. If disabled, the strategy can execute sell orders at a loss, based on other active indicators.
GainGAIN1Specifies the target gain above the break-even point, as a percentage. Set your desired gain level to manage profitability expectations.
Count sellCOUNT_SELL9999Limits the number of sell orders for a trading pair, potentially disabling the pair after reaching the specified count. Useful for controlling trading frequency and risk exposure.

The practical range is from 1 to 50 sell orders, although technically you can set this up to 999999.

Indicators​

LabelConfig ParameterDefault ValueDetailed Description
PeriodPERIOD15 minutesDefines the timeframe of the candlesticks used for indicator calculations. Ensure you choose a period that is supported by your exchange. The period is specified in minutes.
MACD shortMACD_SHORT5Determines the short-term moving average period for the MACD indicator. This setting influences how quickly the MACD responds to price changes.
MACD longMACD_LONG20Sets the long-term moving average period for the MACD indicator, affecting the indicator's sensitivity to longer-term price trends.

The range is adjustable.
MACD signalMACD_SIGNAL10Specifies the number of candles used to calculate the MACD signal line, which helps to identify potential buy or sell signals based on the MACD.

You can adjust this, with a standard setting of 10 candles for typical trading scenarios.

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
Single BuyStrategy 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
MACD ShortStrategy sell, Strategy buyRT buy, RT buyback, RT sell, Close, Stop limit, DCA buy
MACD LongStrategy sell, Strategy buyRT buy, RT buyback, RT sell, Close, Stop limit, DCA buy
MACD SignalStrategy sell, Strategy buyRT buy, RT buyback, RT sell, Close, Stop limit, DCA buy