0% found this document useful (0 votes)
18 views3 pages

GWT Edge Trading Indicator Script

wall street trading edge

Uploaded by

Nancy George
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views3 pages

GWT Edge Trading Indicator Script

wall street trading edge

Uploaded by

Nancy George
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

// This Pine Script® code is subject to the terms of the Mozilla Public License 2.

0 at
[Link]

// © YusufBay

//@version=6

indicator("GWT Edge", overlay=true, max_labels_count=500)

//──────────────────── Inputs (unchanged behavior, VWAP TF added)

htf_tf = [Link]("D", "Higher Timeframe (trend)")

htfFastLen = [Link](21, "HTF Fast EMA length")

htfSlowLen = [Link](89, "HTF Slow EMA length")

atrLen = [Link](14, "ATR length")

atrMult = [Link](1.6, "ATR stop multiplier")

rsiLen = [Link](14, "RSI length")

rsiOS = [Link](35, "RSI oversold threshold")

rsiOB = [Link](65, "RSI overbought threshold")

macdFast = [Link](12, "MACD fast")

macdSlow = [Link](26, "MACD slow")

macdSigIn = [Link](9, "MACD signal")

// VWAP Filter Inputs (new)

useVWAP = [Link](false, "Use session VWAP filter (intraday)")

vwap_tf = [Link]("D", "VWAP Timeframe", options = ["1", "5", "15", "30", "60", "240", "D"])

//──────────────────── Higher timeframe trend (no lookahead)


htfEMAfast = [Link]([Link], htf_tf, [Link](close, htfFastLen),
gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_off)

htfEMAslow = [Link]([Link], htf_tf, [Link](close, htfSlowLen),


gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_off)

trendUp = htfEMAfast > htfEMAslow

trendDown = htfEMAfast < htfEMAslow

//──────────────────── ATR, RSI, MACD

atr = [Link](atrLen)

rsi = [Link](close, rsiLen)

[macdLine, macdSignal, macdHist] = [Link](close, macdFast, macdSlow, macdSigIn)

//──────────────────── VWAP on selected timeframe (no lookahead)

vwap_htf = [Link]([Link], vwap_tf, [Link](hlc3), gaps=barmerge.gaps_off,


lookahead=barmerge.lookahead_off)

// Plot VWAP only when filter is enabled. Title must be a const string (can't concatenate with input at
compile)

plot(useVWAP ? vwap_htf : na, title="VWAP", color=[Link]([Link], 0), linewidth=2)

// VWAP filter booleans

vwapFilterLong = not useVWAP or close > vwap_htf

vwapFilterShort = not useVWAP or close < vwap_htf

//──────────────────── Signal Conditions (kept same logic)

longCond = trendUp and rsi > rsiOS and macdLine > macdSignal and vwapFilterLong

shortCond = trendDown and rsi < rsiOB and macdLine < macdSignal and vwapFilterShort

// Confirmed signals (bar-close)

longSignal = longCond and [Link]


shortSignal = shortCond and [Link]

//──────────────────── Plot signals (arrows/labels)

plotshape(longSignal, title="Buy", style=[Link], location=[Link], text="BUY",


textcolor=[Link], size=[Link], color=[Link])

plotshape(shortSignal, title="Sell", style=[Link], location=[Link], text="SELL",


textcolor=[Link], size=[Link], color=[Link])

//──────────────────── Alerts

alertcondition(longSignal, title="GWT Long Signal", message="GWT BUY signal on {{ticker}} @


{{close}}")

alertcondition(shortSignal, title="GWT Short Signal", message="GWT SELL signal on {{ticker}} @


{{close}}")

//──────────────────── Debug table (optional)

var table dbg = [Link](position.top_right, 2, 5)

if [Link]

[Link](dbg, 0, 0, "HTF")

[Link](dbg, 1, 0, trendUp ? "Bull" : trendDown ? "Bear" : "Neutral")

[Link](dbg, 0, 1, "UseVWAP")

[Link](dbg, 1, 1, [Link](useVWAP))

[Link](dbg, 0, 2, "VWAP TF")

[Link](dbg, 1, 2, vwap_tf)

[Link](dbg, 0, 3, "Last Signal")

[Link](dbg, 1, 3, longSignal ? "BUY" : shortSignal ? "SELL" : "-")

[Link](dbg, 0, 4, "ATR")

[Link](dbg, 1, 4, [Link](atr))

You might also like