Cross EMA Trading System

Cross EMA Trading System buys a fresh crossover of two short EMAs when price confirms the move above the fast EMA. Optional trend, RSI, and stochastic filters can make that basic “green arrow” more selective.
The normal technical exit is deliberately slower: a bearish short-EMA cross must be accompanied by price moving below a separate exit EMA. An optional fixed target and protective stop provide more direct exit boundaries.
warning
Protection is disabled by default. The EMA technical exit only acts at a fee-aware break-even price or better, so enable protection if the strategy must close losing positions.
Entry signal
The entry pair is controlled by CEMA_EMA_FAST and CEMA_EMA_MID. A buy signal starts when the fast EMA crosses from at or below the middle EMA to above it.
Price must also confirm above the fast EMA. With CEMA_REQUIRE_FULL_CANDLE enabled, the candle’s low must be above that EMA: the entire candle, including its wick, has cleared the line. When disabled, only the close must be above it.
Full-candle confirmation is stricter and often later, but it rejects crosses where price still overlaps the fast EMA. The strategy opens one position at a time and does not average down.
Trend filter
Enable CEMA_USE_TREND_FILTER to require:
- close above
CEMA_EMA_TREND; - both entry EMAs above
CEMA_EMA_EXIT.
This asks the crossover to occur inside a broader bullish structure rather than during an isolated bounce. Keep the lengths ordered from shortest to longest:
CEMA_EMA_FAST < CEMA_EMA_MID < CEMA_EMA_EXIT < CEMA_EMA_TREND
The strategy enforces that ordering if the configured values overlap.
Optional RSI and stochastic filters
Enable CEMA_USE_RSI_FILTER to require RSI from CEMA_RSI_LENGTH to be at or above CEMA_RSI_BUY_LEVEL. Raising the buy level requires stronger momentum.
Enable CEMA_USE_STOCH_FILTER to require stochastic K to be at or above D. The oscillator uses CEMA_STOCH_K, CEMA_STOCH_K_SMOOTH, and CEMA_STOCH_D.
This is directional confirmation, not a fresh stochastic crossover and not an oversold test. The filter can therefore approve an entry after momentum has already advanced considerably.
The corresponding sell levels help identify a mirrored bearish setup in the strategy’s status, but the normal spot exit is the EMA rule described below.
EMA exit
A technical exit needs:
- the fast EMA to cross below the middle EMA;
- price to be below
CEMA_EMA_EXIT.
With full-candle confirmation enabled, the candle’s high must be below the exit EMA. Otherwise its close is sufficient.
This exit only executes at fee-aware break-even or better. It can protect profit during a rollover, but it is not a stop-loss.
Target and protective stop
Enable CEMA_USE_TARGET to place a target CEMA_TARGET_PCT above average buy price. The target is raised when necessary to cover estimated round-trip fees and CEMA_MIN_NET_GAIN_PCT.
Enable CEMA_USE_PROTECTION to activate a stop CEMA_STOP_PCT below average buy price. Unlike the technical exit, this stop can realize a loss.
During a backtest, if the same candle touches both target and stop, the strategy gives the protective stop precedence. This avoids assuming the favorable intrabar path.
ZigZag-style display levels
CEMA_ZIGZAG_LOOKBACK and CEMA_ZIGZAG_DEVIATION_PCT calculate a recent swing-high and swing-low range for status information.
These settings do not filter entries, set the stop, or set the target in the current strategy. Changing them changes the displayed swing context only. This can still help you compare EMA signals with visible market structure, but it should not be treated as a trade control.
Entry safeguards
CEMA_MAX_SPREAD_PCT sets a relative spread ceiling. CEMA_MAX_SPREAD_ABSOLUTE adds an optional price-difference ceiling expressed in USDT for USDT-BTC; 0 disables it.
CEMA_NEWS_BLOCK and CEMA_NEWS_BLOCK_UNTIL manually block new entries without interfering with position management. They do not connect to a news service.
CEMA_COOLDOWN_MS spaces live actions apart. It does not add a matching delay to backtests.
Good market conditions
Cross EMA Trading System generally works best when:
- the pair is liquid and spread is stable;
- price emerges from a pullback or consolidation;
- the fast and middle EMA cross with a decisive candle above them;
- the exit and trend EMAs already slope or stack constructively;
- normal movement leaves room for the target after fees.
A strong default-style setup is a pullback within a broader uptrend, followed by a short-EMA cross and a candle completely above the fast EMA. Optional RSI or stochastic confirmation can help reject weak crosses.
Avoid flat, noisy ranges where short EMAs repeatedly cross. Full-candle confirmation can reduce that churn, but it cannot turn an unstructured market into a trend.
Creating the strategy
Create a spot strategy and choose Cross EMA Trading System as the buy and sell method. Begin with backtesting or paper trading on the default 15-minute period.
A practical sequence is:
- Keep the default EMA ordering.
- Compare close-only and full-candle confirmation.
- Test the trend filter before enabling extra momentum filters.
- Add RSI or stochastic only when it removes identifiable weak entries.
- Choose whether the EMA exit is enough or a target is also useful.
- Enable and test protection if defined downside is required.
- Review results across trends, ranges, and spread expansion.
Strategy settings
Trading and execution
| Setting | Description |
|---|---|
BUY_ENABLED | Enables new buy orders. |
SELL_ENABLED | Enables technical, target, and protective sells. |
PERIOD | Candle period used by all indicators; default 15 minutes. |
TRADING_LIMIT | Compatibility fallback only. It is ignored while the strategy-specific trading limit contains a positive value. Configure the strategy-specific setting for normal use. For USDT-BTC, this value is in USDT. |
CEMA_TRADING_LIMIT | For USDT-BTC, the amount of USDT used for an entry. |
FUNDS_RESERVE | For USDT-BTC, the amount of USDT the bot must leave unused. |
KEEP_QUOTE | For USDT-BTC, the amount of BTC the strategy must not sell. |
MIN_VOLUME_TO_BUY | General minimum buy value. For USDT-BTC, this value is in USDT. |
MIN_VOLUME_TO_SELL | General minimum sell value. For USDT-BTC, this value is in USDT. |
CEMA_MIN_ORDER_VALUE | Strategy-specific minimum entry value. For USDT-BTC, this value is in USDT. |
CEMA_MIN_SELL_VALUE | Strategy-specific minimum exit value. For USDT-BTC, this value is in USDT. |
GAIN | General gain fallback retained in the configuration. |
CEMA_COOLDOWN_MS | Minimum delay in milliseconds between live actions. |
CEMA_MAX_SPREAD_PCT | Maximum permitted relative spread. |
CEMA_MAX_SPREAD_ABSOLUTE | Optional absolute spread ceiling; 0 disables it. For USDT-BTC, this value is in USDT. |
CEMA_NEWS_BLOCK | Manually blocks new entries. |
CEMA_NEWS_BLOCK_UNTIL | Blocks new entries until the configured time. |
EMA signal
| Setting | Description |
|---|---|
CEMA_EMA_FAST | Fast entry EMA length. |
CEMA_EMA_MID | Slower entry EMA length crossed by the fast EMA. |
CEMA_EMA_EXIT | EMA that price must clear for the technical exit and trend filter. |
CEMA_EMA_TREND | Long EMA used by the optional broader trend filter. |
CEMA_REQUIRE_FULL_CANDLE | Requires the entire candle to clear the relevant EMA instead of its close only. |
CEMA_USE_TREND_FILTER | Requires price and the entry EMAs to be in bullish broader alignment. |
Momentum filters
| Setting | Description |
|---|---|
CEMA_RSI_LENGTH | RSI calculation length. |
CEMA_USE_RSI_FILTER | Enables RSI confirmation. |
CEMA_RSI_BUY_LEVEL | Minimum RSI for a long entry when the filter is enabled. |
CEMA_RSI_SELL_LEVEL | Maximum RSI used for mirrored bearish status confirmation. |
CEMA_STOCH_K | Base stochastic K lookback. |
CEMA_STOCH_K_SMOOTH | Smoothing applied to K. |
CEMA_STOCH_D | Stochastic D smoothing length. |
CEMA_USE_STOCH_FILTER | Requires K at or above D for buys. |
Swing display and exits
| Setting | Description |
|---|---|
CEMA_ZIGZAG_LOOKBACK | Candles used for the displayed recent swing range. |
CEMA_ZIGZAG_DEVIATION_PCT | Minimum range size used to mark that displayed range as meaningful. |
CEMA_USE_PROTECTION | Activates the fixed loss-taking stop. |
CEMA_STOP_PCT | Protective-stop distance below average buy price. |
CEMA_USE_TARGET | Enables the fixed percentage target. |
CEMA_TARGET_PCT | Target distance above average buy price. |
CEMA_MIN_NET_GAIN_PCT | Intended gain beyond estimated round-trip fee break-even. |
Backtesting range
| Setting | Description |
|---|---|
BF_SINCE | Start of the selected backtesting period. |
BF_UNTIL | End of the selected backtesting period. |
DEEP_TESTING | Enables deeper backtesting mode in the editor. |
Practical tuning directions
If entries are too late, test close-only confirmation before shortening the EMAs. If they are too noisy, full-candle confirmation and the trend filter are usually clearer first adjustments.
Use RSI and stochastic filters independently at first. Enabling both can sharply reduce trades and may merely confirm the same momentum information twice.
Set the exit EMA far enough from price to avoid ordinary overlap, but not so slow that profitable reversals are recognized very late. Always test that decision together with full-candle mode.
Important limitations
- EMA crossovers lag price and can whipsaw in ranges.
- The stochastic filter checks K/D direction, not a fresh cross or oversold condition.
- Technical exits do not deliberately sell below fee-aware break-even.
- Protection and target are independent switches.
- ZigZag-style settings currently affect display context, not trade decisions.
- News blocking is manual.
- Backtests cannot perfectly reproduce live spread, slippage, latency, or liquidity.
Cross EMA Trading System is easiest to reason about when the short crossover starts the move and the longer EMAs describe the environment. Add filters only when each one solves a visible problem in your test results.