Indicator · Pine Script v6 · On the chart

MA Suite

by vedkanani123· code credited to LyroRS

An overlay indicator built around one selectable moving average, with an optional extra smoothing step.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code159
Settings15inputs
LicenceNone statedfile: MPL-2.0
Last update2 months ago23 Aug 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 indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

159 lines of Pine Script v6 from indicator/olg_7_6_26/LyroRS/21.txt, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

21.txt
// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © LyroRS

//@version=6
indicator("MA Suite | Lyro RS", overlay= true)

// Library
import LyroRS/LMAs/1 as DynamicMAs


//─────────────────────────────────────────────────────────────────────────────────────────────────────────────
//─██████─────────████████──████████─████████████████───██████████████───────████████████████───██████████████─
//─██░░██─────────██░░░░██──██░░░░██─██░░░░░░░░░░░░██───██░░░░░░░░░░██───────██░░░░░░░░░░░░██───██░░░░░░░░░░██─
//─██░░██─────────████░░██──██░░████─██░░████████░░██───██░░██████░░██───────██░░████████░░██───██░░██████████─
//─██░░██───────────██░░░░██░░░░██───██░░██────██░░██───██░░██──██░░██───────██░░██────██░░██───██░░██─────────
//─██░░██───────────████░░░░░░████───██░░████████░░██───██░░██──██░░██───────██░░████████░░██───██░░██████████─
//─██░░██─────────────████░░████─────██░░░░░░░░░░░░██───██░░██──██░░██───────██░░░░░░░░░░░░██───██░░░░░░░░░░██─
//─██░░██───────────────██░░██───────██░░██████░░████───██░░██──██░░██───────██░░██████░░████───██████████░░██─
//─██░░██───────────────██░░██───────██░░██──██░░██─────██░░██──██░░██───────██░░██──██░░██─────────────██░░██─
//─██░░██████████───────██░░██───────██░░██──██░░██████─██░░██████░░██───────██░░██──██░░██████─██████████░░██─
//─██░░░░░░░░░░██───────██░░██───────██░░██──██░░░░░░██─██░░░░░░░░░░██───────██░░██──██░░░░░░██─██░░░░░░░░░░██─
//─██████████████───────██████───────██████──██████████─██████████████───────██████──██████████─██████████████─
//─────────────────────────────────────────────────────────────────────────────────────────────────────────────
//                                                 LyroRS v1.0


// Groups (For Inputs)
ma_g = "𝗠𝗢𝗩𝗜𝗡𝗚 𝗔𝗩𝗘𝗥𝗔𝗚𝗘"
signal_g = '𝗦𝗜𝗚𝗡𝗔𝗟𝗦'
colors_g = '𝗖𝗢𝗟𝗢𝗥𝗦'


// Inputs

// -- MA Inputs
source = input.source(close, "Source", group= ma_g, tooltip= "Select where the data originates (open, high, low, close, etc..).")
ma_type = input.string("EMA", "Select Moving Average", options=["SMA", "EMA", "WMA", "VWMA", "DEMA", "TEMA", "RMA", "HMA", "LSMA", "SMMA", "ALMA", "ZLSMA", "FRAMA", "KAMA", "JMA", "T3"], group=ma_g, tooltip="Choose a moving average to apply to the calculation.")
ma_length = input.int(75, "Moving Average Length", group= ma_g, tooltip= "Defines the length or period of the selected moving average.")
ma_lengthSmoothing = input.int(25, "MA - Smooth", group=ma_g)
toleranceInputS = input.float(0.0025, "Tolerance - 1", group = ma_g, tooltip = "Tolerance for Support and Resistance", step = 0.0001)
toleranceInputR = input.float(0.0025, "Tolerance - 2", group = ma_g, tooltip = "Tolerance for Rejection Signs", step = 0.0001)
customRise = input.int(25, "Rising MA", group = ma_g, tooltip = "Change Resistance of Rising MA / Long to Short Term")

// -- Display Inputs
trend_type = input.string("Source Above MA", "Select Trend Type", options=["Source Above MA", "Rising MA"], group=signal_g, tooltip="Select a moving average trend following method.")
d_sr_sigs           = input.bool  (true,             "Display Support/Resistance Signs", group= signal_g, display=display.none, tooltip="Enables triangle signs to be displayed.")
d_r_signs           = input.bool  (true,             "Display Rejection Signs", group= signal_g, display=display.none, tooltip="Enables signs for Trend mode.")
smoothingBool       = input.bool  (false,            "Enable / Disable Smoothing", group= signal_g, display=display.none, tooltip="Enables or Disables smoothing.")
  

