Skip to main content

SMA cross

Gunbot uses a method that relies on Simple Moving Average (SMA) to determine when to buy and sell. This method works by identifying when prices begin to rise, as indicated by the fast SMA crossing over the slow SMA. Buying occurs at this point. On the other hand, selling takes place once the fast SMA crosses below the slow SMA.

Simple Moving Average (SMA) is a technical analysis indicator used to identify market trends. It calculates the average price of a security over a specified time period by summing up the closing prices and dividing the result by the number of periods. The result is a smooth line that indicates whether the market is trending upwards or downwards.

The method used by Gunbot leverages the crossover of two SMA lines to signal potential buying and selling opportunities. A "fast" SMA line is calculated based on a shorter time period, while a "slow" SMA line is calculated based on a longer time period. When the fast SMA crosses above the slow SMA, it indicates that the trend may be shifting upwards, and buying may be beneficial. Conversely, when the fast SMA crosses below the slow SMA, it indicates that the trend may be shifting downwards, and selling may be necessary. This method can help traders make more informed decisions based on market trends.

How to work with it​

Buy method conditions​

A buy order is allowed when the fast SMA line crosses over the slow SMA 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 buy order is allowed when the fast SMA line crosses below the slow SMA 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​

SMA Cross strategy example showing trading performance based on moving average crossovers

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

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_ENABLEDtrueThis setting allows you to enable or disable buy or long orders within the strategy. When enabled, the strategy can execute buy orders as dictated by its conditions.
Single buySINGLE_BUYfalseEnabling this setting restricts the strategy to execute only one buy order. This can be useful if you prefer to limit your exposure to a single transaction at a time.

Sell settings​

LabelConfig ParameterDefault ValueDetailed Description
Sell enabledSELL_ENABLEDtrueThis setting enables or disables the ability to make sell or short orders. When enabled, it allows the strategy to initiate sales according to its programmed conditions.
Double check gainDOUBLE_CHECK_GAINtrueThis setting ensures that a position has achieved a positive gain before it is sold. Disable this to allow the strategy's indicators to initiate a sale even at a loss, based on their assessments.
GainGAIN1The target gain above break-even, set as a percentage. The default is set at 1%, with the ability to adjust between 0.1% to 5%. This setting helps to define the profit expectation before a sell order is executed.
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 anywhere from 1 to an effectively unlimited number (999999), with the default at 9999, allowing extensive trading before any restriction.

Indicators​

LabelConfig ParameterDefault ValueDetailed Description
PeriodPERIOD15 minutesThe period setting determines the size of the candlesticks used for indicator calculation. It's essential to choose a value supported by your exchange, with the default set at 15 minutes. This impacts how the strategy interprets market conditions and timing.
Slow SMASLOW_SMA20This setting defines the number of candles used to calculate the slow Simple Moving Average (SMA).
Fast SMAFAST_SMA10The number of candles used to calculate the fast Simple Moving Average (SMA) is set here.

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