Moving Average Band Strategy by ravi_matrix

By ravi_matrix

Performance Metrics

Description

OverviewThe Moving Average Band Strategy is a fully customizable breakout and trend-continuation system designed for traders who need both simplicity and control.The strategy creates adaptive bands around a user-selected moving average and executes trades when price breaks out of these bands, with advanced risk-management settings including optional Risk:Reward targets.This script is suitable for intraday, swing, and positional traders across all markets — equities, futures, crypto, and forex.Key Features✔ Six Moving Average TypesChoose the MA that best matches your trading style:SMAEMAWMAHMAVWMARMA✔ Dynamic BandsUpper Band built from MA of highsLower Band built from MA of lowsAdjustable band offset (%)Color-coded band fill indicating price position✔ Configurable Strategy PreferencesToggle Long and/or Short tradesToggle Risk:Reward Take-ProfitAdjustable Risk:Reward RatioDefault position sizing: % of equity (configurable via strategy settings)Entry ConditionsLong EntryA long trade triggers when:Price crosses above the Upper BandLong trades are enabledNo existing long position is activeShort EntryA short trade triggers when:Price crosses below the Lower BandShort trades are enabledNo existing short position is activeClear entry markers and price labels appear on the chart. Risk ManagementThis strategy includes a complete set of risk-controls:Stop-Loss (Fixed at Entry)Long SL: Lower BandShort SL: Upper BandThese levels remain constant for the entire trade.Optional Risk:Reward Take-ProfitEnabled/disabled using a toggle switch.When enabled:Long TP = Entry + (Risk × Risk:Reward Ratio)Short TP = Entry – (Risk × Risk:Reward Ratio)When disabled:Exits are handled by reverse crossover signals.Exit ConditionsLong ExitStop-Loss Hit (touch-based)Take-Profit Hit (if enabled)Reverse Band Crossover (if TP disabled)Short ExitStop-Loss Hit (touch-based)Take-Profit Hit (if enabled)Reverse Band Crossover (if TP disabled)Exit markers and price labels are plotted automatically.Visual ToolsTo improve clarity:Upper & Lower Band (blue, adjustable width)Middle LineDynamic band fill (green/red/yellow)SL & TP line plotting when in positionEntry/Exit markersPrice labels for all executed tradesThese are built to help users visually follow the strategy logic.Alerts IncludedEvery trading event is covered:Long EntryShort EntryLong SL / TP / Cross ExitShort SL / TP / Cross ExitCombined Alert for webhook/automation (JSON-formatted)Perfect for algo trading, Discord bots, or automation platforms.Best ForThis strategy performs best in:Trending marketsBreakout environmentsHigh-momentum instrumentsClean intraday swingsWorks seamlessly on:StocksIndex futuresCommoditiesCryptoForex⚠️ Important DisclaimerThis script is for educational purposes only.Trading involves risk. Backtest results are not indicative of future performance.Always validate settings and use proper position sizing.

Browse all 5,900+ TradingView Pine Script strategies

View on TradingView