Skip to content

Instantly share code, notes, and snippets.

@tejasrsuthar
Created January 8, 2021 10:40
Show Gist options
  • Save tejasrsuthar/2e5a28782610f638f459a16fc2e9e250 to your computer and use it in GitHub Desktop.
Save tejasrsuthar/2e5a28782610f638f459a16fc2e9e250 to your computer and use it in GitHub Desktop.
Trendrider - Pinescript - Tradingview
//@version=3
study(title="Wolf TrendRider v2 ", shorttitle="TrendRider", overlay=true)
// SLOW MA
len1 = input(50, minval=1, title="Slow EMA")
src1 = input(close, title="Source")
ma1 = sma(src1, len1)
maColor1 = ma1 > ma1[1] and close > ma1 ? green : ma1 < ma1[1] and close < ma1 ? red : yellow
plot( ma1, color=maColor1, style=line, title="Slow EMA", linewidth=2)
// FAST MA
len2 = input(20, minval=1, title="Fast MA")
src2 = input(close, title="Source")
ma2 = sma(src2, len2)
maColor2 = ma2 > ma2[1] and close > ma2 ? green : ma2 < ma2[1] and close < ma2 ? red : yellow
plot( ma2, color=maColor2, style=line, title="Fast MA", linewidth=2)
// ANTI LONG WICK CANDLESTICK
wickr = (high - open)+(close-low)
wickg = (open - low)+(high-close)
bodyr = (open - close)
bodyg = (close - open)
candler = (wickr<=bodyr)
candleg = (wickg<=bodyg)
// VOLUME CONFIRMATION OVER MA
v1 = volume
MAVol=input(21,minval=1, title="SMA Volume")
v2 = sma(volume,MAVol)
//COLOR BACKGROUND
Dgb = ma2>ma1[1] and close > ma1
Drb = ma2<ma1[1] and close < ma1
Dfb = ma2>ma1[1] and close < ma1
Dhb = ma2<ma1[1] and close > ma1
bgcolor(Dgb ? green : na)
bgcolor(Drb ? red : na)
bgcolor(Dfb ? black : na)
bgcolor(Dhb ? black : na)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment