Strategy · Pine Script v6 · On the chart

Mantle Keltner Regime

by pineforge-4pass· code credited to PineForge

A long-only strategy built on Keltner Channels.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code34
Settings4inputs
LicenceApache-2.0
Last update6 days ago23 Oct 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new strategy, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.

Source Code

34 lines of Pine Script v6 from validation/ta-mantle-keltner-regime-01/strategy.pine, published under Apache-2.0. Keep the author's credit and licence lines when you reuse it.

strategy.pine
//@version=6
// SPDX-License-Identifier: Apache-2.0
// Copyright 2026 PineForge
// PineForge Owned Strategy: Mantle Keltner Regime
// The native Keltner tuple supplies both breakout and regime boundaries.
strategy("PineForge — Mantle Keltner Regime", overlay=true,
     initial_capital=100000,
     default_qty_type=strategy.fixed, default_qty_value=2,
     pyramiding=0, commission_type=strategy.commission.percent,
     commission_value=0.05, slippage=1,
     margin_long=100, margin_short=100,
     process_orders_on_close=false, calc_on_order_fills=false)

channelLength = input.int(24, "Keltner Length", minval=3, group="Channel")
channelMultiplier = input.float(1.7, "Keltner Multiplier", minval=0.2, step=0.1, group="Channel")
trendLength = input.int(57, "Trend EMA Length", minval=5, group="Trend")
maximumChannelLoss = input.float(0.65, "Maximum Channel Loss", minval=0.1, maxval=2.0, step=0.05, group="Risk")

[channelCenter, channelUpper, channelLower] = ta.kc(close, channelLength, channelMultiplier)
trendLine = ta.ema(close, trendLength)
channelWidth = channelUpper - channelLower

enterLong = ta.crossover(close, channelUpper) and channelCenter > trendLine
regimeEnded = close < channelCenter
riskExceeded = strategy.position_size > 0 and close < strategy.position_avg_price - channelWidth * maximumChannelLoss

if strategy.position_size == 0 and enterLong
    strategy.entry("Mantle Long", strategy.long)
else if strategy.position_size > 0 and (regimeEnded or riskExceeded)
    strategy.close("Mantle Long", comment=riskExceeded ? "Channel risk" : "Channel regime")

plot(channelCenter, "Keltner Center", color=color.gray)
plot(channelUpper, "Keltner Upper", color=color.green)
plot(channelLower, "Keltner Lower", color=color.red)

Overview

Mantle Keltner Regime enters long when price crosses above the upper band while the channel centre is above a longer trend EMA. It exits when price closes below the channel centre, or when price falls a chosen fraction of the channel width below the average entry. Channel length, multiplier, trend length and the loss fraction are adjustable. The three channel lines are drawn on the price chart.

Details

Published by

pineforge-4pass on GitHub

Code credit

PineForge, as written in the script's header

Type

Strategy, Pine Script v6

Draws

On the price chart

Category

Volatility & bands, Breakout, Trend

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

  • The strategy enters trades without a stop loss

Topics

algorithmic-tradingbacktestingparitypine-scriptpinescriptquantitative-financetest-corpustradingview

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Keltner Lengthint24channelLength
Keltner Multiplierfloat1.7channelMultiplier
Trend EMA Lengthint57trendLength
Maximum Channel Lossfloat0.65maximumChannelLoss
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

257 stars

This strategy plots VWMA-based Bollinger bands on the 1-minute ES futures price chart for volatility analysis and potential breakout identification. It calculates dynamic long and short stop loss and take profit levels using percentage inputs relative to entry

Strategy v6 Volatility & bandsSupport & resistance
Updated 6 weeks ago · None stated GitHub repository of V1.6 ES - Futures 1M No Repaint
106 stars

This strategy runs on the price chart and enters long when a fast simple moving average crosses above a slow one, and short on the opposite cross, while closing the other side. Entries also need ATR above a filter, a pullback check, a minimum candle-body chang

Strategy v5 TrendMoving averages
Updated 2 years ago · GPL-3.0 GitHub repository of 9:22 5 MIN 15 MIN BANKNIFTY

均线突破交易系统

by tangly1024
76 stars

This strategy trades long breakouts of a fast and a slow moving average on the price chart. It opens a long position when price crosses above either average, using a percentage of equity as size. It reduces the position by a set share when the high reaches the

Strategy v5 TrendMoving averages
Updated 5 months ago · None stated GitHub repository of 均线突破交易系统
16 stars

This trend-following strategy adapts classic Donchian breakout channels according to market volatility regimes. It calculates an ATR percentile rank across a rolling lookback period, shifting dynamically between tighter breakout channels with smaller stops dur

Strategy v6 TrendBreakout
Updated 12 months ago · None stated GitHub repository of Seykota Alt 1: Adaptive Volatility

This strategy executes breakout trades using two Donchian Channels alongside an optional 200-period EMA trend filter. Entries trigger when the price sets a new highest high or lowest low over the primary Donchian Channel period. Exits are managed via a shorter

Strategy v5 BreakoutTrend
Updated 1 year ago · None stated GitHub repository of Ruckard Walcrypto DoubleDonchian B002

Breakout Strategy

by JoelPasapera
11 stars

This strategy implements a channel breakout system directly on the main price chart. It calculates highest highs and lowest lows over configurable entry and exit periods using historical candles. A long entry triggers when the close breaks above the entry chan

Strategy v6 BreakoutTrend
Updated 5 months ago · Apache-2.0 GitHub repository of Breakout Strategy

More strategys

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers