OPEN-SOURCE SCRIPT

Configurable EMA Stack Strategy

847
This strategy uses a configurable exponential moving average (EMA) stack to define directional bias and an EMA cross to manage entries and exits.

The script calculates six user-defined EMAs (EMA 1 through EMA 6). Each EMA can be shown or hidden on the chart independently, and each can also be included or excluded from the bias filter. When multiple EMAs are enabled for bias, the script requires them to be strictly aligned in sequence:

Bullish bias: shorter enabled EMAs must be above longer enabled EMAs

Bearish bias: shorter enabled EMAs must be below longer enabled EMAs

Trade execution is driven by the EMA 1 / EMA 2 cross:

Long entries occur when bullish bias is active and EMA 1 crosses above EMA 2, or when bullish bias becomes active while EMA 1 is already above EMA 2

Short entries occur when bearish bias is active and EMA 1 crosses below EMA 2, or when bearish bias becomes active while EMA 1 is already below EMA 2

Long exits occur when EMA 1 crosses below EMA 2

Short exits occur when EMA 1 crosses above EMA 2

Default script settings use 0.10% commission and 1 tick of slippage. These are baseline placeholders for testing and should be adjusted to match the instrument, market, and timeframe being evaluated.

This is a simple, transparent trend-following baseline designed for testing EMA alignment behavior across different symbols and timeframes. The main configurable element is not a proprietary signal model, but the ability to control which EMAs participate in the bias stack and which EMA plots are visible on the chart. That makes it useful as a flexible template for studying how stricter or looser EMA alignment changes trade frequency and behavior.

Default strategy properties currently include commission and slippage. Those settings should be reviewed and adjusted to fit the market being tested. TradingView’s strategy rules require realistic cost assumptions, and if you change the defaults used in the script, the publication description should match the settings shown in your published backtest.

Important notes:

This is not presented as a complete trading system or a promise of performance

Results will vary by symbol, timeframe, market conditions, fees, slippage, and position sizing

This script is intended as an educational and analytical baseline that users can test and adapt to their own process

Thông báo miễn trừ trách nhiệm

Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.