Skip to content

Instantly share code, notes, and snippets.

@misrori
Created January 15, 2024 18:36
Show Gist options
  • Save misrori/ae77642c31fb1a973c7627cc077a1df2 to your computer and use it in GitHub Desktop.
Save misrori/ae77642c31fb1a973c7627cc077a1df2 to your computer and use it in GitHub Desktop.
GoldHand Line indicator
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © ormraat.pte
//@version=5
indicator(title='Goldhand Line', shorttitle='Goldhand', overlay=true, timeframe='')
smma(src, length) =>
smma = 0.0
sma = ta.sma(src, length)
smma := na(smma[1]) ? sma : (smma[1] * (length - 1) + src) / length
smma
v1 = smma(hl2, 15)
v2 = smma(hl2, 19)
v3 = smma(hl2, 25)
v4 = smma(hl2, 29)
bullish = v1 > v2 and v2 > v3 and v3 > v4
bearish = v1 < v2 and v2 < v3 and v3 < v4
neutral = not bullish and not bearish
c = bullish ? color.rgb(255,192,0) : neutral ? color.rgb(115,115,115) : color.navy
line1 = plot(v1, 'Line 1', color=c)
line2 = plot(v4, 'Line 2', color=c)
fill(line1, line2, color=c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment