Untitled
unknown
plain_text
a year ago
2.3 kB
51
Indexable
//@version=5
indicator('[blackcat] L1 Institutional Golden Bottom Indicator', 'L1 IGBI', overlay=false)
// Function def
xsa(src, len, wei) =>
sum = 0.0
ma = 0.0
out = 0.0
sum := nz(sum[1]) - nz(src[len]) + src
ma := na(src[len]) ? na : sum / len
out := na(out[1]) ? ma : (src * wei + out[1] * (len - wei)) / len
out
// Function to calculate the institutional golden bottom indicator
calculate_institutional_golden_bottom(close, high, low, threshold) =>
// Calculate institution
institution = xsa(100 * (close - ta.lowest(low, 34)) / (ta.highest(high, 34) - ta.lowest(low, 34)), 3, 1)
// Calculate var000 and subsequent moving averages
var000 = (close - ta.lowest(low, 60)) / (ta.highest(high, 60) - ta.lowest(low, 60)) * 100
var003 = xsa(var000, 3, 1)
var001 = xsa(var003, 4, 1) - 50
var002 = var001[1] < var001
// Calculate institutional golden bottom
institutionGoldenBottom = var002 and ta.crossover(institution, threshold) ? 15 : 0
// Calculate a1, b1, c1, d1
a1 = var002 and ta.crossover(institution, threshold) ? 33 : 0
b1 = var002 and ta.crossover(institution, threshold) ? 55 : 0
c1 = var002 and ta.crossover(institution, threshold) ? 77 : 0
d1 = var002 and ta.crossover(institution, threshold) ? 99 : 0
// Return the results as an array
[institution, institutionGoldenBottom, a1, b1, c1, d1]
// Input for the threshold
threshold = input(25, 'Institution Threshold')
// Calculate the institutional golden bottom indicator
[institution, institutionGoldenBottom, a1, b1, c1, d1] = calculate_institutional_golden_bottom(close, high, low, threshold)
// Plotting the results
plot(institution, color=color.new(color.blue, 40), linewidth=4, title='Institution')
plot(institutionGoldenBottom, color=color.new(color.yellow, 0), title='Institutional Golden Bottom')
plot(a1, color=color.new(color.yellow, 0), title='a1')
plot(b1, color=color.new(color.yellow, 0), title='b1')
plot(c1, color=color.new(color.yellow, 0), title='c1')
plot(d1, color=color.new(color.yellow, 0), title='d1')
// Plotting labels
if institutionGoldenBottom == 15
label.new(bar_index, 0, 'Institutional golden bottom', color=color.fuchsia, textcolor=color.white)
Editor is loading...
Leave a Comment