Indicator · Pine Script v5 · Own pane

Snagprofit WMA

by dearvn· code credited to binancash

Snagprofit WMA is a multi-timeframe trend indicator that calculates a 125-period Weighted Moving Average across the 1-minute, 5-minute, 15-minute, and 1-hour timeframes alongside a local 50-period Simple Moving Average.

View on GitHub

Repaints

GitHub stars4on the repository
Pine versionv5runs as is
Lines of code127
Settings7inputs
LicenceNone statedfile: MPL-2.0
Last update4 years ago25 Jul 2022

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

127 lines of Pine Script v5 from snagprofit-wma.txt, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

snagprofit-wma.txt
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © binancash
//
//1. Weighted MA 125 candles cho 1M, 5M, 15M, 1H
//2. MA 50
//
//a that khi price above #2 thi manh len. 1M cross up 5M la short term Buy
//5M cross up 15M la mid term buy
//15m cross up 1H la long term buy.  
//
//neu price nam tren MA 50 la safe de buy
//
//con volume thi Volume (0) > Volume (1) * 3 thi moi goi la big volume. nhung phai xem la Sell volume hay Buy volume
//
//neu sell volume gap 3 thi thi truong se mua vao
//
//neu buy volume gap 3 thi thi truong se ban ra

//@version=5
indicator("Snagprofit WMA")

len_wma = input.int(125, minval=1, title="Length")
wma = ta.wma(close, len_wma)
tf1m_wma = request.security(syminfo.tickerid, '1', wma, barmerge.gaps_on) 
plot(tf1m_wma, title="WMA 1M", color=color.white)

tf5m_wma = request.security(syminfo.tickerid, '5', wma, barmerge.gaps_on) 
plot(tf5m_wma, title="WMA 5M", color=color.yellow)

tf15m_wma = request.security(syminfo.tickerid, '15', wma, barmerge.gaps_on) 
plot(tf15m_wma, title="WMA 15M", color=color.green)

tf1h_wma = request.security(syminfo.tickerid, '60', wma, barmerge.gaps_on) 
plot(tf1h_wma, title="WMA 1H", color=color.red)

len_sma = input.int(50, minval=1, title="Moving Average")
ma = ta.sma(close, len_sma)

//up signals only if above a moving average or down if below
up = if close > ma
    close > high[1] 
    
down = if close < ma
    close < low[1]

plot(ma)
plotshape(up, title="Up momentum", style=shape.triangleup, location=location.belowbar, color=color.green, size=size.tiny)
plotshape(down, title="Down momentum", style=shape.triangledown, location=location.abovebar, color=color.red, size=size.tiny)

short_term_buy = false
mid_term_buy = false
long_term_buy = false
if close > ma
    if tf1m_wma > tf5m_wma
        short_term_buy := true
    if tf5m_wma > tf15m_wma
        mid_term_buy := true
    if tf15m_wma > tf1h_wma
        long_term_buy := true
    
big_volume = false
if volume[0]/volume[1] >= 3
    big_volume := true
    
var string GP2 = "Display"
string  i_tableYpos = input.string("top", "Panel position", inline = "11", options = ["top", "middle", "bottom"], group = GP2)
string  i_tableXpos = input.string("right", "", inline = "11", options = ["left", "center", "right"], group = GP2)
color   i_c_buy    = input.color(color.new(color.green, 30), "Buy", inline = "12", group = GP2)
color   i_c_sell    = input.color(color.new(color.red, 10), "Sell", inline = "12", group = GP2)
color   i_c_neutral = input.color(color.new(color.gray, 30), "Neutral", inline = "12", group = GP2)

low15m = request.security(syminfo.tickerid, "15", low, barmerge.gaps_on)
high15m = request.security(syminfo.tickerid, "15", high, barmerge.gaps_on)
h = hour(time, "GMT-8")
m = minute(time, "GMT-8")

var low_arr = array.new_float()
var high_arr = array.new_float()

if h == 6 and m == 45
    array.push(low_arr, low15m)
    array.push(high_arr, high15m)
    //if array.size(low_arr) > 2
    //    label.new(bar_index, close, text="L:"+str.format("{0}", array.get(low_arr, array.size(low_arr)-2)), textcolor=color.yellow, style=label.style_triangleup)


if barstate.islast
    // Table header.
    var table panel = table.new(i_tableYpos + "_" + i_tableXpos, 6, 10)

    table.cell(panel, 0, 1, "Short", bgcolor = i_c_neutral, text_color=color.white, width=4)
    table.cell(panel, 1, 1, "Mide", bgcolor = i_c_neutral, text_color=color.white, width=4)
    table.cell(panel, 2, 1, "Long", bgcolor = i_c_neutral, text_color=color.white, width=6)
    table.cell(panel, 3, 1, "Big Vol", bgcolor = i_c_neutral, text_color=color.white, width=6)
    
    table.cell(panel, 0, 2, short_term_buy ? "Y":'N', bgcolor = i_c_neutral, text_color=color.white, width=4)
    table.cell(panel, 1, 2, mid_term_buy ? "Y":'N', bgcolor = i_c_neutral, text_color=color.white, width=4)
    table.cell(panel, 2, 2, long_term_buy ? "Y":'N', bgcolor = i_c_neutral, text_color=color.white, width=6)
    table.cell(panel, 3, 2, big_volume ? "Y":'N', bgcolor = i_c_neutral, text_color=color.white, width=6)
    
    if array.size(low_arr) > 2
        trend = 'Side way'
        if array.get(high_arr, array.size(high_arr)-1) > array.get(high_arr, array.size(high_arr)-2)
            trend := 'Up'
        else if array.get(low_arr, array.size(low_arr)-1) < array.get(low_arr, array.size(low_arr)-2)
            trend := 'Down'
        table.cell(panel, 4, 1, "Trend 15m", bgcolor = i_c_neutral, text_color=color.white, width=6)
        table.cell(panel, 4, 2, trend, bgcolor = i_c_neutral, text_color=color.white, width=6)
    

    
    
