Trend-Following StopPine Script v6

Chande Kroll Stop Pine Script — Complete TradingView Guide

The Chande Kroll Stop Pine Script indicator is an adaptive trend-following stop-loss tool that uses Average True Range (ATR) to dynamically position two stop lines — a long stop (blue) below price and a short stop (orange) above price. Developed by Tushar Chande and Stanley Kroll in 1994, the indicator helps traders identify trend direction and manage stop-loss placement across stocks, crypto, forex, and futures. In Pine Script v6, the Chande Kroll Stop is computed using ta.highest(), ta.lowest(), and ta.atr() with default parameters of p = 10, x = 1, q = 9. When price closes above the long stop, the trend is bullish; when price closes below the short stop, the trend is bearish. This complete guide covers the Pine Script code, all configurable parameters, proven trading strategies, and step-by-step instructions for generating the indicator with Pineify.

What Is the Chande Kroll Stop?

The Chande Kroll Stop is a trend-following stop-loss indicator that dynamically positions two adaptive stop lines using Average True Range, used to identify trend direction and set trailing stops in trending markets. Developed by Tushar Chande and Stanley Kroll and introduced in their 1994 book The New Technical Trader: Boost Your Profit by Plugging into the Latest Indicators, the indicator was designed to overcome the limitations of fixed stop-loss methods by adapting stop distance to current market volatility.

The Chande Kroll Stop is calculated in two stages:

Step 1 (Preliminary stops):
first_high_stop = ta.highest(high, p) − x × ta.atr(p)
first_low_stop = ta.lowest(low, p) + x × ta.atr(p)

Step 2 (Smoothed stops):
stop_short = ta.highest(first_high_stop, q)
stop_long = ta.lowest(first_low_stop, q)

Where p is the ATR lookback period (default 10 bars), x is the ATR multiplier controlling stop distance (default 1), and q is the second smoothing period (default 9 bars). The first stage generates preliminary stop levels based on the highest high and lowest low over p bars, offset by a multiple of ATR. The second stage smooths those preliminary stops over q bars to reduce noise. The result is two adaptive trailing lines that track volatility-adjusted price extremes.

The Chande Kroll Stop generates three market zones:

  • Bullish zone: price is above both stop lines — trend is upward, hold or enter long positions
  • Neutral zone: price is between the long stop and short stop — no directional bias, avoid new trades
  • Bearish zone: price is below both stop lines — trend is downward, hold or enter short positions

The Chande Kroll Stop applies to all major asset classes: stocks (equities and ETFs), cryptocurrency (BTC, ETH, and altcoins), forex (EUR/USD, GBP/USD, USD/JPY), and futures (equity index, commodity, and bond futures). It performs best in trending markets with clear directional momentum and poorly in sideways or choppy conditions.

Best timeframes for Chande Kroll Stop: Daily charts are the original design target for swing traders. 4H–Daily is the most reliable combination for medium-term trend trading. For position trading, Weekly charts provide high-confidence trend signals with minimal noise. On timeframes below 15 minutes, CKS tends to generate excessive false signals due to intraday volatility.

Chande Kroll Stop Pine Script Code Example

The following Pine Script v6 code calculates the Chande Kroll Stop using ta.highest(), ta.lowest(), and ta.atr(), then overlays two stop lines directly on the price chart: the long stop (blue line below price) and the short stop (orange line above price). To use it in TradingView, open the Pine Script Editor from the bottom toolbar, paste the code, click Save, then click Add to chart.

Pine Script v6
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Pineify

//@version=6
indicator(title="Chande Kroll Stop", overlay=true, max_labels_count=500)

// Chande Kroll Stop — adaptive trend-following stop-loss indicator
// Step 1: Compute preliminary stop lines using ATR
p_ta_chande_kroll_stop(simple int p, simple int x, simple int q) =>
    first_high_stop = ta.highest(high, p) - x * ta.atr(p)
    first_low_stop  = ta.lowest(low, p) + x * ta.atr(p)
    stop_short = ta.highest(first_high_stop, q)
    stop_long  = ta.lowest(first_low_stop, q)
    [stop_long, stop_short]

// Default parameters: p=10, x=1, q=9
[p_ind_1_stopLong, p_ind_1_stopShort] = p_ta_chande_kroll_stop(10, 1, 9)

// Plot stop lines: blue = long stop, orange = short stop
plot(p_ind_1_stopLong,  title="CKS - Stop Long",  color=color.rgb(41, 98, 255, 0), linewidth=1)
plot(p_ind_1_stopShort, title="CKS - Stop Short", color=color.rgb(255, 109, 0, 0), linewidth=1)
Chande Kroll Stop indicator Pine Script code example in TradingView

Chande Kroll Stop Parameters

The Chande Kroll Stop accepts three parameters that control the sensitivity and width of the stop lines. The table below lists each parameter with its default value and recommended ranges.

