Skip to main content

SMA Cross

Gunbot’s SMA Cross method uses two Simple Moving Averages to signal buys and sells. A buy is allowed when the fast SMA crosses above the slow SMA, and a sell is allowed when the fast SMA crosses below the slow SMA.

Info

A Simple Moving Average (SMA) is a technical analysis indicator that calculates the average price of an asset over a specific number of periods. It helps to smooth out price data to identify the direction of the market trend.

The method uses a short-period "fast" SMA and a longer-period "slow" SMA to detect trend shifts.

How to Work With It

Buy Method Conditions

A buy order is allowed when the fast SMA crosses above the slow SMA.

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 fast SMA crosses below the slow SMA.

info

Gain protection is optional for this strategy. Disabling it can lead to sell orders below your break-even point.

Trading Example

SMA Cross strategy example showing trading performance based on moving average 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.

SMA Cross strategy diagram illustrating buy and sell triggers based on SMA crossings

Strategy Settings for SMACross

Buy Settings

LabelConfig ParameterDefault ValueDetailed Description
Buy EnabledBUY_ENABLEDtrueEnables or disables buy or long orders within the strategy.
Single BuySINGLE_BUYfalseRestricts the strategy to execute only one buy order at a time.

Sell Settings

LabelConfig ParameterDefault ValueDetailed Description
Sell EnabledSELL_ENABLEDtrueEnables or disables the ability to make sell or short orders.
Double Check GainDOUBLE_CHECK_GAINtrueEnsures that a position has achieved a positive gain before it is sold. Disable this to allow a sale even at a loss.
GainGAIN1The target gain above break-even, set as a percentage. The default is 1%, and it can be adjusted between 0.1% and 5%.
Count SellCOUNT_SELL9999Specifies the maximum number of sell orders that can be executed for a pair before the pair is disabled. This can be set from 1 to 999999, with the default at 9999.

Indicators

LabelConfig ParameterDefault ValueDetailed Description
PeriodPERIOD15 minutesDetermines the candlestick size used for indicator calculation. Choose a value supported by your exchange. Default is 15 minutes.
Slow SMASLOW_SMA20Defines the number of candles used to calculate the slow Simple Moving Average (SMA).
Fast SMAFAST_SMA10Defines the number of candles used to calculate the fast Simple Moving Average (SMA).

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 (trigger)RT buy, RT buyback, RT sell, Close, Stop limit
Slow SMAStrategy sell, Strategy buyRT buy, RT buyback, RT sell, Close, Stop limit, DCA buy
Fast SMAStrategy sell, Strategy buyRT buy, RT buyback, RT sell, Close, Stop limit, DCA buy