long_ok = big_volume and mid_term_buy
long_not_ok = big_volume and not short_term_buy
    
alertcondition(long_ok, title='LONG BUY', message='LONG BUY')
alertcondition(long_not_ok, title='LONG SELL', message='LONG SELL')

l_buy1= ta.barssince(long_ok)
l_sell1 = ta.barssince(long_not_ok)
l_1 = l_buy1[1] > l_sell1[1] ? long_ok : na
plotshape(l_1,title="L-Buy",text='L-B', color=color.yellow, style=shape.triangleup,location=location.bottom,size=size.small)

l_buy2= ta.barssince(long_not_ok)
l_sell2 = ta.barssince(long_ok)
l_2 = l_buy2[1] > l_sell2[1] ? long_not_ok : na
plotshape(l_2,title="L-Sell",text='L-SELL', color=color.orange, style=shape.triangledown,location=location.top,size=size.small)

Overview

Snagprofit WMA identifies momentum signals when price breaks previous high or low levels relative to the SMA, and evaluates short-term, mid-term, and long-term trend alignment across timeframes. A dashboard table displays real-time trend status. Higher timeframe calculations update intrabar and repaint until the higher timeframe candle closes.

Details

Published by

dearvn on GitHub

Code credit

binancash, as written in the script's header

Type

Indicator, Pine Script v5

Draws

Separate pane below the chart

Category

Moving averages, Trend, Screeners & dashboards

Markets

Any symbol

Timeframes

M1-M5, M15-H1

Risk Notes

  • Signals can change on the live bar or after it closes (repainting)

Topics

futurestrading-strategiestradingview

Settings

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

SettingTypeDefaultVariable
Lengthint125len_wma
Moving Averageint50len_sma
Panel positionstringtopi_tableYpos
i_tableXposstringrighti_tableXpos
Buycolorcolor.new(color.green, 30)i_c_buy
Sellcolorcolor.new(color.red, 10)i_c_sell
Neutralcolorcolor.new(color.gray, 30)i_c_neutral
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

218 stars

Multi-Timeframe Analysis Suite calculates trend direction and momentum conditions across five user-selected timeframes using moving averages, RSI, and Stochastic oscillators. It evaluates moving average slope and oscillator levels to compute trend alignment, m

Indicator v6 Screeners & dashboardsTrend
Updated 3 months ago · None stated GitHub repository of Multi-Timeframe Analysis Suite

KamaFama

by Mastaaa1987
141 stars

KamaFama is an indicator that translates a Freqtrade trading strategy into Pine Script for visualization. It combines Kaufman Adaptive Moving Average (KAMA), MAMA/FAMA calculations derived via Hilbert Transform, Williams %R, and correlation trend filters to ev

Indicator v6 Moving averagesOscillators & momentum
Updated 6 weeks ago · MIT GitHub repository of KamaFama
10 stars

This indicator combines SuperGuppy exponential moving average ribbons with SuperTrend pivot points in a separate pane screener. It classifies up to twenty assets as neutral, long, strong long, short, or strong short. Fast and slow EMA stacks define trend align

Indicator v4 TrendMoving averages
Updated 4 years ago · MIT GitHub repository of SuperGuppySTPPScreener
9 stars

This indicator functions as a multi-pair forex screener, drawing output in a separate pane. It fetches price data across major currency pairs using security functions based on a user-selected resolution timeframe. It processes these market feeds with short, me

Indicator v4 Screeners & dashboardsTrend Repaints
Updated 5 years ago · None stated GitHub repository of AG Screener (Phill_I Request)

MTF WaveTrend Opportunity Hunter calculates multi-timeframe momentum and confluence scores using WaveTrend across custom Regime, Setup, Trigger, and Context timeframes. It plots a net confluence score histogram, multi-layer heat ribbons, an RRG-style Rotation

Indicator v6 TrendOscillators & momentum
Updated yesterday · MIT GitHub repository of MTF WaveTrend Opportunity Hunter [WavesUnchained]

BTMM HTF Bias System

by jcortes254
3 stars

BTMM HTF Bias System analyzes trend alignment and higher-timeframe directional bias using exponential moving averages across multiple timeframes, such as 1-hour, 4-hour, daily, and weekly charts. Based on Steve Mauro's Beat The Market Maker methodology, it cal

Indicator v5 TrendMoving averages
Updated 1 year ago · None stated GitHub repository of BTMM HTF Bias System

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