-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGodMode-noMulti-Exchange
69 lines (58 loc) · 4.27 KB
/
GodMode-noMulti-Exchange
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// @authors LazyBear, xSilas, Ni6HTH4wK,sco77m4r7in, oh92,
// Drop a line if you use or modify this code.
//modified by sco77m4r7in and oh92 -- updated and fixed multi exchange error, and added addtional caution dots.
// modified by scilentor, integrated LSMA indicator with settings 25, 0
///modified by Rzgar Espo - added volume thresholds - Converted from Pine v3 to Pine v5. Replaced rsi() with 100.0 - (100.0 / (1.0 + A/B). Removed BTC Multi-Exchange so godmode calculation can be used for any security.Add bar colors based on LSMA level.Added 4hline. Added option to hide pressure circles. Changed LSMA length to 32 (Trend detector length for Bollinger Bands with 4 StdDev 20 or 27 MA basis)
//@version=5
indicator(title="GodMode Oscillator", shorttitle="GM LSMA RSI", precision=2, timeframe="", timeframe_gaps=true)
// Length Settings
src = input(close, "Source")
length = input.int(32, title="LSMA Length", minval=5, maxval=500)
n1 = input.int(15, "TCI Channel Length")
n2 = input.int(9, "Willy Average Length")
n3 = input.int(3, "MF length")
n4 = input.int(6, "Godmode SMA length", tooltip="Red SMA Plot")
lsmaBcOn = input.bool(false, title="Bar Colors", tooltip="Show/Hide LSMA level bar colors")
volumeBcOn = input.bool(true, title="Volume Colors", tooltip="Show/Hide volume bar colors")
pressOn = input.bool(true, title="Overbought & Oversold dots", tooltip="Show/Hide caution, Alert, Warning circles")
enableTradition = input.bool(false, "Enable Tradition Calculation")
// Formulas & Calculations
tci(src) => ta.ema((src - ta.ema(src, n1)) / (0.025 * ta.ema(math.abs(src - ta.ema(src, n1)), n1)), n2) + 50
mf(src) => 100.0 - (100.0 / (1.0 + math.sum(volume * (ta.change(src) <= 0 ? 0 : src), n3) / math.sum(volume * (ta.change(src) >= 0 ? 0 : src), n3)))
willy(src) => 60 * (src - ta.highest(src, n2)) / (ta.highest(src, n2) - ta.lowest(src, n2)) + 80
csi(src) => math.avg(ta.rsi(src, n3), ta.tsi(src, n1, n2) * 100)
godmode(src) => math.avg(tci(src), csi(src), mf(src), willy(src))
tradition(src) => math.avg(tci(src), mf(src), ta.rsi(src, n3))
wt1 = enableTradition ? tradition(src) : godmode(src)
wt2 = ta.sma(wt1, n4)
lsma = ta.linreg(wt1, length,0)
// Color change condition
//barColor = lsma > 50 ? color.green : color.orange
lsmaBarColors = lsma > 55 and lsma < 85 ? color.green : lsma > 85 and lsma < 120 ? color.orange : lsma < 50 and lsma > 23 ? color.rgb(247, 133, 133) : lsma < 23 ? color.red : color.blue
// Volume thresholds
ultraHighVolume = 3* ta.sma(volume, 20)
highVolume = 1.5 * ta.sma(volume, 20)
averageVolume = ta.sma(volume, 20)
lowVolume = 0.5 * ta.sma(volume, 20)
// Bar colors based on volume levels
volumeBarColors = (volume >= ultraHighVolume ? color.red : volume >= highVolume ? color.yellow : volume >= averageVolume ? color.green : color.blue)
// Blue, Red, Green, Gray, Pressure Plots
plot(lsma, "LSMA", color=color.blue, linewidth=3)
plot(wt2, "Red SMA", color=color.rgb(242, 54, 69, 0), linewidth=2)
plot(wt1, "Fast line", color=color.green, linewidth=1)
plot(ta.ema((wt1 - wt2) * 2 + 50, n3), "Volume Energy", color=color.rgb(178, 181, 190, 69), style=plot.style_area, histbase=50)
plot(pressOn ? wt2 < 25 ? wt2 + 5 : wt2 > 75 ? wt2 - 5 : na : na, title="Caution", color=color.aqua, style=plot.style_circles, linewidth=2)
plot(pressOn ? wt2 < 20 ? wt2 + 5 : wt2 > 80 ? wt2 - 5 : na : na, title="Alert", color=color.yellow, style=plot.style_circles, linewidth=2)
plot(pressOn ? wt2 < 15 ? wt2 + 5 : wt2 > 85 ? wt2 - 5 : na : na, title="Warning", color=color.red, style=plot.style_circles, linewidth=3)
// Line with fib values (pleasing to the eyes)
fillH1 = hline(100, "level 100", color=color.red, linestyle=hline.style_solid)
hline(78.6, "level 80", color=color.orange, linestyle=hline.style_dashed)
hline(61.8, "level 60", color=color.gray, linestyle=hline.style_dashed)
hline(50, "Base line", color=color.blue, linestyle=hline.style_solid)
hline(38.2, "level 40", color=color.gray, linestyle=hline.style_dashed)
hline(23.6, "level 20", color=color.orange, linestyle=hline.style_dashed)
fillH0 = hline(0, "level 0", color=color.red, linestyle=hline.style_solid)
fill(fillH0, fillH1, color=color.new(color.gray, 85), title="Background Fill")
// Set bar color based on LSMA value
barcolor(lsmaBcOn ? lsmaBarColors: na, title = "LSMA Colors")
barcolor(volumeBcOn ? volumeBarColors: na, title = "Volume Colors")