Skip to main content

5 MA Pine Strategy

Overview

The 5 MA Pine Strategy is an advanced multi-moving-average trading system designed for traders who want complete flexibility in building their own trend-following strategy. Unlike traditional EMA crossover systems that are limited to two moving averages, this strategy allows traders to configure and combine up to five different moving averages, each with its own settings and calculation method. The strategy is fully compatible with Mirrorpip Automation, allowing users to execute trades automatically across supported exchanges directly from TradingView alerts.

Key Features

Up To 5 Configurable Moving Averages

The strategy supports five independent moving averages:
  • MA 1
  • MA 2
  • MA 3
  • MA 4
  • MA 5
Each moving average can be enabled or disabled individually based on your trading requirements. This allows traders to build:
  • 2 Moving Average Strategies
  • 3 Moving Average Strategies
  • 4 Moving Average Strategies
  • 5 Moving Average Strategies
without modifying any code.

Multiple Moving Average Types

Each moving average can be configured independently. Supported types include:

EMA (Exponential Moving Average)

Gives higher importance to recent price movements and reacts quickly to market changes.

SMA (Simple Moving Average)

Provides smoother trend identification by assigning equal weight to all data points.

WMA (Weighted Moving Average)

Places greater emphasis on recent prices while maintaining smoother trend behavior.

DEMA (Double Exponential Moving Average)

Reduces lag compared to traditional EMAs and provides faster trend signals.

TEMA (Triple Exponential Moving Average)

Offers even faster response to price movements while reducing noise and lag. here is the source code

Fully Customizable MA Periods

Each moving average can have its own period setting. Examples:
  • MA 1 = 9 EMA
  • MA 2 = 20 EMA
  • MA 3 = 50 SMA
  • MA 4 = 100 WMA
  • MA 5 = 200 TEMA
Every trader can create their own unique trend model.

Flexible Strategy Configurations

2 MA Crossover Setup

Example:
  • 20 EMA
  • 50 EMA
Entry occurs when the fast MA crosses above the slow MA.

3 MA Trend Confirmation

Example:
  • 20 EMA
  • 50 EMA
  • 200 EMA
Used to confirm trend direction before entering trades.

4 MA Trend Structure

Example:
  • 9 EMA
  • 21 EMA
  • 50 EMA
  • 200 EMA
Provides deeper trend filtering and reduces false signals.

5 MA Advanced Trend System

Example:
  • 9 EMA
  • 20 EMA
  • 50 EMA
  • 100 EMA
  • 200 EMA
Suitable for professional traders looking for multi-layer trend confirmation.

Entry Logic

The strategy automatically generates Buy and Sell signals based on the alignment and crossover of enabled moving averages.

Long Entry

A Buy signal may be generated when:
  • Faster moving averages cross above slower moving averages.
  • Selected MA alignment becomes bullish.
  • Trend confirmation rules are satisfied.
Mirrorpip automatically places the Buy order on the connected exchange.

Short Entry

A Sell or Short signal may be generated when:
  • Faster moving averages cross below slower moving averages.
  • Selected MA alignment becomes bearish.
  • Trend confirmation rules are satisfied.
Mirrorpip automatically executes the Short order on supported exchanges.

Enable or Disable Any Moving Average

One of the most powerful features of the strategy is complete flexibility. You can:

Enable Only 2 MAs

Example:
  • MA 1 = Enabled
  • MA 2 = Enabled
  • MA 3 = Disabled
  • MA 4 = Disabled
  • MA 5 = Disabled
Acts like a traditional moving average crossover strategy.

Enable Only 3 MAs

Example:
  • MA 1 = Enabled
  • MA 2 = Enabled
  • MA 3 = Enabled
  • MA 4 = Disabled
  • MA 5 = Disabled
Adds an additional trend filter.

Enable All 5 MAs

Provides maximum trend confirmation and market structure analysis.

Dual Profit Targets

The strategy supports two independent profit targets.

Target 1 (T1)

Configurable in:
  • Percentage (%)
  • Points
Examples:
  • 1%
  • 2%
  • 100 Points

Target 2 (T2)

Configurable independently in:
  • Percentage (%)
  • Points
Examples:
  • 3%
  • 5%
  • 300 Points
This enables partial profit booking while keeping a portion of the trade running.

Stop Loss Management

The strategy includes flexible Stop Loss functionality.

Percentage-Based Stop Loss

Examples:
  • 1%
  • 2%
  • 3%

Point-Based Stop Loss

Examples:
  • 50 Points
  • 100 Points
  • 200 Points
Mirrorpip automatically exits the position once the stop loss level is reached.

Trailing Stop Loss (TSL)

The strategy includes an advanced Trailing Stop Loss system.

TSL Options

Users can configure:
  • Percentage-Based TSL
  • Point-Based TSL
Benefits:
  • Locks in profits automatically.
  • Allows traders to capture larger trends.
  • Reduces risk during reversals.

Intraday and Positional Trading

Intraday Mode

Ideal for:
  • NSE Stocks
  • Bank Nifty
  • Nifty
  • Futures & Options
Recommended Timeframes:
  • 5 Minute
  • 15 Minute
  • 30 Minute

Positional Mode

Ideal for:
  • Cryptocurrency Markets
  • Forex Markets
  • International Markets
Recommended Timeframes:
  • 1 Hour
  • 4 Hour
  • Daily

Fully Automated with Mirrorpip

The strategy comes with pre-built Mirrorpip automation support.

Setup Process

  1. Add the strategy to your TradingView chart.
  2. Select the moving average types.
  3. Configure MA periods.
  4. Enable or disable desired moving averages.
  5. Configure Targets, Stop Loss, and Trailing Stop Loss.
  6. Create a TradingView Alert.
  7. Connect the alert to Mirrorpip.
  8. Mirrorpip automatically executes trades on your exchange account.
No programming knowledge is required.

Supported Exchanges

Mirrorpip supports automated execution on leading exchanges including:
  • Bybit
  • Binance
  • Delta Exchange
  • CoinSwitch
  • OKX
  • Bitget
  • Gate.io
  • KuCoin
  • Shark Exchange
and many more.

Why Traders Prefer the 5 MA Strategy

  • Supports multiple moving average types.
  • Completely customizable.
  • Suitable for beginners and advanced traders.
  • Works across stocks, futures, forex, and crypto.
  • Reduces false signals through trend confirmation.
  • Allows traders to build their own MA systems without coding.
  • Fully automated through Mirrorpip.

Risk Disclaimer

Trading involves substantial risk and no strategy guarantees profits. Always:
  • Use proper position sizing.
  • Configure stop losses.
  • Test settings before deploying live capital.
  • Monitor TradingView alerts and exchange connectivity.

Conclusion

The 5 MA Pine Strategy is one of the most flexible moving average trading systems available for TradingView automation. With support for up to five configurable moving averages, multiple MA types including EMA, SMA, WMA, DEMA, and TEMA, dual profit targets, advanced risk management tools, and seamless Mirrorpip integration, traders can create and automate virtually any moving average-based trading strategy with ease.