Advertisement
xmd79

Osmosis [ChartPrime]

Jan 20th, 2024
408
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.37 KB | None | 1 0
  1. //@version=5
  2. indicator("Osmosis [ChartPrime]", precision = 0, explicit_plot_zorder = true, max_labels_count = 500)
  3.  
  4. type palette
  5. color black = #000000
  6. color blue = #0000FF
  7. color cyan = #00FCFC
  8. color green = #00FF00
  9. color yellow = #FFFF00
  10. color red = #FF0000
  11. color very_high = #501414
  12. color cooked = #330e0e
  13. color top = #107906
  14. color bottom = #8e11a7
  15. int max_top_alpha = 0
  16. int max_bottom_alpha = 0
  17. int min_top_alpha = 0
  18. int min_bottom_alpha = 0
  19. int fill_alpha_max = 50
  20. int fill_alpha_min = 50
  21.  
  22. alt_source = input.source(close, "Alternate Source", inline = "Source", group = "Source")
  23. alt_enable = input.bool(false, "", inline = "Source", group = "Source")
  24.  
  25. style = input.string(
  26. "Normalized MACD"
  27. , "Style"
  28. , ["MACD Histogram", "Normalized MACD", "Slow MACD", "MACD Percent Rank", "MA Delta", "BB Width", "BB Width Percentile"
  29. , "Stochastic" , "RSI", "True Range OSC", "Normalized Volume", "Volume Delta", "True Range", "Rate of Change", "OBV"
  30. , "MFI", "Trend Angle"]
  31. , group = "Settings")
  32.  
  33. len_norm = input.int(90, "Lookback", minval = 1, group = "Settings")
  34. len_mad = input.int(4, "Delta Length", minval = 1, maxval = 10, group = "Settings")
  35. half_range = input.bool(false, "Fast Mode", group = "Settings")
  36. smoothing_length = input.int(2, "Enable Smoothing", minval = 1, maxval = 6, group = "Settings", inline = "Smooth")
  37. filter = input.bool(false, "", group = "Settings", inline = "Smooth")
  38.  
  39. highlight_max = input.bool(true, "Max Region", group = "Max Regions")
  40. max_threshold = input.float(71, "Max Threshold", minval = 50, maxval = 100, group = "Max Regions")
  41. max_min_size = input.int(5, "Minimum Max Width", minval = 0, maxval = 30, group = "Max Regions")
  42. max_color_color = input.color(#107906, "Max Region Color", group = "Max Regions")
  43. max_top_alpha = input.int(0, "Max Top Line Alpha", minval = 0, maxval = 100, group = "Max Regions")
  44. max_bottom_alpha = input.int(0, "Max Bottom Line Alpah", minval = 0, maxval = 100, group = "Max Regions")
  45. max_line_size = input.int(3, "Line Width", minval = 1, maxval = 4, group = "Max Regions")
  46. max_region_start = input.string("Bottom", "Region Start Indication", ["Both", "Top", "Bottom", "None"], group = "Max Regions")
  47. fill_max = input.bool(true, "Fill Max", inline = "BC", group = "Max Regions")
  48. fill_alpha_max = input.int(75, "", inline = "BC", group = "Max Regions")
  49.  
  50. highlight_min = input.bool(true, "Minimum Region", group = "Minimum Regions")
  51. min_threshold = input.float(28, "Minimum Threshold", minval = 0, maxval = 50, group = "Minimum Regions")
  52. min_min_size = input.int(5, "Minimum Minimum Width", minval = 0, maxval = 30, group = "Minimum Regions")
  53. min_color = input.color(#8e11a7, "Minimum Region Color", group = "Minimum Regions")
  54. min_top_alpha = input.int(0, "Minimum Top Line Alpha", minval = 0, maxval = 100, group = "Minimum Regions")
  55. min_bottom_alpha = input.int(0, "Minimum Bottom Line Alpha", minval = 0, maxval = 100, group = "Minimum Regions")
  56. min_line_size = input.int(3, "Line Width", minval = 1, maxval = 4, group = "Minimum Regions")
  57. min_region_start = input.string("Bottom", "Region Start Indication", ["Both", "Top", "Bottom", "None"], group = "Minimum Regions")
  58. fill_min = input.bool(true, "Fill Minimum", inline = "bc", group = "Minimum Regions")
  59. fill_alpha_min = input.int(75, "", inline = "bc", group = "Minimum Regions")
  60.  
  61. preset_colors = input.string("Prime", "Color Presets", ["User", "Prime", "Standard"], group = "Gradient")
  62. invert = input.bool(false, "Invert Color Scale", group = "Gradient")
  63. black = input.color(#000000, "", group = "Gradient", inline = "Grad")
  64. blue = input.color(#0000FF, "", group = "Gradient", inline = "Grad")
  65. cyan = input.color(#00FCFC, "", group = "Gradient", inline = "Grad")
  66. green = input.color(#00FF00, "", group = "Gradient", inline = "Grad")
  67. yellow = input.color(#FFFF00, "", group = "Gradient", inline = "Grad")
  68. red = input.color(#FF0000, "", group = "Gradient", inline = "Grad")
  69. very_high = input.color(#501414, "", group = "Gradient", inline = "Grad")
  70. cooked = input.color(#330e0e, "", group = "Gradient", inline = "Grad")
  71.  
  72. preset = switch preset_colors
  73. "User" => palette.new(
  74. black
  75. , blue
  76. , cyan
  77. , green
  78. , yellow
  79. , red
  80. , very_high
  81. , cooked
  82. , max_color_color
  83. , min_color
  84. , max_top_alpha
  85. , max_bottom_alpha
  86. , min_top_alpha
  87. , min_bottom_alpha
  88. , fill_alpha_max
  89. , fill_alpha_min
  90. )
  91.  
  92. "Prime" => palette.new(#00000040, #FF000040, #ff910040, #FFFF0040, #9dff0040, #00a10040, #00580040, #13311340, #00FF00, #FF0000, 100, 0, 100, 0, 75, 75)
  93. "Standard" => palette.new()
  94.  
  95. method find_streak(float[] self, float threshold, bool is_above, int min_count, bool enable) =>
  96. streak = 0
  97. int streak_start_index = na
  98. max_streak = 0
  99. int max_streak_start_index = na
  100. int max_streak_end_index = na
  101.  
  102. if enable
  103. i = 0
  104.  
  105. while i < array.size(self) - 1
  106. if max_streak > array.size(self) - 1
  107. break
  108.  
  109. current = array.get(self, i)
  110.  
  111. if (is_above and current >= threshold) or (not is_above and current <= threshold)
  112. streak := 1
  113. j = i + 1
  114.  
  115. while j < array.size(self) - 1 and ((is_above and array.get(self, j) >= threshold) or (not is_above and array.get(self, j) <= threshold))
  116. streak := streak + 1
  117. j := j + 1
  118.  
  119. if streak > max_streak
  120. max_streak := streak
  121. max_streak_start_index := i
  122. max_streak_end_index := j + 1
  123.  
  124. i := j
  125.  
  126. else
  127. i := i + 1
  128.  
  129. if max_streak >= min_count
  130. [max_streak_end_index, max_streak_start_index]
  131.  
  132. else
  133. [na, na]
  134.  
  135.  
  136. grad(src)=>
  137. source = invert ? 100 - src : src
  138.  
  139. var color grad = na
  140.  
  141. if source >= 0 and source < 1/7. * 100
  142. grad := color.from_gradient(source, 0, 1/7. * 100, preset.black, preset.blue)
  143.  
  144. else if source >= 1/7. * 100 and source < 2/7. * 100
  145. grad := color.from_gradient(source, 1/7. * 100, 2/7. * 100, preset.blue, preset.cyan)
  146.  
  147. else if source >= 2/7. * 100 and source < 50
  148. grad := color.from_gradient(source, 2/7. * 100, 50, preset.cyan, preset.green)
  149.  
  150. else if source >= 50 and source < 5/7. * 100
  151. grad := color.from_gradient(source, 50, 5/7. * 100, preset.green, preset.yellow)
  152.  
  153. else if source >= 5/7. * 100 and source < 6/7. * 100
  154. grad := color.from_gradient(source, 5/7. * 100, 6/7. * 100, preset.yellow, preset.red)
  155.  
  156. else if source >= 6/7. * 100 and source <= 99
  157. grad := color.from_gradient(source, 6/7. * 100, 99, preset.red, preset.very_high)
  158.  
  159. else if source > 99 and source <= 100
  160. grad := color.from_gradient(source, 99, 100, preset.very_high, preset.cooked)
  161.  
  162. normalize(source, len) =>
  163. (source - ta.lowest(source, len))/(ta.highest(source, len) - ta.lowest(source, len)) * 100
  164.  
  165. diff(float _source, len_mad) =>
  166. float smooth_diff = 0.0
  167.  
  168. if len_mad == 1
  169. smooth_diff := (_source - _source[1]) / 1
  170. smooth_diff
  171.  
  172. if len_mad == 2
  173. smooth_diff := (_source - _source[2]) / 2
  174. smooth_diff
  175.  
  176. else if len_mad == 3
  177. smooth_diff := (_source + _source[1] - _source[2] - _source[3]) / 4
  178. smooth_diff
  179.  
  180. else if len_mad == 4
  181. smooth_diff := (_source + 2 * _source[1] - 2 * _source[3] - _source[4]) / 8
  182. smooth_diff
  183.  
  184. else if len_mad == 5
  185. smooth_diff := (_source + 3 * _source[1] + 2 * _source[2] - 2 * _source[3] - 3 * _source[4] - _source[5]) / 16
  186. smooth_diff
  187.  
  188. else if len_mad == 6
  189. smooth_diff := (_source + 4 * _source[1] + 5 * _source[2] - 5 * _source[4] - 4 * _source[5] - _source[6]) / 32
  190. smooth_diff
  191.  
  192. else if len_mad == 7
  193. smooth_diff := (_source + 5 * _source[1] + 9 * _source[2] + 5 * _source[3] - 5 * _source[4] - 9 * _source[5] - 5 * _source[6] - _source[7]) / 64
  194. smooth_diff
  195.  
  196. else if len_mad == 8
  197. smooth_diff := (_source + 6 * _source[1] + 14 * _source[2] + 14 * _source[3] - 14 * _source[5] - 14 * _source[6] - 6 * _source[7] - _source[8]) / 128
  198. smooth_diff
  199.  
  200. else if len_mad == 9
  201. smooth_diff := (_source + 7 * _source[1] + 20 * _source[2] + 28 * _source[3] + 14 * _source[4] - 14 * _source[5] - 28 * _source[6] - 20 * _source[7] - 7 * _source[8] - _source[9]) / 256
  202. smooth_diff
  203.  
  204. else if len_mad == 10
  205. smooth_diff := (_source + 8 * _source[1] + 27 * _source[2] + 48 * _source[3] + 42 * _source[4] - 42 * _source[6] - 48 * _source[7] - 27 * _source[8] - 8 * _source[9] - _source[10]) / 512
  206. smooth_diff
  207.  
  208. smooth_diff
  209.  
  210. ema(float source = close, float length = 9)=>
  211. alpha = 2 / (length + 1)
  212. var float smoothed = na
  213. smoothed := alpha * source + (1 - alpha) * nz(smoothed[1])
  214.  
  215. stdev(x, n)=>
  216. out = math.sqrt(math.sum(math.pow(x - ta.ema(x, n), 2), n) * 0.5) * 0.5
  217. out
  218.  
  219. cwma(float source, int length)=>
  220. sum = 0.
  221. weights = 0
  222. even = length * 2
  223.  
  224. for i = 0 to even - 1
  225. j = i + 1
  226. k = even - j + 1
  227. w = (j <= even / 2 ? j : k)
  228. sum += source[i] * w
  229. weights += w
  230.  
  231. sum / weights
  232.  
  233. filter(src, filter)=>
  234. filter ? cwma(src, smoothing_length) : src
  235.  
  236. rsi(source, len) =>
  237. rsi = ta.rsi(source, len)
  238. f = -math.pow(math.abs(math.abs(rsi - 50) - 50), 1 + math.pow(len / 14, 0.618) - 1) / math.pow(50, math.pow(len / 14, 0.618) - 1) + 50
  239. rsia = if rsi > 50
  240. f + 50
  241. else
  242. -f + 50
  243. rsia
  244.  
  245. average_true_range(source, length)=>
  246. true_range = high - low
  247. _range = math.abs(open - close)
  248. a_range = (true_range * 2 + _range)/3
  249. average_true_range = ta.rma(a_range, length)
  250.  
  251. tr_score(source, length)=>
  252. mean = ta.sma(source, length)
  253. tr = average_true_range(source, length)
  254. z_score = (source - mean)/tr
  255.  
  256. max(source, outlier_level, dev_lookback)=>
  257. var float mx = na
  258. src = array.new<float>()
  259. stdev = math.abs((source - ta.ema(source, dev_lookback))/ta.stdev(source, dev_lookback))
  260. array.push(src, stdev < outlier_level ? source : -1.7976931348623157e+308)
  261. mx := math.max(nz(mx[1]), array.get(src, 0))
  262.  
  263. min(source, outlier_level, dev_lookback) =>
  264. var float min = na
  265. src = array.new<float>()
  266. stdev = math.abs((source - ta.ema(source, dev_lookback))/ta.stdev(source, dev_lookback))
  267. array.push(src, stdev < outlier_level ? source : 1.7976931348623157e+308)
  268. min := math.min(nz(min[1]), array.get(src, 0))
  269.  
  270. min_max(src, outlier_level, dev_lookback) =>
  271. out = (src - min(src, outlier_level, dev_lookback))/(max(src, outlier_level, dev_lookback) - min(src, outlier_level, dev_lookback)) * 100
  272. math.max(math.min(100, out), 0)
  273.  
  274. tr_osc(source, length, smooth)=>
  275. true_rance_osc = min_max(ta.sma(tr_score(source, length), smooth), 1, length)
  276.  
  277. trend_angle(src, length)=>
  278. atr = ta.atr(length)
  279. slope = (src - src[length]) / atr
  280. angle_rad = math.atan(slope)
  281. degrees = filter((math.todegrees(angle_rad) + 90) / 180 * 100, filter)
  282.  
  283. half(n)=>
  284. half_range ? math.max(1, int(n/2)) : n
  285.  
  286. indicator_picker(n)=>
  287. src = filter(alt_enable ? alt_source : close, filter)
  288. alt_high = filter(alt_enable ? alt_source : high, filter)
  289. alt_low = filter(alt_enable ? alt_source : low, filter)
  290.  
  291. ret = style == "Normalized MACD" ? (n == 1 ? normalize(ta.ema(src, half(3)) - ta.ema(src, half(5)), len_norm) : normalize(ta.ema(src, half(5)) - ta.ema(src, 1 + (half(6) * n)), len_norm)) :
  292. style == "MACD Histogram" ? normalize((ema(src, half(2) * n * 0.5 + 2) - ema(src, half(4) * n * 0.5 + 2)) - ema(ema(src, half(2) * n * 0.5 + 2) - ema(src, half(4) * n * 0.5 + 2), 9), len_norm) :
  293. style == "MACD Percent Rank" ? ta.percentrank(ta.ema(src, half(5)) - ta.ema(src, 1 + (half(6) * n)) , len_norm) :
  294. style == "Slow MACD" ? normalize(ta.ema(src, half(15)) - ta.ema(src, half(20) + n * half(5)), len_norm) :
  295. style == "RSI" ? rsi(filter(src, true), half(2) * n) :
  296. style == "True Range OSC" ? tr_osc(src, half(2) * n, 3) :
  297. style == "Normalized Volume" ? normalize(filter(ta.wma(volume, 1 + (half(3) * (n - 1))), filter), len_norm) :
  298. style == "Volume Delta" ? normalize(filter(diff(ta.wma(volume, 1 + (half(3) * (n - 1))), len_mad), filter), len_norm) :
  299. style == "MA Delta" ? normalize(diff(ta.ema(src, half(6) * n), len_mad), len_norm) :
  300. style == "True Range" ? normalize(ta.rma(high - low, half(2) * n), len_norm) :
  301. style == "Rate of Change" ? normalize(ta.roc(src, n * half(3)), len_norm) :
  302. style == "OBV" ? normalize(filter(ta.obv - ta.wma(ta.obv, 2 + half(2) * n), filter), len_norm) :
  303. style == "MFI" ? normalize(ta.mfi(filter(hlc3, filter), half(3) + n), len_norm) :
  304. style == "BB Width" ? normalize(((ta.sma(src, 5 + n * half(5)) + ta.stdev(src, 5 + n * half(5))) - (ta.sma(src, 5 + n * half(5)) - ta.stdev(src, 5 + n * half(5))))/ta.sma(src, 5 + n * half(5)), len_norm) :
  305. style == "BB Width Percentile" ? ta.percentrank(((ta.sma(src, 5 + n * half(5)) + ta.stdev(src, 5 + n * half(5))) - (ta.sma(src, 5 + n * half(5)) - ta.stdev(src, 5 + n * half(5))))/ta.sma(src, 5 + n * half(5)), len_norm) :
  306. style == "Stochastic" ? ta.sma(ta.stoch(src, alt_high, alt_low, half(2) * n), 3) :
  307. style == "Trend Angle" ? trend_angle(close, half(2) * n) :
  308. na
  309.  
  310. heatmap(src)=>
  311. heatmap = grad(src)
  312.  
  313. // heatmap_1 = heatmap(1)
  314. indi_2 = indicator_picker(2)
  315. indi_3 = indicator_picker(3)
  316. indi_4 = indicator_picker(4)
  317. indi_5 = indicator_picker(5)
  318. indi_6 = indicator_picker(6)
  319. indi_7 = indicator_picker(7)
  320. indi_8 = indicator_picker(8)
  321. indi_9 = indicator_picker(9)
  322. indi_10 = indicator_picker(10)
  323. indi_11 = indicator_picker(11)
  324. indi_12 = indicator_picker(12)
  325. indi_13 = indicator_picker(13)
  326. indi_14 = indicator_picker(14)
  327. indi_15 = indicator_picker(15)
  328. indi_16 = indicator_picker(16)
  329. indi_17 = indicator_picker(17)
  330. indi_18 = indicator_picker(18)
  331. indi_19 = indicator_picker(19)
  332. indi_20 = indicator_picker(20)
  333. indi_21 = indicator_picker(21)
  334. indi_22 = indicator_picker(22)
  335. indi_23 = indicator_picker(23)
  336. indi_24 = indicator_picker(24)
  337. indi_25 = indicator_picker(25)
  338. indi_26 = indicator_picker(26)
  339. indi_27 = indicator_picker(27)
  340.  
  341. indi_array = array.from(
  342. indi_2
  343. , indi_3
  344. , indi_4
  345. , indi_5
  346. , indi_6
  347. , indi_7
  348. , indi_8
  349. , indi_9
  350. , indi_10
  351. , indi_11
  352. , indi_12
  353. , indi_13
  354. , indi_14
  355. , indi_15
  356. , indi_16
  357. , indi_17
  358. , indi_18
  359. , indi_19
  360. , indi_20
  361. , indi_21
  362. , indi_22
  363. , indi_23
  364. , indi_24
  365. , indi_25
  366. , indi_26
  367. , indi_27)
  368.  
  369. [max_top, max_bottom] = indi_array.find_streak(max_threshold, true, max_min_size, highlight_max)
  370. [min_top, min_bottom] = indi_array.find_streak(min_threshold, false, min_min_size, highlight_min)
  371.  
  372.  
  373. heatmap_2 = grad(indi_2 )
  374. heatmap_3 = grad(indi_3 )
  375. heatmap_4 = grad(indi_4 )
  376. heatmap_5 = grad(indi_5 )
  377. heatmap_6 = grad(indi_6 )
  378. heatmap_7 = grad(indi_7 )
  379. heatmap_8 = grad(indi_8 )
  380. heatmap_9 = grad(indi_9 )
  381. heatmap_10 = grad(indi_10)
  382. heatmap_11 = grad(indi_11)
  383. heatmap_12 = grad(indi_12)
  384. heatmap_13 = grad(indi_13)
  385. heatmap_14 = grad(indi_14)
  386. heatmap_15 = grad(indi_15)
  387. heatmap_16 = grad(indi_16)
  388. heatmap_17 = grad(indi_17)
  389. heatmap_18 = grad(indi_18)
  390. heatmap_19 = grad(indi_19)
  391. heatmap_20 = grad(indi_20)
  392. heatmap_21 = grad(indi_21)
  393. heatmap_22 = grad(indi_22)
  394. heatmap_23 = grad(indi_23)
  395. heatmap_24 = grad(indi_24)
  396. heatmap_25 = grad(indi_25)
  397. heatmap_26 = grad(indi_26)
  398. heatmap_27 = grad(indi_27)
  399.  
  400. plot(1 , 'MA-2' , heatmap_2, style = plot.style_area, histbase = 0 , editable = false, display = display.pane)
  401. plot(2 , 'MA-4' , heatmap_3, style = plot.style_area, histbase = 1 , editable = false, display = display.pane)
  402. plot(3 , 'MA-6' , heatmap_4, style = plot.style_area, histbase = 2 , editable = false, display = display.pane)
  403. plot(4 , 'MA-8' , heatmap_5, style = plot.style_area, histbase = 3 , editable = false, display = display.pane)
  404. plot(5 , 'MA-10', heatmap_6, style = plot.style_area, histbase = 4 , editable = false, display = display.pane)
  405. plot(6 , 'MA-12', heatmap_7, style = plot.style_area, histbase = 5 , editable = false, display = display.pane)
  406. plot(7 , 'MA-14', heatmap_8, style = plot.style_area, histbase = 6 , editable = false, display = display.pane)
  407. plot(8 , 'MA-16', heatmap_9, style = plot.style_area, histbase = 7 , editable = false, display = display.pane)
  408. plot(9 , 'MA-18', heatmap_10, style = plot.style_area, histbase = 8 , editable = false, display = display.pane)
  409. plot(10, 'MA-20', heatmap_11, style = plot.style_area, histbase = 9 , editable = false, display = display.pane)
  410. plot(11, 'MA-22', heatmap_12, style = plot.style_area, histbase = 10, editable = false, display = display.pane)
  411. plot(12, 'MA-24', heatmap_13, style = plot.style_area, histbase = 11, editable = false, display = display.pane)
  412. plot(13, 'MA-26', heatmap_14, style = plot.style_area, histbase = 12, editable = false, display = display.pane)
  413. plot(14, 'MA-28', heatmap_15, style = plot.style_area, histbase = 13, editable = false, display = display.pane)
  414. plot(15, 'MA-30', heatmap_16, style = plot.style_area, histbase = 14, editable = false, display = display.pane)
  415. plot(16, 'MA-32', heatmap_17, style = plot.style_area, histbase = 15, editable = false, display = display.pane)
  416. plot(17, 'MA-34', heatmap_18, style = plot.style_area, histbase = 16, editable = false, display = display.pane)
  417. plot(18, 'MA-36', heatmap_19, style = plot.style_area, histbase = 17, editable = false, display = display.pane)
  418. plot(19, 'MA-38', heatmap_20, style = plot.style_area, histbase = 18, editable = false, display = display.pane)
  419. plot(20, 'MA-40', heatmap_21, style = plot.style_area, histbase = 19, editable = false, display = display.pane)
  420. plot(21, 'MA-40', heatmap_22, style = plot.style_area, histbase = 20, editable = false, display = display.pane)
  421. plot(22, 'MA-40', heatmap_23, style = plot.style_area, histbase = 21, editable = false, display = display.pane)
  422. plot(23, 'MA-40', heatmap_24, style = plot.style_area, histbase = 22, editable = false, display = display.pane)
  423. plot(24, 'MA-40', heatmap_25, style = plot.style_area, histbase = 23, editable = false, display = display.pane)
  424. plot(25, 'MA-40', heatmap_26, style = plot.style_area, histbase = 24, editable = false, display = display.pane)
  425. plot(26, 'MA-40', heatmap_27, style = plot.style_area, histbase = 25, editable = false, display = display.pane)
  426.  
  427. alpha = color.new(color.black, 100)
  428.  
  429.  
  430. bullish_top = plot(max_top, "Bullish Region Top", color.new(preset.top, preset.max_top_alpha), max_line_size, plot.style_linebr, display = display.pane)
  431. bullish_bottom = plot(max_bottom, "Bullish Region Bottom", color.new(preset.top, preset.max_bottom_alpha), max_line_size, plot.style_linebr, display = display.pane)
  432.  
  433. bearish_top = plot(min_top, "Bearish Region Top", color.new(preset.bottom, preset.min_top_alpha), min_line_size, plot.style_linebr, display = display.pane)
  434. bearish_bottom = plot(min_bottom, "Bearish Region Bottom", color.new(preset.bottom, preset.min_bottom_alpha), min_line_size, plot.style_linebr, display = display.pane)
  435.  
  436. fill(bullish_top, bullish_bottom, fill_max ? color.new(preset.top, preset.fill_alpha_max) : alpha, "Bullish Region Fill")
  437. fill(bearish_top, bearish_bottom, fill_min ? color.new(preset.bottom, preset.fill_alpha_min) : alpha, "Bearish Region Fill")
  438.  
  439. if not na(max_bottom) and na(max_bottom[1])
  440. if max_region_start == "Top" or max_region_start == "Both"
  441. label.new(bar_index, max_top, "⬤", style = label.style_text_outline, textcolor = preset.top, color = alpha, size = size.normal)
  442.  
  443. if max_region_start == "Bottom" or max_region_start == "Both"
  444. label.new(bar_index, max_bottom, "⬤", style = label.style_text_outline, textcolor = preset.top, color = alpha, size = size.normal)
  445.  
  446. if not na(min_bottom) and na(min_bottom[1])
  447. if min_region_start == "Top" or min_region_start == "Both"
  448. label.new(bar_index, min_top, "⬤", style = label.style_text_outline, textcolor = preset.bottom, color = alpha, size = size.normal)
  449.  
  450. if min_region_start == "Bottom" or min_region_start == "Both"
  451. label.new(bar_index, min_bottom, "⬤", style = label.style_text_outline, textcolor = preset.bottom, color = alpha, size = size.normal)
  452.  
  453.  
  454.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement