Skip to main content

Supertrend Pine Strategy

Overview

The Supertrend Pine Strategy is a fully automated trading strategy compatible with Mirrorpip and designed to work across multiple financial markets including:
  • Crypto Markets (24/7)
  • Indian Equity Markets
  • Futures & Options
  • Commodities
  • Forex
The strategy is powered by the popular Supertrend Indicator and comes with built-in Mirrorpip Integration Code, allowing users to automate their trades directly from TradingView to supported exchanges. Here is the source code of the strategy\

Key Features

Multi-Market Support

The strategy offers two trading modes:

Intraday Mode

Designed specifically for Indian markets where trading sessions have fixed timings. Suitable for:
  • NSE Stocks
  • Bank Nifty
  • Nifty
  • FinNifty
  • Sensex
  • Equity Futures

Positional Mode

Designed for markets that operate continuously. Suitable for:
  • Cryptocurrency Markets
  • Forex Markets
  • International Indices
  • Commodity Markets

Supertrend Customization

Users can fully customize the Supertrend settings according to their trading style.

Adjustable Parameters

  • ATR Period
  • Supertrend Multiplier
  • Trend Sensitivity
  • Signal Frequency
Lower settings generate:
  • More trade signals
  • Faster trend detection
Higher settings generate:
  • Fewer trade signals
  • Stronger trend confirmation

Entry Logic

Long Entry

A Buy signal is generated when:
  • Price closes above the Supertrend line.
  • Trend direction changes from bearish to bullish.
Mirrorpip automatically sends the Buy order to the connected exchange.

Short Entry

A Sell/Short signal is generated when:
  • Price closes below the Supertrend line.
  • Trend direction changes from bullish to bearish.
Mirrorpip automatically executes the Short order on supported exchanges.

Target Management

The strategy supports two independent profit targets.

Target 1 (T1)

Users can configure Target 1 in:
  • Percentage (%)
  • Points
Example:
  • 2% Target
  • 100 Point Target

Target 2 (T2)

Users can configure Target 2 independently in:
  • Percentage (%)
  • Points
Example:
  • 4% Target
  • 200 Point Target
This allows partial profit booking while keeping the remaining position open for larger trends.

Stop Loss Management

The strategy includes a configurable Stop Loss system.

Stop Loss Options

Users can define Stop Loss in:

Percentage Based

Example:
  • 1%
  • 2%
  • 3%

Points Based

Example:
  • 50 Points
  • 100 Points
  • 200 Points
Once the stop loss is hit, Mirrorpip automatically exits the trade.

Trailing Stop Loss (TSL)

To protect profits during strong trends, the strategy includes a dynamic Trailing Stop Loss feature.

TSL Configuration

Users can configure TSL in:
  • Percentage
  • Points
Benefits:
  • Locks in profits automatically.
  • Reduces risk during market reversals.
  • Helps capture larger trending moves.

Fully Automated Trading with Mirrorpip

The strategy comes with Mirrorpip Integration Code pre-built inside the Pine Script. No coding knowledge is required.

Workflow

  1. Add the strategy to your TradingView chart.
  2. Configure Supertrend parameters.
  3. Set your Targets, Stop Loss, and Trailing Stop Loss.
  4. Create a TradingView Alert.
  5. Connect the alert to Mirrorpip.
  6. Mirrorpip automatically executes trades on your exchange account.

Supported Exchanges

Mirrorpip currently supports automation across multiple exchanges including:
  • Bybit
  • Binance
  • Delta Exchange
  • CoinSwitch
  • OKX
  • Bitget
  • Gate.io
  • KuCoin
  • Shark Exchange
and many more.

Best Practices

For Indian Markets

Recommended Mode:
  • Intraday
Recommended Timeframes:
  • 5 Minute
  • 15 Minute
  • 30 Minute

For Crypto Markets

Recommended Mode:
  • Positional
Recommended Timeframes:
  • 15 Minute
  • 1 Hour
  • 4 Hour
  • Daily

Risk Disclaimer

No trading strategy guarantees profits. Market conditions can change rapidly and past performance does not guarantee future results. Always:
  • Use proper position sizing.
  • Configure stop losses.
  • Test settings before deploying significant capital.
  • Monitor exchange connectivity and alert status regularly.

Conclusion

The Supertrend Pine Strategy combines the simplicity of trend-following with the power of complete automation. With customizable Supertrend parameters, dual profit targets, flexible Stop Loss and Trailing Stop Loss options, and built-in Mirrorpip integration, it provides a robust solution for traders looking to automate their trading across both traditional and cryptocurrency markets.