How can I create a Keltner Channel indicator in Pine Script?

Asked by Radhesh Joshi · SOLVED
1 reply 201 views Jump to solution Reply
Radhesh Joshi Original Post
Strategy Builder

I’m trying to create a Keltner Channel indicator in Pine Script, but I’m not sure how to build it from scratch.

I want to create the indicator and plot it properly on the chart.

Can anyone help me with the correct way to create a Keltner Channel in Pine Script?

Posted Aug 19
Reply

    1 Reply

    Tech Support AlgoDelta
    Tech Support AlgoDelta Automation Expert ·

    Yes sir, you can definitely create a Keltner Channel in Pine Script.

    A Keltner Channel generally consists of a middle EMA and upper and lower bands calculated using ATR.

    You can create it using:

    //@version=6

    indicator(“Custom Keltner Channel”, overlay=true)`
    emaLength = input.int(20, “EMA Length”)
    atrLength = input.int(10, “ATR Length”)
    multiplier = input.float(2.0, “ATR Multiplier”)

    middle = ta.ema(close, emaLength)
    atrValue = ta.atr(atrLength)

    upper = middle + atrValue \* multiplier
    lower = middle – atrValue \* multiplier

    middlePlot = plot(middle, “Middle”)
    upperPlot = plot(upper, “Upper”)
    lowerPlot = plot(lower, “Lower”)

    fill(upperPlot, lowerPlot, color=color.new(color.blue, 90))`

    -> The middle line is calculated using EMA.

    -> ATR determines the distance of the upper and lower bands.

    -> The multiplier controls the width of the channel.

    -> The fill() function highlights the area between the two bands.

    So that’s how you can create a basic Keltner Channel in Pine Script.

    Verified Solution
      Markdown supported · ```json for code blocks · paste or drop screenshots

      Be specific and kind. Never share API keys, passwords or personal account details.

      Welcome to the community

      Log in or create your account in under a minute.

      1. 1Mobile
      2. 2E-mail
      3. 3Password
      +91

      Have a password?

      By continuing you agree to the community guidelines. We’ll send a one-time code by SMS.