Skip to main content

MACD (futures)

This method uses the Moving Average Convergence Divergence (MACD) indicator to detect momentum shifts. The MACD is built from two exponential moving averages; a bullish signal occurs when the MACD line crosses above the signal line, and a bearish signal occurs when it crosses below.

How to work with it​

Gunbot opens one position, either long or short, and closes it when the target is reached. If the stop triggers before a profitable close, Gunbot places a stop order at a loss. After closing a position, Gunbot looks to open a new long or short position. Gunbot does not add to existing open positions.

Buy method conditions​

Opening a long position is allowed when MACD crosses up the signal line.

Sell method conditions​

Opening a short position is allowed when MACD crosses down the signal line.

Conditions to close​

Position is closed when the target ROE (return on equity) is reached. This is a percentage from the entry point, taking leverage into consideration.

Conditions to stop​

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

Strategy settings for MACD (futures)​

Long settings​

LabelConfig ParameterDefault ValueDetailed Description
Buy enabledBUY_ENABLEDtrueWhen enabled, the strategy can place buy or long orders when conditions are met.

Short settings​

LabelConfig ParameterDefault ValueDetailed Description
Sell enabledSELL_ENABLEDtrueWhen enabled, the strategy can place sell or short orders when conditions are met.

Indicators​

LabelConfig ParameterDefault ValueDetailed Description
PeriodPERIOD15The period setting defines the candlestick size, in minutes, used for indicator calculation. Select a value supported by your exchange to ensure accurate data.
MACD shortMACD_SHORT5The MACD short term setting specifies the number of candles used to calculate the short-term moving average for MACD. Lower values make the indicator more sensitive to recent price changes.
MACD longMACD_LONG20The MACD long term setting determines the number of candles used to calculate the long-term moving average for MACD. Higher values make the indicator less sensitive to recent price changes.
MACD signalMACD_SIGNAL10The MACD signal setting controls the number of candles used to calculate the MACD signal line, which triggers buy and sell signals when compared to the MACD line.