ParameterDefault ValueDescriptionRecommended Range
p10ATR lookback period for computing preliminary stop levels. Controls how many bars are used to find the highest high and lowest low before ATR offset is applied.5–7 (scalping), 10 (default swing), 20–25 (position trading)
x1ATR multiplier that determines how far the preliminary stop is offset from the high/low extreme. A higher value widens the stop distance.1 (default), 2–3 (high-volatility assets like crypto altcoins)
q9Second smoothing period applied via ta.highest() / ta.lowest() to the preliminary stop lines. Larger values produce smoother, slower-moving stops.5–7 (faster response), 9 (default), 15–20 (position trading)
Tuning scenarios:
  • Scalping (5M–15M charts): use p = 5, x = 1, q = 5 — tighter stops, faster response to price moves
  • Swing trading (4H–Daily): use the default p = 10, x = 1, q = 9 — Chande and Kroll's original settings for daily charts
  • Crypto / high-volatility assets: use p = 10, x = 2, q = 9 — wider ATR multiplier prevents stop-outs during normal volatility spikes

Chande Kroll Stop Trading Strategies

Strategy 1: Trend Breakout Entry Using Stop Line Cross

Market environment: Trending (stocks, forex, crypto) — applies when price breaks above or below both CKS stop lines, signaling the start of a new directional trend. Combine with ADX to confirm trend strength before entry.

Entry conditions (long):

  1. Price closes above the short stop (orange) line after previously being in the neutral zone
  2. Price is also above the long stop (blue) line on the same bar (both stop lines below price)
  3. ADX(14) is above 20, confirming the market is trending rather than ranging
  4. Enter at the open of the next bar after the breakout closes

Exit conditions:

  1. Price closes below the long stop (blue) line — trail the stop upward as the long stop rises
  2. Stop-loss: set initial stop below the long stop value at entry

Strategy 2: Chande Kroll Stop + RSI Momentum Confirmation

Market environment: Trending with pullbacks (4H–Daily charts) — uses RSI to confirm momentum before entering on CKS trend signals, filtering low-probability setups in choppy conditions.

Entry conditions (long):

  1. Price is above both CKS stop lines on the current closing bar
  2. RSI(14) is above 50 — bullish momentum confirmed
  3. Price has just crossed above the long stop within the last 3 bars (recent confirmation)
  4. Enter at next bar open after both conditions align

Exit conditions:

  1. RSI drops below 50 — momentum weakening, close the position or tighten stop
  2. Price closes below the long stop line — trailing stop triggered

Strategy 3: Neutral Zone Avoidance with EMA Trend Filter

Market environment: Swing trading (Daily charts) — waits for price to exit the CKS neutral zone before entering, using EMA 50 as a secondary trend filter to avoid counter-trend trades.

Entry conditions (long):

  1. Price was inside the neutral zone (between long stop and short stop) for at least 2 consecutive bars
  2. Price now closes above the short stop line, exiting the neutral zone upward
  3. EMA(50) is rising and price is above EMA(50) — macro trend is bullish
  4. Enter long at the open of the next bar

Exit conditions:

  1. Price re-enters the neutral zone — close the position immediately
  2. Target: 1.5× to 2× risk measured from entry to the long stop at entry
Disclaimer: The trading strategies described above are for educational purposes only. They do not constitute investment advice or a recommendation to buy or sell any financial instrument. Past performance of any indicator or strategy does not guarantee future results. Always conduct your own research and consult a licensed financial advisor before trading.

How to Generate Chande Kroll Stop Pine Script in Pineify

Pineify generates production-ready Chande Kroll Stop Pine Script v6 code in seconds — no coding experience required.

  1. 1

    Open Pineify at pineify.app

    Sign up for a free account or log in to access the indicator builder with 235+ built-in indicators.

  2. 2

    Click "Add Indicator" and search for Chande Kroll Stop

    Select "Chande Kroll Stop" from the indicator library. Pineify includes the complete CKS implementation with all three configurable parameters.

  3. 3

    Describe your strategy and configure CKS settings

    Set the ATR period (p), ATR multiplier (x), and smoothing period (q). Optionally add RSI, ADX, or EMA filters to create a multi-condition strategy.

  4. 4

    Copy the generated Pine Script v6 code

    Pineify generates a complete, runnable script with your exact CKS configuration. Click "Copy" to copy it to your clipboard.

  5. 5

    Adjust and paste into TradingView Pine Script Editor

    Open the Pine Script Editor on TradingView, paste the code, click Save, and click "Add to chart" to see the Chande Kroll Stop overlay live on your price chart.

Generate Chande Kroll Stop Pine Script for Free

Chande Kroll Stop Pine Script — Frequently Asked Questions

Related Pine Script Indicators

Explore other popular Pine Script indicators available in Pineify:

Ready to Generate Your Chande Kroll Stop Indicator?

Pineify generates production-ready Pine Script v6 code for Chande Kroll Stop and 235+ other indicators. Free to get started.

Get Started Free