OPEN-SOURCE SCRIPT
Moving Average Strategy

MA Crossover Strategy - Smarter Entries, Cleaner Trends
This strategy is built around moving averages, but with added flexibility so you can trade the way that feels right for you. Whether you prefer quick crossovers or want full candle confirmation before entering, this setup adjusts to your style.
What This Strategy Does
It looks at how price interacts with a moving average (MA) and lets you choose how strict you want your entries to be.
Multiple Moving Averages to Choose From
Pick the MA type that suits your trading personality:
SMA – Simple and classic
EMA – Smooth and responsive (default)
WMA – Gives more weight to recent data
HMA – Super smooth with less lag
VWMA – Considers volume
RMA – Stable and less jumpy
Two Ways to Enter Trades
1. Crossover Mode (Fast & Responsive)
Enter the moment price crosses the MA:
Long: Price crosses above
Short: Price crosses below
Quick entries - ideal when markets are trending well.
2. Full Candle Confirmation (More Accurate, Less Noise)
Instead of rushing in, you wait for the entire candle to confirm:
Long: Candle OHLC - all above MA
Short: Entire candle stays below MA
This reduces false breakouts and whipsaws, especially in choppy markets.
Optional Trend Filter (Trade With the Larger Trend)
You can add a second, longer MA to make sure you’re trading with the bigger trend.
Long trades only: When short MA > long MA
Short trades only: When short MA < long MA
Turn it on when the market gets noisy. Turn it off when price is clean and trending.
Fully Customizable Settings
Main MA: 40 EMA (default)
Trend Filter MA: 70 EMA
Enable/disable long or short trades
Enable/disable Trend Filter
Switch MA lengths & types anytime
Choose between crossover or confirmed candles
It adapts to intraday, swing, or positional trading.
Clean Exit Rules
All trades exit when an opposite crossover happens.
Simple. Rule-based. Zero overthinking.
Visual Clarity Built-In
Main MA turns green when price is above
Turns red when price is below
Trend filter MA appears in blue when active
Your chart becomes easier to read at a glance.
Best Used In:
Trending markets
Swing or positional setups
When you want cleaner signals and fewer fake breakouts
Full candle confirmation helps especially during sideways periods.
The Logic Behind the Strategy
It blends classic price–MA crossovers with extra optional filters so you get:
Faster entries when you want them
Stronger confirmation when you need safety
Trend alignment for higher probability trades
In simple words:
You catch big moves while avoiding unnecessary noise.
This strategy is built around moving averages, but with added flexibility so you can trade the way that feels right for you. Whether you prefer quick crossovers or want full candle confirmation before entering, this setup adjusts to your style.
What This Strategy Does
It looks at how price interacts with a moving average (MA) and lets you choose how strict you want your entries to be.
Multiple Moving Averages to Choose From
Pick the MA type that suits your trading personality:
SMA – Simple and classic
EMA – Smooth and responsive (default)
WMA – Gives more weight to recent data
HMA – Super smooth with less lag
VWMA – Considers volume
RMA – Stable and less jumpy
Two Ways to Enter Trades
1. Crossover Mode (Fast & Responsive)
Enter the moment price crosses the MA:
Long: Price crosses above
Short: Price crosses below
Quick entries - ideal when markets are trending well.
2. Full Candle Confirmation (More Accurate, Less Noise)
Instead of rushing in, you wait for the entire candle to confirm:
Long: Candle OHLC - all above MA
Short: Entire candle stays below MA
This reduces false breakouts and whipsaws, especially in choppy markets.
Optional Trend Filter (Trade With the Larger Trend)
You can add a second, longer MA to make sure you’re trading with the bigger trend.
Long trades only: When short MA > long MA
Short trades only: When short MA < long MA
Turn it on when the market gets noisy. Turn it off when price is clean and trending.
Fully Customizable Settings
Main MA: 40 EMA (default)
Trend Filter MA: 70 EMA
Enable/disable long or short trades
Enable/disable Trend Filter
Switch MA lengths & types anytime
Choose between crossover or confirmed candles
It adapts to intraday, swing, or positional trading.
Clean Exit Rules
All trades exit when an opposite crossover happens.
Simple. Rule-based. Zero overthinking.
Visual Clarity Built-In
Main MA turns green when price is above
Turns red when price is below
Trend filter MA appears in blue when active
Your chart becomes easier to read at a glance.
Best Used In:
Trending markets
Swing or positional setups
When you want cleaner signals and fewer fake breakouts
Full candle confirmation helps especially during sideways periods.
The Logic Behind the Strategy
It blends classic price–MA crossovers with extra optional filters so you get:
Faster entries when you want them
Stronger confirmation when you need safety
Trend alignment for higher probability trades
In simple words:
You catch big moves while avoiding unnecessary noise.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.