// -- Color Inputs
ColMode = input.string("Mystic", "Custom Color Palette", inline="drop", options=["Classic", "Mystic", "Accented", "Royal"], group=colors_g,  tooltip="Choose a predefined color scheme for indicator visualization.")

cpyn = input.bool(true, "Use Custom Palette", tooltip="Enable manual selection of custom colors for trend signals.", group=colors_g, display=display.none)
cp_UpC = input.color(#00ff00, "Custom Up", inline="Custom Palette", tooltip="Set a custom color for bullish signals.", group=colors_g, display=display.none)
cp_DnC = input.color(#ff0000, "Custom Down", inline="Custom Palette", tooltip="Set a custom color for bearish signals.", group=colors_g, display=display.none)


// Colors
color UpC = na
color DnC = na

switch ColMode
    "Classic" =>
        UpC := #00E676
        DnC := #880E4F
    "Mystic" =>
        UpC := #30FDCF
        DnC := #E117B7
    "Accented" =>
        UpC := #9618F7
        DnC := #FF0078
    "Royal" =>
        UpC := #FFC107
        DnC := #673AB7


if cpyn
    UpC := cp_UpC
    DnC := cp_DnC


smoothADD = ma_length + ma_lengthSmoothing


// Moving Average Switch (Standard, No Volume Weighting)
float ma = na
switch ma_type
    "SMA"   => ma := DynamicMAs.SMA(source, smoothingBool ? smoothADD : ma_length)
    "EMA"   => ma := DynamicMAs.EMA(source, smoothingBool ? smoothADD : ma_length)
    "WMA"   => ma := DynamicMAs.WMA(source, smoothingBool ? smoothADD : ma_length)
    "VWMA"  => ma := DynamicMAs.VWMA(source, volume, smoothingBool ? smoothADD : ma_length)
    "DEMA"  => ma := DynamicMAs.DEMA(source, smoothingBool ? smoothADD : ma_length)
    "TEMA"  => ma := DynamicMAs.TEMA(source, smoothingBool ? smoothADD : ma_length)
    "RMA"   => ma := DynamicMAs.RMA(source, smoothingBool ? smoothADD : ma_length)
    "HMA"   => ma := DynamicMAs.HMA(source, smoothingBool ? smoothADD : ma_length)
    "LSMA"  => ma := DynamicMAs.LSMA(source, smoothingBool ? smoothADD : ma_length, 0)
    "SMMA"  => ma := DynamicMAs.SMMA(source, smoothingBool ? smoothADD : ma_length)
    "ALMA"  => ma := DynamicMAs.ALMA(source, smoothingBool ? smoothADD : ma_length, 0, 20)
    "ZLSMA" => ma := DynamicMAs.ZLSMA(source, smoothingBool ? smoothADD : ma_length)
    "FRAMA" => ma := DynamicMAs.FRAMA(source, smoothingBool ? smoothADD : ma_length)
    "KAMA"  => ma := DynamicMAs.KAMA(source, smoothingBool ? smoothADD : ma_length)
    "JMA"   => ma := DynamicMAs.JMA(source, smoothingBool ? smoothADD : ma_length, 0)
    "T3"    => ma := DynamicMAs.T3(source, smoothingBool ? smoothADD : ma_length, 0.5)



toleranceCodeS = ma * toleranceInputS
toleranceCodeR = ma * toleranceInputS

// MA Touch (Support & Resistance)
var float bandtouch_score = na
if close > ma + toleranceCodeS and low < ma
    bandtouch_score := 1 // Support

else if close < ma - toleranceCodeS and high > ma
    bandtouch_score := -1 // Resistance

else 
    bandtouch_score := 0

//-- Rejection (Bullish & Bearish Price Behavior)
var float rejection_score = na

bull_c = ta.crossover(close, ma + toleranceCodeR) // Bullish cross
bear_c = ta.crossunder(close, ma - toleranceCodeR) // Bearish cross
if bandtouch_score[1] == -1 and bull_c == true
    rejection_score := 1

else if bandtouch_score[1] == 1 and bear_c == true
    rejection_score := -1

else 
    rejection_score := 0




// Plots
pc = trend_type == "Source Above MA" ? (close > ma ? UpC : DnC) : trend_type == "Rising MA" ? (ma > ma[customRise] ? UpC : DnC) : na
plot(ma, color = pc, title= "Moving Average")
plot(ma, color = color.new(pc, 75), linewidth= 5, title= "Moving Average Glow", display = display.pane)
plot(ma, color = color.new(pc, 80), linewidth= 10, title= "Moving Average Glow 2", display = display.pane)
barcolor(pc, title= "Bar Color")
// -- MA Touch Chars
displays_MATC = d_sr_sigs ? display.pane : display.none
plotchar(low, char='▲', color= bandtouch_score == 1 ? UpC : na, location=location.absolute, title= "Support Signals", display= displays_MATC, size= size.tiny)
plotchar(high, char='▼', color= bandtouch_score == -1 ? DnC : na, location=location.absolute, title= "Resistance Signals", display= displays_MATC, size= size.tiny)


// -- Rejection Shapes
displays_rs = d_r_signs ? display.pane : display.none
plotshape(ta.crossover(rejection_score, 0), title="Rejection Signal", location=location.belowbar,
           style=shape.labelup, text="𝓑𝓾𝓵𝓵𝓲𝓼𝓱 𝓡𝓮𝓳𝓮𝓬𝓽𝓲𝓸𝓷", textcolor=#000000, size=size.small,
           color=UpC, force_overlay=true, display= displays_rs)

plotshape(ta.crossunder(rejection_score, 0), title="Rejection Signal", location=location.abovebar,
           style=shape.labeldown, text="𝓑𝓮𝓪𝓻𝓲𝓼𝓱 𝓡𝓮𝓳𝓮𝓬𝓽𝓲𝓸𝓷", textcolor=#000000, size=size.small,
           color=DnC, force_overlay=true, display= displays_rs)

Overview

MA Suite reads trend from price above or below the average or from a rising average, and marks support and resistance touches within a percentage tolerance, plus rejection signs. Inputs are the average type and length, smoothing length, two tolerance values, a rising-average lookback and the trend type. Palettes are adjustable.

Details

Published by

vedkanani123 on GitHub

Code credit

LyroRS, as written in the script's header

Type

Indicator, Pine Script v6

Draws

On the price chart

Category

Moving averages, Trend, Support & resistance

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

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

SettingTypeDefaultVariable
Sourcesourceclosesource
Select Moving AveragestringEMAma_type
Moving Average Lengthint75ma_length
MA - Smoothint25ma_lengthSmoothing
Tolerance - 1float0.0025toleranceInputS
Tolerance - 2float0.0025toleranceInputR
Rising MAint25customRise
Select Trend TypestringSource Above MAtrend_type
Display Support/Resistance Signsbooltrued_sr_sigs
Display Rejection Signsbooltrued_r_signs
Enable / Disable SmoothingboolfalsesmoothingBool
Custom Color PalettestringMysticColMode
Show all 15 settings
SettingTypeDefaultVariable
Use Custom Palettebooltruecpyn
Custom Upcolor#00ff00cp_UpC
Custom Downcolor#ff0000cp_DnC
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 indicator analyzes short-term price action on index futures and options charts by applying Rational Quadratic kernel smoothing to detect sideways consolidation ranges and potential breakouts. It processes pivot highs and lows over customizable loopback pe

Indicator v5 Support & resistanceTrend Repaints
Updated 6 weeks ago · None stated GitHub repository of SPX 30M - Trading Chart

Ichimoku Cloud

by harryguiacorn
219 stars

This indicator plots Ichimoku Cloud elements on the price chart, including Tenkan-sen, Kijun-sen, Senkou Span A and B lines with optional Chikou Span. It signals trend changes via Tenkan-sen and Kijun-sen crosses and places arrows at Kijun-sen direction shifts

Indicator v5 TrendMoving averages
Updated 1 year ago · None stated GitHub repository of Ichimoku Cloud

MA Envelope (MAE)

by mihakralj
99 stars

The MA Envelope indicator calculates upper and lower channel bands shifted by a user-defined percentage around a baseline moving average. It supports Simple Moving Average, Exponential Moving Average, and Weighted Moving Average calculation types. The script p

Indicator v6 Moving averagesSupport & resistance
Updated 4 weeks ago · Apache-2.0 GitHub repository of MA Envelope (MAE)
56 stars

This indicator calculates an Exponential Moving Average and a Zero-Lag Moving Average to identify market trends on the price chart. It plots both moving averages and fills the space between them with color to highlight trend direction. Upon a crossover or cros

Indicator v5 TrendMoving averages
Updated 2 months ago · None stated GitHub repository of No-Lag MA Trend Levels

More indicators

Trade Your Charts With a Regulated Broker

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

Compare brokers