name
stringlengths
1
64
url
stringlengths
44
135
author
stringlengths
3
30
author_url
stringlengths
34
61
likes_count
int64
0
33.2k
kind
stringclasses
3 values
pine_version
int64
1
5
license
stringclasses
3 values
source
stringlengths
177
279k
[TT$] Trade Tracker - By BlueJayBird
https://www.tradingview.com/script/l6O1oJtR-TT-Trade-Tracker-By-BlueJayBird/
BlueJayBird
https://www.tradingview.com/u/BlueJayBird/
319
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © BlueJayBird //@version=5 indicator(title='[TT$] Trade Tracker - By BlueJayBird', shorttitle='TT$', overlay=true) // === GLOBAL SCOPE VARIABLES nl = '\n' // Main Colors green_bull = color.new(#26a69a, 0) // Classi Green red_bear = color.new(#ef5350, 0) // Classi Red // ========================================================================= // // ------------------------------> FUNCTIONS <------------------------------ // // ========================================================================= // // >> Round numbers // → Credits: PineCoders felas. f_round(_value, _decimals) => if _decimals == -1 _value else _power = math.pow(10, _decimals) math.round((math.abs(_value) * _power) / _power * math.sign(_value), 2) // >> To string f_string_helper(_prefix, _variable, _round, _suffix) => _res = str.tostring(f_round(_variable, _round)) _prefix + ': ' + _res + ' ' + _suffix + nl // >> Get bar_index from timestamp f_barindex_from_timestamp(_timestamp) => bartime = int(ta.change(time)) math.floor((timenow - _timestamp) / bartime) // >> Function returning the sub-string of `_str` to the left of the `_of` separating character. // → Credits: https://www.tradingview.com/script/l0wdrsUO-String-Manipulation-Framework-PineCoders-FAQ/ f_strLeftOf(_str, _of) => // string _str: string to separate. // string _op : separator character. string[] _chars = str.split(_str, "") int _len = array.size(_chars) int _ofPos = array.indexof(_chars, _of) string[] _substr = array.new_string(0) if _ofPos > 0 and _ofPos <= _len - 1 _substr := array.slice(_chars, 0, _ofPos) string _return = array.join(_substr, "") // === Settings // Enablers enable_trade_tracker = input.bool(defval=true, title='Trade Tracker Indicator', tooltip='For better tracking your trades, both shorts and longs.', group='Settings') enable_tt_emojis = input.bool(defval=false, title='Emojis 😉', group='Settings') enable_tt_labels = input.bool(defval=true, title='Data Pane 📐', group='Settings') // Timezone tt_time_zone_input = input.string(defval='GMT-3 Argentina Time (ART)', title='Current Timezone', options=['GMT+1 Central European Time (CET)', 'GMT+2 Eastern European Time (EET)', 'GMT+3 Moscow Time (MSK)', 'GMT+4 Armenia Time (AMT)', 'GMT+5 Pakistan Standard Time (PKT)', 'GMT+6 Omsk Time (OMSK)', 'GMT+7 Kranoyask Time (KRAT)', 'GMT+8 China Standard Time (CST)', 'GMT+9 Japan Standard Time (JST)', 'GMT+10 Eastern Australia Standard Time (AEST)', 'GMT+11 Sakhalin Time (SAKT)', 'GMT+12 New Zealand Standard Time (NZST)', 'GMT+0 Greenwich Mean Time (GMT)', 'GMT-1 West Africa Time (WAT)', 'GMT-2 Azores Time (AT)', 'GMT-3 Argentina Time (ART)', 'GMT-4 Atlantic Standard Time (AST)', 'GMT-5 Eastern Standard Time (EST)', 'GMT-6 Central Standard Time (CST)', 'GMT-7 Mountain Standard Time (MST)', 'GMT-8 Pacific Standard Time (PST)', 'GMT-9 Alaska Standard Time (AKST)', 'GMT-10 Hawaii Standard Time (HST)', 'GMT-11 Nome Time (NT) X', 'GMT-12 International Date Line West (IDLW)'], group='Settings') tt_time_zone = f_strLeftOf(tt_time_zone_input, ' ') // ========================================================================= // // --------------------------> Trade Tracker <------------------------------ // // ========================================================================= // // === Inputs // Main tt_time = input.time(defval=0, title='⏰ Entry Time', group='Input', confirm=true) // tt_time → tt_entry = input.price(defval=0, title='🎲 Entry ($)', group='Input', confirm=true) tt_target = input.price(defval=0, title='🎯 Target ($)', group='Input', confirm=true) tt_stop = input.float(defval=0.5, title='⛔ Stop-Loss (%)', group='Input') tt_break = input.float(defval=0.26, title='🪓 Break-Even (%)', group='Input') tt_fee = input.float(defval=0.1, title='💱 Fee (%)', group='Input') tt_else = input.price(defval=0, title='👻 Else ($)', group='Input') tt_quote = input.string(defval='', title='Quote',tooltip='Insert suitable quote value for the pair (for example: USD, USDT, etc)', group='Input') // For Base-Quote pairs // Modifiers tt_offset_right = input.int(defval=3, title='Offset Right (🎲🎯👻)', group='Offset') tt_offset_left = input.int(defval=1, title='Offset Left (⛔🪓)', group='Offset') tt_offset_current = input.int(defval=6, title='Offset Current (💲)', group='Offset') tt_label_offset_x = input.int(defval=23, title='Offset Data Pane X📐(Bars)', group='Offset') tt_label_offset_y = input.int(defval=0, title='Offset Data Pane Y📐 ($)', group='Offset') // timestamp(timezone, year, month, day, hour, minute, second) → series[integer] tt_timestamp = timestamp(year(tt_time, tt_time_zone), month(tt_time, tt_time_zone), dayofmonth(tt_time, tt_time_zone), hour(tt_time, tt_time_zone), minute(tt_time, tt_time_zone)) // === Enablers enable_tt_entry = input.bool(defval=true, title='Entry 🎲', group='Emoji Enablers') enable_tt_target = input.bool(defval=true, title='Target 🎯', group='Emoji Enablers') enable_tt_stop = input.bool(defval=true, title='Stop-Loss ⛔', group='Emoji Enablers') enable_tt_break = input.bool(defval=true, title='Break-Even 🪓', group='Emoji Enablers') enable_tt_else = input.bool(defval=false, title='Else 👻', group='Emoji Enablers') enable_tt_current = input.bool(defval=true, title='Current Closing 💲', group='Emoji Enablers') // === Plotting // >> Colors tt_entry_color = color.new(#f4ff04, 0) // Strong Yellow tt_target_color = color.new(color.lime, 0) tt_stop_color = color.new(color.red, 0) tt_break_color = color.new(color.blue, 0) tt_else_color = color.new(color.white, 0) tt_current_color = close >= open ? green_bull : red_bear // >> Line Locations float tt_stop_location = 0.0 float tt_break_location = 0.0 if tt_target <= tt_entry tt_stop_location := tt_entry + tt_entry * (tt_stop / 100) tt_break_location := tt_entry - tt_entry * (tt_break / 100) else tt_stop_location := tt_entry - tt_entry * (tt_stop / 100) tt_break_location := tt_entry + tt_entry * (tt_break / 100) // >> Emojis Left Location tt_offset_left_new = (f_barindex_from_timestamp(tt_time) + tt_offset_left) * -1 // >> Emojis plotchar(series=enable_trade_tracker and enable_tt_emojis and enable_tt_entry ? tt_entry : na, title='Entry', char='🎲', location=location.absolute, color=tt_entry_color , offset=tt_offset_right, size=size.small, show_last=1) plotchar(series=enable_trade_tracker and enable_tt_emojis and enable_tt_target ? tt_target : na, title='Target', char='🎯', location=location.absolute, color=tt_target_color , offset=tt_offset_right, size=size.small, show_last=1) plotchar(series=enable_trade_tracker and enable_tt_emojis and enable_tt_stop ? tt_stop_location : na, title='Stop', char='⛔', location=location.absolute, color=tt_stop_color , offset=tt_offset_left_new, size=size.small, show_last=1) plotchar(series=enable_trade_tracker and enable_tt_emojis and enable_tt_break ? tt_break_location : na, title='Break', char='🪓', location=location.absolute, color=tt_break_color , offset=tt_offset_left_new, size=size.small, show_last=1) plotchar(series=enable_trade_tracker and enable_tt_emojis and enable_tt_current ? close : na, title='Current', char='$', location=location.absolute, color=tt_current_color , offset=tt_offset_current, size=size.small, show_last=1) plotchar(series=enable_trade_tracker and enable_tt_emojis and enable_tt_else ? tt_else : na, title='Else', char='👻', location=location.absolute, color=tt_else_color , offset=tt_offset_right, size=size.small, show_last=1) // >> Lines // TODO: https://stackoverflow.com/questions/62143030/adding-new-line-in-future-price entry_line = line.new(x1=tt_time, y1=tt_entry, x2=time, y2=tt_entry, xloc=xloc.bar_time, extend=extend.none, color=tt_entry_color, style=line.style_solid, width=2) target_line = line.new(x1=tt_time, y1=tt_target, x2=time, y2=tt_target, xloc=xloc.bar_time, extend=extend.none, color=tt_target_color, style=line.style_solid, width=1) stop_line = line.new(x1=tt_time, y1=tt_stop_location, x2=time, y2=tt_stop_location, xloc=xloc.bar_time, extend=extend.none, color=tt_stop_color, style=line.style_solid, width=1) break_line = line.new(x1=tt_time, y1=tt_break_location, x2=time, y2=tt_break_location, xloc=xloc.bar_time, extend=extend.none, color=tt_break_color, style=line.style_solid, width=1) // >> Update Lines line.set_xy2(id=entry_line, x=time, y=tt_entry) line.set_xy2(id=target_line, x=time, y=tt_target) line.set_xy2(id=stop_line, x=time, y=tt_stop_location) line.set_xy2(id=break_line, x=time, y=tt_break_location) // >> Lines Deletion if not enable_trade_tracker line.delete(entry_line) line.delete(target_line) line.delete(stop_line) line.delete(break_line) // // >> Fill Lines // linefill.new(entry_line, stop_line, color.new(color.red, 95)) // linefill.new(entry_line, target_line, color.new(color.green, 95)) // === Boxes var box_stop = box.new(left=time, top=0, right=time, bottom=0, xloc=xloc.bar_time) var box_target = box.new(left=time, top=0, right=time, bottom=0, xloc=xloc.bar_time) // Update boxes box_switch = tt_target <= tt_entry ? tt_entry + tt_entry * (tt_stop / 100) : tt_entry - tt_entry * (tt_stop / 100) // Update Stop Box box.set_lefttop(box_stop, tt_time, tt_entry) box.set_rightbottom(box_stop, time, box_switch) box.set_border_color(box_stop, color.new(color.white, 100)) box.set_bgcolor(box_stop, color.new(color.red, 90)) // Update Target Box box.set_lefttop(box_target, tt_time, tt_entry) box.set_rightbottom(box_target, time, tt_target) box.set_border_color(box_target, color.new(color.white, 100)) box.set_bgcolor(box_target, color.new(color.green, 90)) // Box Deletion if not enable_trade_tracker box.delete(box_stop) box.delete(box_target) // ========================================================================= // // ----------------------> Trade Tracker Data Label <----------------------- // // ========================================================================= // // === Strings // - Declaration tt_text_main = '' tt_splitter = '-------------------------\n' // - Time Format tt_format_1 = '{0,date,medium}' tt_format_2 = '{0,time,medium}' // === Label Presets var label tt_data_id = na label.delete(tt_data_id) tt_data_id := label.new(x=bar_index + tt_label_offset_x, y=tt_entry + tt_label_offset_y, text=tt_text_main, xloc=xloc.bar_index, color=color.new(color.black, 10), style=label.style_label_center, textcolor=color.white, size=size.large, textalign=text.align_left) // === Data Gathering // Getting data from lines // - Target float tt_target_percent = 0.0 tt_target_percent := math.abs(((tt_target - tt_entry) / tt_entry) * 100) // - Current float tt_current_percent = 0.0 tt_current_percent := math.abs(((close - tt_entry) / tt_entry) * 100) // - From Lines tt_stop_value = line.get_y1(stop_line) tt_break_value = line.get_y1(break_line) // === Setting data // Data 1 tt_data_date = str.format(tt_format_1, tt_timestamp) tt_data_time = str.format(tt_format_2, tt_timestamp) tt_data_1a = str.format('🌎 Time Zone: {0}\n', tt_time_zone) tt_data_1b = str.format('📆 Date: {0}\n', tt_data_date) tt_data_1c = str.format('⏰ Time: {0}\n', tt_data_time) tt_dataset_1 = str.format('{0}{1}{2}{3}',tt_data_1a ,tt_data_1b ,tt_data_1c, tt_splitter) // Data 2 tt_data_2a = f_string_helper('🎲 Entry', tt_entry, 2, tt_quote) tt_data_2b = f_string_helper('🎯 Target', tt_target, 2, tt_quote) tt_data_2c = f_string_helper('⛔ Stop', tt_stop_value, 2, tt_quote) tt_data_2d = f_string_helper('🪓 Break', tt_break_value, 2, tt_quote) tt_dataset_2 = str.format('{0}{1}{2}{3}{4}', tt_data_2a, tt_data_2b, tt_data_2c, tt_data_2d, tt_splitter) // Data 3 tt_data_3a = f_string_helper('🎯 Target', tt_target_percent, 2, '%') tt_data_3b = f_string_helper('⛔ Stop', tt_stop, 2, '%') tt_data_3c = f_string_helper('🪓 Break', tt_break, 2, '%') tt_data_3d = f_string_helper('💱 Fee', tt_fee, 2, '%') tt_dataset_3 = str.format('{0}{1}{2}{3}{4}', tt_data_3a, tt_data_3b, tt_data_3c, tt_data_3d, tt_splitter) // Data 4 tt_data_4a = f_string_helper('💲 Current', close, 2, tt_quote) tt_data_4b = str.format('💲 Current: {0} %', str.tostring(f_round(tt_current_percent, 2))) tt_dataset_4 = str.format('{0}{1}', tt_data_4a, tt_data_4b) // Debugging Values // debug_one = str.format('Debug One: {0}\n', bar_index) // debug_two = str.format('Debug Two: {0}', bar_index + tt_label_offset_x) // debug = str.format('{0}{1}', debug_one, debufg_t_ywo) // === Data Display tt_text_main := str.format('{0}{1}{2}{3}', tt_dataset_1, tt_dataset_2, tt_dataset_3, tt_dataset_4) //, debug) label.set_text(id=tt_data_id, text=tt_text_main) // Pane Deletion if not enable_tt_labels or not enable_trade_tracker label.delete(tt_data_id) // END // TODO: 1) Add alerts; 2) Change label for display, use table instead; 3) Add some other variables and tweaks.
Double_Based_EMA_v2
https://www.tradingview.com/script/uYIMJc3p-Double-Based-EMA-v2/
jacobfabris
https://www.tradingview.com/u/jacobfabris/
9
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © jacobfabris //@version=5 indicator("Double_Based_EMA_v2",overlay=true) ph = low+(high-low)*0.80 pl = low+(high-low)*0.20 pf = close>ph ? ph : close<pl ? pl : close P1 = input.int(defval=8) a1 = ta.highest(high,P1) b1 = ta.lowest(low,P1) c1 = b1+(a1-b1)*0.80 d1 = b1+(a1-b1)*0.20 e1 = b1+(a1-b1)*0.50 f1 = pf > c1 ? c1 : pf < e1 ? e1 : pf g1 = pf > e1 ? e1 : pf < d1 ? d1 : pf cors1 = pf > e1 ? color.silver : #FF000000 cori1 = pf < e1 ? color.silver : #FF000000 h1 = ta.ema(f1,P1) i1 = ta.ema(g1,P1) plot(h1,color=cors1) plot(i1,color=cori1) plot((h1+i1)/2,color=color.white) //--- P2 = input.int(defval=34) a2 = ta.highest(high,P2) b2 = ta.lowest(low,P2) c2 = b2+(a2-b2)*0.80 d2 = b2+(a2-b2)*0.20 e2 = b2+(a2-b2)*0.50 f2 = pf > c2 ? c2 : pf < e2 ? e2 : pf g2 = pf > e2 ? e2 : pf < d2 ? d2 : pf cors2 = pf > e2 ? color.green : #FF000000 cori2 = pf < e2 ? color.green : #FF000000 h2 = ta.ema(f2,P2) i2 = ta.ema(g2,P2) plot(h2,color=cors2) plot(i2,color=cori2) plot((h2+i2)/2,color=color.lime) //--- P3 = input.int(defval=144) a3 = ta.highest(high,P3) b3 = ta.lowest(low,P3) c3 = b3+(a3-b3)*0.80 d3 = b3+(a3-b3)*0.20 e3 = b3+(a3-b3)*0.50 f3 = pf > c3 ? c3 : pf < e3 ? e3 : pf g3 = pf > e3 ? e3 : pf < d3 ? d3 : pf cors3 = pf > e3 ? color.orange : #FF000000 cori3 = pf < e3 ? color.orange : #FF000000 h3 = ta.ema(f3,P3) i3 = ta.ema(g3,P3) plot(h3,color=cors3) plot(i3,color=cori3) plot((h3+i3)/2,color=color.yellow) //--- P4 = input.int(defval=610) a4 = ta.highest(high,P4) b4 = ta.lowest(low,P4) c4 = b4+(a4-b4)*0.80 d4 = b4+(a4-b4)*0.20 e4 = b4+(a4-b4)*0.50 f4 = pf > c4 ? c4 : pf < e4 ? e4 : pf g4 = pf > e4 ? e4 : pf < d4 ? d4 : pf cors4 = pf > e4 ? color.maroon : #FF000000 cori4 = pf < e4 ? color.maroon : #FF000000 h4 = ta.ema(f4,P4) i4 = ta.ema(g4,P4) plot(h4,color=cors4) plot(i4,color=cori4) plot((h4+i4)/2,color=color.red)
RSI with Divergences, Reverse Formulas, and Bull/Bear Zones
https://www.tradingview.com/script/ayI58ZJ0-RSI-with-Divergences-Reverse-Formulas-and-Bull-Bear-Zones/
kylealberry
https://www.tradingview.com/u/kylealberry/
544
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © kylealberry //@version=4 study(title="RSI with Divergences, Reverse Formulas, and Bull/Bear Zones") // {INPUT rsiOn = input(true, title="RSI On", group="RSI Settings") rsi_len = input(13, "RSI Length", group="RSI Settings") rsiSourceInput = input(close, "Source", input.source, group="RSI Settings") rsiColor = input(color.new(#328787, 0), "RSI Line Color", type=input.color) ob = input(70, "Overbought Line", group="RSI Settings") os = input(30, "Overbought Line", group="RSI Settings") maOn = input(true, title="MA On", group="MA Settings") maTypeInput = input("SMA", title="MA Type", options=["SMA", "Bollinger Bands", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group="MA Settings") maLengthInput = input(14, title="MA Length", group="MA Settings") bbMultInput = input(2.0, minval=0.001, maxval=50, title="BB StdDev", group="MA Settings") zonesOn = input(true, title="Zones On", group="Zones") bull_thresh = input(60, "Bull Threshhold", input.float, minval=0, group="Zones") bear_thresh = input(35, "Bear Threshhold", input.float, minval=0, group="Zones") plotBull = input(title='Plot Bullish', defval=true, group="Toggle Divergence Plotting"), plotBear = input(title='Plot Bearish', defval=true, group="Toggle Divergence Plotting") plotHiddenBull = input(title='Plot Hidden Bullish', defval=false, group="Toggle Divergence Plotting") plotHiddenBear = input(title='Plot Hidden Bearish', defval=false, group="Toggle Divergence Plotting") labelOn = input(true, title="Label On", group="Labels") decimals = input(2, title="Decimals", group="Labels") // } // {FUNCTIONS ma(source, length, type) => if (type == "SMA") sma(source, length) else if (type == "Bollinger Bands") sma(source, length) else if (type == "EMA") ema(source, length) else if (type == "SMMA (RMA)") rma(source, length) else if (type == "WMA") wma(source, length) else if (type == "VWMA") vwma(source, length) reverse(Level) => x1 = (rsi_len - 1) * (rma(max(nz(close[1],close) - close, 0), rsi_len) * Level / (100 - Level) - rma(max(close - nz(close[1],close), 0), rsi_len)) iff(x1 >= 0, close + x1, close + x1 * (100 - Level) / Level) Round(src, digits) => p = pow(10,digits) round(abs(src)*p)/p*sign(src) rangeUpper = 60 rangeLower = 5 _inRange(cond) => bars = barssince(cond == true) rangeLower <= bars and bars <= rangeUpper // } rsi = rsi(close, rsi_len) rsiMA = ma(rsi, maLengthInput, maTypeInput) var sessioncolor = color.black lbR = 5,lbL = 5 revob = reverse(bull_thresh) revos = reverse(bear_thresh) // {DIVERGENCE osc = rsi plFound = na(pivotlow(osc, lbL, lbR)) ? false : true,phFound = na(pivothigh(osc, lbL, lbR)) ? false : true oscHL = osc[lbR] > valuewhen(plFound, osc[lbR], 1) and _inRange(plFound[1]), oscLL = osc[lbR] < valuewhen(plFound, osc[lbR], 1) and _inRange(plFound[1]) oscHH = osc[lbR] > valuewhen(phFound, osc[lbR], 1) and _inRange(phFound[1]),oscLH = osc[lbR] < valuewhen(phFound, osc[lbR], 1) and _inRange(phFound[1]) priceLL = low[lbR] < valuewhen(plFound, low[lbR], 1), priceHL = low[lbR] > valuewhen(plFound, low[lbR], 1) priceHH = high[lbR] > valuewhen(phFound, high[lbR], 1),priceLH = high[lbR] < valuewhen(phFound, high[lbR], 1) bullCond = plotBull and priceLL and oscHL and plFound hiddenBullCond = plotHiddenBull and priceHL and oscLL and plFound bearCond = plotBear and priceHH and oscLH and phFound hiddenBearCond = plotHiddenBear and priceLH and oscHH and phFound bearColor = color.new(color.red, 0) bullColor = color.new(color.green, 0) hiddenBullColor = color.new(color.green, 0) hiddenBearColor = color.new(color.red, 0) textColor = color.white noneColor = color.new(color.white, 100) // } var bull = false if (bull and rsi < bear_thresh) bull := false else if (not bull and rsi > bull_thresh) bull := true sessioncolor := bull ? #0fb406 : #FF0000 // { PLOTS plot(rsiOn ? rsi : na, title='RSI', color=rsiColor, linewidth=2) plot(maOn ? rsiMA : na, "RSI-based MA", color=color.yellow) plot(plFound ? osc[lbR] : na, offset=-lbR, title='Regular Bullish', linewidth=3, color=bullCond ? bullColor : noneColor) plot(plFound ? osc[lbR] : na, offset=-lbR, title='Hidden Bullish', linewidth=3, color=hiddenBullCond ? hiddenBullColor : noneColor) plot(phFound ? osc[lbR] : na, offset=-lbR, title='Regular Bearish', linewidth=3, color=bearCond ? bearColor : noneColor) plot(phFound ? osc[lbR] : na, offset=-lbR, title='Hidden Bearish', linewidth=3, color=hiddenBearCond ? hiddenBearColor : noneColor) hline(bull_thresh, color=color.green , linestyle=hline.style_dashed) hline(bear_thresh, color=color.red , linestyle=hline.style_dashed) obline = hline(ob, color=color.white , linestyle=hline.style_solid) osline = hline(os, color=color.white , linestyle=hline.style_solid) fill(obline, osline, color=zonesOn ? color.new(sessioncolor, 85) : na) var tab = table.new(position.middle_right, 1, 2) if barstate.islast and labelOn == true table.cell(table_id = tab, column = 0, row = 0, text_color=color.white, text = tostring(Round(bull_thresh,decimals)) + " Bull Zone Price : " + tostring(Round(revob,decimals))) table.cell(table_id = tab, column = 0, row = 1, text_color=color.white, text = tostring(Round(bear_thresh,decimals)) + " Bear Zone Price : " + tostring(Round(revos,decimals))) // }
test - pattern similarity
https://www.tradingview.com/script/AuFZTBni-test-pattern-similarity/
RicardoSantos
https://www.tradingview.com/u/RicardoSantos/
88
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © RicardoSantos //@version=5 indicator(title='test - pattern similarity') import RicardoSantos/FunctionPatternDecomposition/1 as decompose import RicardoSantos/FunctionCosineSimilarity/1 as similarity im(float source, int length, float smooth=0.7, float thin=0.7, int msize=5)=> var _data = array.new_float(length, source), array.push(_data, source), array.shift(_data) [_x, _y] = decompose.smooth_data_2d(_data, smooth) [_tx, _ty] = decompose.thin_points(_x, _y, thin) float[] _m = decompose.grid_coordinates(_tx, _ty, msize) float src = input.source(close) int length = input.int(12) float smooth = input.float(0.7) float thin = input.float(0.7) int msize = input.int(5) string ticker1 = input.symbol('AAPL') string ticker2 = input.symbol('MSFT') float s1 = request.security(ticker1, timeframe.period, src) float s2 = request.security(ticker2, timeframe.period, src) float[] m1 = im(s1, length, smooth, thin, msize) float[] m2 = im(s2, length, smooth, thin, msize) cs = similarity.function(m1, m2) avg = ta.cum(cs) / (bar_index + 1) plot(series=cs, title='similarity', color=color.blue) plot(series=avg, title='average', color=color.yellow) m_tostring(sample, int cols)=> int _size = array.size(sample) string _str = '' for _i = 0 to (_size - 1) _str += str.tostring(array.get(sample, _i), '0') if _i != (_size - 1) _str += ' ' if (_i % cols) == (cols - 1) _str += '\n' _str var t_ = table.new(position.bottom_left, 1, 2) table.cell(t_, 0, 0, m_tostring(m1, msize), text_color=color.silver, bgcolor=#000000) table.cell(t_, 0, 1, m_tostring(m2, msize), text_color=color.silver, bgcolor=#000000)
Silen's Financials Fair Value
https://www.tradingview.com/script/3eSOwu6g-Silen-s-Financials-Fair-Value/
The_Silen
https://www.tradingview.com/u/The_Silen/
303
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © The_Silen //@version=4 study("Silen's Financials Fair Value", overlay=true) string str= (syminfo.prefix+":"+syminfo.ticker) bool cut_off = input(defval = 1, title = "Cut-off Historical Behavior (for formatting reasons)") float pe_rate_pos = 0 float pe_rate_neg = 0 float pe_rate_norm = 0 float targeta = 0 float targetb = 0 float targetc = 0 col_targeta = color.new(color.purple,0) col_targetb = color.new(color.lime,0) col_targetc = color.new(color.blue,70) float rev_b = 0 float earn = 0 float earn_b = 0 float pe_rate_b = 0 float ps_rate_b = 0 float debt_to_equity = 0 float debt_score = 0 float fair_value_distance = 0 float fair_value_distance_kum = 0 float fair_value_count = 0 int pe_rate_max = 100 float equitydebt_factor = 0.33 float close_max = 0 float targeta_max = 0.0 float targetb_max = 0.0 close_max := close if (close[1] > close_max[1]) close_max := close[1] else if (close_max[1] > 0) close_max := close_max[1] if (targeta[1] > targeta_max[1]) targeta_max := targeta[1] else if (targeta_max[1] > 0) targeta_max := targeta_max[1] if (targetb[1] > targetb_max[1]) targetb_max := targetb[1] else if (targetb_max[1] > 0) targetb_max := targetb_max[1] if (fair_value_count[1] > 0) fair_value_count := fair_value_count[1] if (fair_value_distance_kum[1] > 0 or fair_value_distance_kum[1] < 0) fair_value_distance_kum := fair_value_distance_kum[1] if (targetb[1] > 0 and targeta[1] > 0 and targeta[1] > (close[1]/100)) fair_value_count := fair_value_count + 1 fair_value_distance := (close[1] / targetb[1]) if (fair_value_distance_kum[1] > 0 or fair_value_distance_kum < 0) fair_value_distance_kum := fair_value_distance_kum - (fair_value_distance_kum - fair_value_distance) / fair_value_count else fair_value_distance_kum := fair_value_distance tso = financial (str, "TOTAL_SHARES_OUTSTANDING", "FQ") rev_total = financial (str, "TOTAL_REVENUE", "TTM") market_cap = tso * close ps_rate = market_cap / rev_total equity = financial (str, "TOTAL_EQUITY", "FQ") equity_price = equity / tso debt = financial (str, "TOTAL_DEBT", "FQ") debt_price = debt / tso equitydebt_price = (equity_price - debt_price) * equitydebt_factor eps_rate = financial (str, "EARNINGS_PER_SHARE", "TTM") pe_rate = close/eps_rate earn := market_cap / pe_rate debt_to_equity := debt / equity if (debt_to_equity <= 1.5 and debt_to_equity >= 0) debt_score := 1.5 - debt_to_equity + 1.0/3.0 debt_score := debt_score / 1.2 if (debt_score < (1.0/3.0)) debt_score := 1.0/3.0 if (pe_rate > 0) targeta := close * (3/ps_rate + 17.5/pe_rate) / 2 else targeta := close * ((3/ps_rate)/2) * ((rev_total+earn)/rev_total) targeta := targeta * debt_score targeta := targeta + equitydebt_price if (targeta < 0) targeta := 0 if (pe_rate > 0) pe_rate_pos := pe_rate pe_rate_norm := pe_rate if (pe_rate < 0) pe_rate_neg := pe_rate *(-1) pe_rate_norm := 1/pe_rate if (pe_rate_pos > pe_rate_max) pe_rate_pos := pe_rate_max if (pe_rate_neg > pe_rate_max) pe_rate_neg := pe_rate_max if (rev_total[724] < rev_total[472] and rev_total[472] < rev_total[220] and rev_total[220] < rev_total) // 252 trading days a year, -32 for half a quarter. rev_b := rev_total * 2 - rev_total[850] else rev_b := rev_total ps_rate_b := market_cap / rev_b if (earn[724] < earn[472] and earn[472] < earn[220] and earn[220] < earn) earn_b := (earn * 2) - earn[850] else earn_b := earn pe_rate_b := market_cap / earn_b //if (earn_b > 0) targetb := close * (3/ps_rate_b + 17.5/pe_rate_b) / 2 targetb := targetb * debt_score targetb := targetb + equitydebt_price if (targetb <= 0 or targetb < targeta or na(targetb)) targetb := targeta if (targetb == targeta and targetb[95] > targeta[95]) // 1,5 Quarters targetb := targetb + (targetb[95] - targeta[95]) / 3 if (fair_value_count > 252) targetc := targetb * fair_value_distance_kum if (targetc <= 0 or na(targetc)) targetc := targetb if (targetb[1] == targeta[1] and targetb == targeta) col_targetb := color.new(color.lime,100) if (targetc[1] == targetb[1] and targetc == targetb) col_targetc := color.new(color.blue,100) if (cut_off == 1) if (targetc >= (close_max*1.2) and targetc >= (targeta_max*1.2) and targetc >= (targetb_max*1.2)) col_targetc := color.new(color.blue,90) targetc := max(close_max,targeta_max,targetb_max)*1.2 if (not timeframe.isdaily) col_targeta := color.new(color.black,100) col_targetb := color.new(color.black,100) col_targetc := color.new(color.black,100) targeta := na targetb := na targetc := na //plot(earn_b, color = color.blue) //plot(earn, color = color.orange) //plot(debt_score * 100, color = color.red) //plot(pe_rate_b, color = color.silver) //plot(pe_rate_neg, color = color.red) //plot(ps_rate * 10, color = color.yellow) //plot(fair_value_count) //plot(fair_value_distance) //plot(fair_value_distance_kum) //plot(targeta_max) //plot(close_max) plot(targeta, title = "Fair Value w/o growth", color = col_targeta, linewidth = 4) plot(targetb, title = "Fair Value with growth", color = col_targetb, linewidth = 4) plot(targetc, title = "Historical Behavior compared to Fair Value", color = col_targetc, linewidth = 4)
The Strat Screener - yungchopps
https://www.tradingview.com/script/DFWgpWOQ-The-Strat-Screener-yungchopps/
trawda13
https://www.tradingview.com/u/trawda13/
486
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © trawda13 //@version=5 indicator("The Strat Screener - yungchopps", overlay = true) //////////////////// /// Ticker Input /// //////////////////// color_blind = input(false, "color vision deficiency") s01 = input.symbol("AAPL", "Symbol") s02 = input.symbol("MSFT", "Symbol") s03 = input.symbol("AMZN", "Symbol") s04 = input.symbol("GOOG", "Symbol") s05 = input.symbol("FB", "Symbol") s06 = input.symbol("A", "Symbol") s07 = input.symbol("TSLA", "Symbol") s08 = input.symbol("V", "Symbol") s09 = input.symbol("JPM", "Symbol") s10 = input.symbol("NVDA", "Symbol") s11 = input.symbol("JNJ", "Symbol") s12 = input.symbol("WMT", "Symbol") s13 = input.symbol("UNH", "Symbol") s14 = input.symbol("MA", "Symbol") s15 = input.symbol("PYPL", "Symbol") s16 = input.symbol("PG", "Symbol") s17 = input.symbol("HD", "Symbol") s18 = input.symbol("BAC", "Symbol") s19 = input.symbol("ADBE", "Symbol") s20 = input.symbol("CMCSA", "Symbol") s21 = input.symbol("NKE", "Symbol") s22 = input.symbol("ORCL", "Symbol") s23 = input.symbol("KO", "Symbol") s24 = input.symbol("XOM", "Symbol") s25 = input.symbol("NFLX", "Symbol") s26 = input.symbol("VZ", "Symbol") s27 = input.symbol("CSCO", "Symbol") s28 = input.symbol("PFE", "Symbol") s29 = input.symbol("LLY", "Symbol") s30 = input.symbol("INTC", "Symbol") s31 = input.symbol("CRM", "Symbol") s32 = input.symbol("PEP", "Symbol") s33 = input.symbol("ABT", "Symbol") s34 = input.symbol("ACN", "Symbol") s35 = input.symbol("ABBV", "Symbol") s36 = input.symbol("TMO", "Symbol") s37 = input.symbol("DHR", "Symbol") s38 = input.symbol("T", "Symbol") s39 = input.symbol("MRK", "Symbol") s40 = input.symbol("DIS", "Symbol") /////////////////////////////// //////////// Color //////////// /////////////////////////////// bgColor_heading = color.gray textColor = color.black bgColor_body = #ccedc2 if color_blind bgColor_heading := color.orange bgColor_body := color.orange textColor := color.blue //////////////////////////////////////////////////// //////////// Identifies the candles //////////////// //////////////////////////////////////////////////// // Checks for 1 getOneBar(rightBar,leftBar) => high[rightBar] <= high[leftBar] and low[rightBar] >= low[leftBar] // Checks for 2d getTwoDownBar(rightBar, leftBar) => low[rightBar] < low[leftBar] and not (high[rightBar] > high[leftBar]) // Checks for 2p getTwoUpBar(rightBar, leftBar) => high[rightBar] > high[leftBar] and not (low[rightBar] < low[leftBar]) // Checks for 3 getThreeBar(rightBar, leftBar) => high[rightBar] > high[leftBar] and low[rightBar] < low[leftBar] // Checks for all Strat setups Strat_Screener_Func() => bull_rj = getTwoUpBar(2,3) and getTwoUpBar(1,2) and getTwoDownBar(0,1) // Bullish RJ bear_rj = getTwoDownBar(2,3) and getTwoDownBar(1,2) and getTwoUpBar(0,1) // Bearish RJ nirvana = getOneBar(1,2) and getThreeBar(0,1) // Nirvana holy_Gr = getThreeBar(1,2) and getOneBar(0,1) // Holy Grail two_one = (getTwoUpBar(1,2) or getTwoDownBar(1,2)) and getOneBar(0,1) // 2-1 continuation or reversal halfway = high[1] - ((high[1] - low[1])/2) fiftyHigh = (high[0] > high[1] and not (low[0] < low[1])) and (close < halfway) fiftyLow = (low[0] < low[1] and not (high[0] > high[1])) and (close > halfway) fifty = fiftyHigh or fiftyLow [bull_rj, bear_rj, nirvana, holy_Gr, fifty, two_one] // Returns the setups // Retrieves the namse of the ticker getName(_str) => string[] _pair = str.split(_str, ":") string[] _chars = str.split(array.get(_pair, 1), "") // Index 1 string _return = array.join(_chars, "") /////////////// /// Tickers /// /////////////// [bullrj01, bearrj01, nirvana01, holyGrail01, fifty01, twoOne01] = request.security(s01, timeframe.period, Strat_Screener_Func()) [bullrj02, bearrj02, nirvana02, holyGrail02, fifty02, twoOne02] = request.security(s02, timeframe.period, Strat_Screener_Func()) [bullrj03, bearrj03, nirvana03, holyGrail03, fifty03, twoOne03] = request.security(s03, timeframe.period, Strat_Screener_Func()) [bullrj04, bearrj04, nirvana04, holyGrail04, fifty04, twoOne04] = request.security(s04, timeframe.period, Strat_Screener_Func()) [bullrj05, bearrj05, nirvana05, holyGrail05, fifty05, twoOne05] = request.security(s05, timeframe.period, Strat_Screener_Func()) [bullrj06, bearrj06, nirvana06, holyGrail06, fifty06, twoOne06] = request.security(s06, timeframe.period, Strat_Screener_Func()) [bullrj07, bearrj07, nirvana07, holyGrail07, fifty07, twoOne07] = request.security(s07, timeframe.period, Strat_Screener_Func()) [bullrj08, bearrj08, nirvana08, holyGrail08, fifty08, twoOne08] = request.security(s08, timeframe.period, Strat_Screener_Func()) [bullrj09, bearrj09, nirvana09, holyGrail09, fifty09, twoOne09] = request.security(s09, timeframe.period, Strat_Screener_Func()) [bullrj10, bearrj10, nirvana10, holyGrail10, fifty10, twoOne10] = request.security(s10, timeframe.period, Strat_Screener_Func()) [bullrj11, bearrj11, nirvana11, holyGrail11, fifty11, twoOne11] = request.security(s11, timeframe.period, Strat_Screener_Func()) [bullrj12, bearrj12, nirvana12, holyGrail12, fifty12, twoOne12] = request.security(s12, timeframe.period, Strat_Screener_Func()) [bullrj13, bearrj13, nirvana13, holyGrail13, fifty13, twoOne13] = request.security(s13, timeframe.period, Strat_Screener_Func()) [bullrj14, bearrj14, nirvana14, holyGrail14, fifty14, twoOne14] = request.security(s14, timeframe.period, Strat_Screener_Func()) [bullrj15, bearrj15, nirvana15, holyGrail15, fifty15, twoOne15] = request.security(s15, timeframe.period, Strat_Screener_Func()) [bullrj16, bearrj16, nirvana16, holyGrail16, fifty16, twoOne16] = request.security(s16, timeframe.period, Strat_Screener_Func()) [bullrj17, bearrj17, nirvana17, holyGrail17, fifty17, twoOne17] = request.security(s17, timeframe.period, Strat_Screener_Func()) [bullrj18, bearrj18, nirvana18, holyGrail18, fifty18, twoOne18] = request.security(s18, timeframe.period, Strat_Screener_Func()) [bullrj19, bearrj19, nirvana19, holyGrail19, fifty19, twoOne19] = request.security(s19, timeframe.period, Strat_Screener_Func()) [bullrj20, bearrj20, nirvana20, holyGrail20, fifty20, twoOne20] = request.security(s20, timeframe.period, Strat_Screener_Func()) [bullrj21, bearrj21, nirvana21, holyGrail21, fifty21, twoOne21] = request.security(s21, timeframe.period, Strat_Screener_Func()) [bullrj22, bearrj22, nirvana22, holyGrail22, fifty22, twoOne22] = request.security(s22, timeframe.period, Strat_Screener_Func()) [bullrj23, bearrj23, nirvana23, holyGrail23, fifty23, twoOne23] = request.security(s23, timeframe.period, Strat_Screener_Func()) [bullrj24, bearrj24, nirvana24, holyGrail24, fifty24, twoOne24] = request.security(s24, timeframe.period, Strat_Screener_Func()) [bullrj25, bearrj25, nirvana25, holyGrail25, fifty25, twoOne25] = request.security(s25, timeframe.period, Strat_Screener_Func()) [bullrj26, bearrj26, nirvana26, holyGrail26, fifty26, twoOne26] = request.security(s26, timeframe.period, Strat_Screener_Func()) [bullrj27, bearrj27, nirvana27, holyGrail27, fifty27, twoOne27] = request.security(s27, timeframe.period, Strat_Screener_Func()) [bullrj28, bearrj28, nirvana28, holyGrail28, fifty28, twoOne28] = request.security(s28, timeframe.period, Strat_Screener_Func()) [bullrj29, bearrj29, nirvana29, holyGrail29, fifty29, twoOne29] = request.security(s29, timeframe.period, Strat_Screener_Func()) [bullrj30, bearrj30, nirvana30, holyGrail30, fifty30, twoOne30] = request.security(s30, timeframe.period, Strat_Screener_Func()) [bullrj31, bearrj31, nirvana31, holyGrail31, fifty31, twoOne31] = request.security(s31, timeframe.period, Strat_Screener_Func()) [bullrj32, bearrj32, nirvana32, holyGrail32, fifty32, twoOne32] = request.security(s32, timeframe.period, Strat_Screener_Func()) [bullrj33, bearrj33, nirvana33, holyGrail33, fifty33, twoOne33] = request.security(s33, timeframe.period, Strat_Screener_Func()) [bullrj34, bearrj34, nirvana34, holyGrail34, fifty34, twoOne34] = request.security(s34, timeframe.period, Strat_Screener_Func()) [bullrj35, bearrj35, nirvana35, holyGrail35, fifty35, twoOne35] = request.security(s35, timeframe.period, Strat_Screener_Func()) [bullrj36, bearrj36, nirvana36, holyGrail36, fifty36, twoOne36] = request.security(s36, timeframe.period, Strat_Screener_Func()) [bullrj37, bearrj37, nirvana37, holyGrail37, fifty37, twoOne37] = request.security(s37, timeframe.period, Strat_Screener_Func()) [bullrj38, bearrj38, nirvana38, holyGrail38, fifty38, twoOne38] = request.security(s38, timeframe.period, Strat_Screener_Func()) [bullrj39, bearrj39, nirvana39, holyGrail39, fifty39, twoOne39] = request.security(s39, timeframe.period, Strat_Screener_Func()) [bullrj40, bearrj40, nirvana40, holyGrail40, fifty40, twoOne40] = request.security(s40, timeframe.period, Strat_Screener_Func()) ////////////// /// Arrays /// ////////////// s_arr = array.new_string(0) bullrj_arr = array.new_bool(0) bearrj_arr = array.new_bool(0) nirvana_arr = array.new_bool(0) holyGrail_arr = array.new_bool(0) fifty_arr = array.new_bool(0) twoOne_arr = array.new_bool(0) // Symbol name array.push(s_arr, s01) array.push(s_arr, s02) array.push(s_arr, s03) array.push(s_arr, s04) array.push(s_arr, s05) array.push(s_arr, s06) array.push(s_arr, s07) array.push(s_arr, s08) array.push(s_arr, s09) array.push(s_arr, s10) array.push(s_arr, s11) array.push(s_arr, s12) array.push(s_arr, s13) array.push(s_arr, s14) array.push(s_arr, s15) array.push(s_arr, s16) array.push(s_arr, s17) array.push(s_arr, s18) array.push(s_arr, s19) array.push(s_arr, s20) array.push(s_arr, s21) array.push(s_arr, s22) array.push(s_arr, s23) array.push(s_arr, s24) array.push(s_arr, s25) array.push(s_arr, s26) array.push(s_arr, s27) array.push(s_arr, s28) array.push(s_arr, s29) array.push(s_arr, s30) array.push(s_arr, s31) array.push(s_arr, s32) array.push(s_arr, s33) array.push(s_arr, s34) array.push(s_arr, s35) array.push(s_arr, s36) array.push(s_arr, s37) array.push(s_arr, s38) array.push(s_arr, s39) array.push(s_arr, s40) // Bullish RJ setups array.push(bullrj_arr, bullrj01) array.push(bullrj_arr, bullrj02) array.push(bullrj_arr, bullrj03) array.push(bullrj_arr, bullrj04) array.push(bullrj_arr, bullrj05) array.push(bullrj_arr, bullrj06) array.push(bullrj_arr, bullrj07) array.push(bullrj_arr, bullrj08) array.push(bullrj_arr, bullrj09) array.push(bullrj_arr, bullrj10) array.push(bullrj_arr, bullrj11) array.push(bullrj_arr, bullrj12) array.push(bullrj_arr, bullrj13) array.push(bullrj_arr, bullrj14) array.push(bullrj_arr, bullrj15) array.push(bullrj_arr, bullrj16) array.push(bullrj_arr, bullrj17) array.push(bullrj_arr, bullrj18) array.push(bullrj_arr, bullrj19) array.push(bullrj_arr, bullrj20) array.push(bullrj_arr, bullrj21) array.push(bullrj_arr, bullrj22) array.push(bullrj_arr, bullrj23) array.push(bullrj_arr, bullrj24) array.push(bullrj_arr, bullrj25) array.push(bullrj_arr, bullrj26) array.push(bullrj_arr, bullrj27) array.push(bullrj_arr, bullrj28) array.push(bullrj_arr, bullrj29) array.push(bullrj_arr, bullrj30) array.push(bullrj_arr, bullrj31) array.push(bullrj_arr, bullrj32) array.push(bullrj_arr, bullrj33) array.push(bullrj_arr, bullrj34) array.push(bullrj_arr, bullrj35) array.push(bullrj_arr, bullrj36) array.push(bullrj_arr, bullrj37) array.push(bullrj_arr, bullrj38) array.push(bullrj_arr, bullrj39) array.push(bullrj_arr, bullrj40) // Bearish RJ setups array.push(bearrj_arr, bearrj01) array.push(bearrj_arr, bearrj02) array.push(bearrj_arr, bearrj03) array.push(bearrj_arr, bearrj04) array.push(bearrj_arr, bearrj05) array.push(bearrj_arr, bearrj06) array.push(bearrj_arr, bearrj07) array.push(bearrj_arr, bearrj08) array.push(bearrj_arr, bearrj09) array.push(bearrj_arr, bearrj10) array.push(bearrj_arr, bearrj11) array.push(bearrj_arr, bearrj12) array.push(bearrj_arr, bearrj13) array.push(bearrj_arr, bearrj14) array.push(bearrj_arr, bearrj15) array.push(bearrj_arr, bearrj16) array.push(bearrj_arr, bearrj17) array.push(bearrj_arr, bearrj18) array.push(bearrj_arr, bearrj19) array.push(bearrj_arr, bearrj20) array.push(bearrj_arr, bearrj21) array.push(bearrj_arr, bearrj22) array.push(bearrj_arr, bearrj23) array.push(bearrj_arr, bearrj24) array.push(bearrj_arr, bearrj25) array.push(bearrj_arr, bearrj26) array.push(bearrj_arr, bearrj27) array.push(bearrj_arr, bearrj28) array.push(bearrj_arr, bearrj29) array.push(bearrj_arr, bearrj30) array.push(bearrj_arr, bearrj31) array.push(bearrj_arr, bearrj32) array.push(bearrj_arr, bearrj33) array.push(bearrj_arr, bearrj34) array.push(bearrj_arr, bearrj35) array.push(bearrj_arr, bearrj36) array.push(bearrj_arr, bearrj37) array.push(bearrj_arr, bearrj38) array.push(bearrj_arr, bearrj39) array.push(bearrj_arr, bearrj40) // Nirvana setups array.push(nirvana_arr, nirvana01) array.push(nirvana_arr, nirvana02) array.push(nirvana_arr, nirvana03) array.push(nirvana_arr, nirvana04) array.push(nirvana_arr, nirvana05) array.push(nirvana_arr, nirvana06) array.push(nirvana_arr, nirvana07) array.push(nirvana_arr, nirvana08) array.push(nirvana_arr, nirvana09) array.push(nirvana_arr, nirvana10) array.push(nirvana_arr, nirvana11) array.push(nirvana_arr, nirvana12) array.push(nirvana_arr, nirvana13) array.push(nirvana_arr, nirvana14) array.push(nirvana_arr, nirvana15) array.push(nirvana_arr, nirvana16) array.push(nirvana_arr, nirvana17) array.push(nirvana_arr, nirvana18) array.push(nirvana_arr, nirvana19) array.push(nirvana_arr, nirvana20) array.push(nirvana_arr, nirvana21) array.push(nirvana_arr, nirvana22) array.push(nirvana_arr, nirvana23) array.push(nirvana_arr, nirvana24) array.push(nirvana_arr, nirvana25) array.push(nirvana_arr, nirvana26) array.push(nirvana_arr, nirvana27) array.push(nirvana_arr, nirvana28) array.push(nirvana_arr, nirvana29) array.push(nirvana_arr, nirvana30) array.push(nirvana_arr, nirvana31) array.push(nirvana_arr, nirvana32) array.push(nirvana_arr, nirvana33) array.push(nirvana_arr, nirvana34) array.push(nirvana_arr, nirvana35) array.push(nirvana_arr, nirvana36) array.push(nirvana_arr, nirvana37) array.push(nirvana_arr, nirvana38) array.push(nirvana_arr, nirvana39) array.push(nirvana_arr, nirvana40) // Holy Grail setups array.push(holyGrail_arr, holyGrail01) array.push(holyGrail_arr, holyGrail02) array.push(holyGrail_arr, holyGrail03) array.push(holyGrail_arr, holyGrail04) array.push(holyGrail_arr, holyGrail05) array.push(holyGrail_arr, holyGrail06) array.push(holyGrail_arr, holyGrail07) array.push(holyGrail_arr, holyGrail08) array.push(holyGrail_arr, holyGrail09) array.push(holyGrail_arr, holyGrail10) array.push(holyGrail_arr, holyGrail11) array.push(holyGrail_arr, holyGrail12) array.push(holyGrail_arr, holyGrail13) array.push(holyGrail_arr, holyGrail14) array.push(holyGrail_arr, holyGrail15) array.push(holyGrail_arr, holyGrail16) array.push(holyGrail_arr, holyGrail17) array.push(holyGrail_arr, holyGrail18) array.push(holyGrail_arr, holyGrail19) array.push(holyGrail_arr, holyGrail20) array.push(holyGrail_arr, holyGrail21) array.push(holyGrail_arr, holyGrail22) array.push(holyGrail_arr, holyGrail23) array.push(holyGrail_arr, holyGrail24) array.push(holyGrail_arr, holyGrail25) array.push(holyGrail_arr, holyGrail26) array.push(holyGrail_arr, holyGrail27) array.push(holyGrail_arr, holyGrail28) array.push(holyGrail_arr, holyGrail29) array.push(holyGrail_arr, holyGrail30) array.push(holyGrail_arr, holyGrail31) array.push(holyGrail_arr, holyGrail32) array.push(holyGrail_arr, holyGrail33) array.push(holyGrail_arr, holyGrail34) array.push(holyGrail_arr, holyGrail35) array.push(holyGrail_arr, holyGrail36) array.push(holyGrail_arr, holyGrail37) array.push(holyGrail_arr, holyGrail38) array.push(holyGrail_arr, holyGrail39) array.push(holyGrail_arr, holyGrail40) // 50% retracement setups array.push(fifty_arr, fifty01) array.push(fifty_arr, fifty02) array.push(fifty_arr, fifty03) array.push(fifty_arr, fifty04) array.push(fifty_arr, fifty05) array.push(fifty_arr, fifty06) array.push(fifty_arr, fifty07) array.push(fifty_arr, fifty08) array.push(fifty_arr, fifty09) array.push(fifty_arr, fifty10) array.push(fifty_arr, fifty11) array.push(fifty_arr, fifty12) array.push(fifty_arr, fifty13) array.push(fifty_arr, fifty14) array.push(fifty_arr, fifty15) array.push(fifty_arr, fifty16) array.push(fifty_arr, fifty17) array.push(fifty_arr, fifty18) array.push(fifty_arr, fifty19) array.push(fifty_arr, fifty20) array.push(fifty_arr, fifty21) array.push(fifty_arr, fifty22) array.push(fifty_arr, fifty23) array.push(fifty_arr, fifty24) array.push(fifty_arr, fifty25) array.push(fifty_arr, fifty26) array.push(fifty_arr, fifty27) array.push(fifty_arr, fifty28) array.push(fifty_arr, fifty29) array.push(fifty_arr, fifty30) array.push(fifty_arr, fifty31) array.push(fifty_arr, fifty32) array.push(fifty_arr, fifty33) array.push(fifty_arr, fifty34) array.push(fifty_arr, fifty35) array.push(fifty_arr, fifty36) array.push(fifty_arr, fifty37) array.push(fifty_arr, fifty38) array.push(fifty_arr, fifty39) array.push(fifty_arr, fifty40) // 2-1 setup array.push(twoOne_arr, twoOne01) array.push(twoOne_arr, twoOne02) array.push(twoOne_arr, twoOne03) array.push(twoOne_arr, twoOne04) array.push(twoOne_arr, twoOne05) array.push(twoOne_arr, twoOne06) array.push(twoOne_arr, twoOne07) array.push(twoOne_arr, twoOne08) array.push(twoOne_arr, twoOne09) array.push(twoOne_arr, twoOne10) array.push(twoOne_arr, twoOne11) array.push(twoOne_arr, twoOne12) array.push(twoOne_arr, twoOne13) array.push(twoOne_arr, twoOne14) array.push(twoOne_arr, twoOne15) array.push(twoOne_arr, twoOne16) array.push(twoOne_arr, twoOne17) array.push(twoOne_arr, twoOne18) array.push(twoOne_arr, twoOne19) array.push(twoOne_arr, twoOne20) array.push(twoOne_arr, twoOne21) array.push(twoOne_arr, twoOne22) array.push(twoOne_arr, twoOne23) array.push(twoOne_arr, twoOne24) array.push(twoOne_arr, twoOne25) array.push(twoOne_arr, twoOne26) array.push(twoOne_arr, twoOne27) array.push(twoOne_arr, twoOne28) array.push(twoOne_arr, twoOne29) array.push(twoOne_arr, twoOne30) array.push(twoOne_arr, twoOne31) array.push(twoOne_arr, twoOne32) array.push(twoOne_arr, twoOne33) array.push(twoOne_arr, twoOne34) array.push(twoOne_arr, twoOne35) array.push(twoOne_arr, twoOne36) array.push(twoOne_arr, twoOne37) array.push(twoOne_arr, twoOne38) array.push(twoOne_arr, twoOne39) array.push(twoOne_arr, twoOne40) ///////////// /// Table /// ///////////// var tbl = table.new(position.bottom_left, 41, 10, frame_color=#151715, frame_width=1, border_width=2, border_color=color.new(color.white, 100)) if barstate.islast //table.cell(tbl, 0, 0, 'Symbol', text_halign = text.align_center, bgcolor = color.gray, text_color = color.black, text_size = size.small) table.cell(tbl, 0, 0, 'BULL RJ (2u2u2d2u)', text_halign = text.align_center, bgcolor = bgColor_heading, text_color = textColor, text_size = size.small) table.cell(tbl, 0, 1, 'BEAR RJ (2d2d2u2d)', text_halign = text.align_center, bgcolor = bgColor_heading, text_color = textColor, text_size = size.small) table.cell(tbl, 0, 2, 'NIRVANA (1-3)', text_halign = text.align_center, bgcolor = bgColor_heading, text_color = textColor, text_size = size.small) table.cell(tbl, 0, 3, 'HOLY GR (3-1)', text_halign = text.align_center, bgcolor = bgColor_heading, text_color = textColor, text_size = size.small) table.cell(tbl, 0, 4, '50%', text_halign = text.align_center, bgcolor = bgColor_heading, text_color = textColor, text_size = size.small) table.cell(tbl, 0, 5, '2-1-2', text_halign = text.align_center, bgcolor = bgColor_heading, text_color = textColor, text_size = size.small) s_arr1 = array.new_string(0) s_arr2 = array.new_string(0) s_arr3 = array.new_string(0) s_arr4 = array.new_string(0) s_arr5 = array.new_string(0) s_arr6 = array.new_string(0) for i = 0 to 39 bull_rj_num = array.get(bullrj_arr, i) == 1 ? true : false bear_rj_num = array.get(bearrj_arr, i) == 1 ? true : false nirvana_num = array.get(nirvana_arr, i) == 1 ? true : false holyGrail_num = array.get(holyGrail_arr, i) == 1 ? true : false fifty_num = array.get(fifty_arr, i) == 1 ? true : false twoOne_num = array.get(twoOne_arr, i) == 1 ? true : false if bull_rj_num array.push(s_arr1, getName(array.get(s_arr, i))) if bear_rj_num array.push(s_arr2, getName(array.get(s_arr, i))) if nirvana_num array.push(s_arr3, getName(array.get(s_arr, i))) if holyGrail_num array.push(s_arr4, getName(array.get(s_arr, i))) if fifty_num array.push(s_arr5, getName(array.get(s_arr, i))) if twoOne_num array.push(s_arr6, getName(array.get(s_arr, i))) //table.cell(tbl, i + 1, 0, array.get(s_arr, i), text_halign = text.align_left, bgcolor = #ccedc2, text_color = color.black, text_size = size.small) table.cell(tbl, 1, 0, array.join(s_arr1, ","), text_halign = text.align_center, bgcolor = bgColor_body, text_color = textColor, text_size = size.small) table.cell(tbl, 1, 1, array.join(s_arr2, ","), text_halign = text.align_center, bgcolor = bgColor_body, text_color = textColor, text_size = size.small) table.cell(tbl, 1, 2, array.join(s_arr3, ","), text_halign = text.align_center, bgcolor = bgColor_body, text_color = textColor, text_size = size.small) table.cell(tbl, 1, 3, array.join(s_arr4, ","), text_halign = text.align_center, bgcolor = bgColor_body, text_color = textColor, text_size = size.small) table.cell(tbl, 1, 4, array.join(s_arr5, ","), text_halign = text.align_center, bgcolor = bgColor_body, text_color = textColor, text_size = size.small) table.cell(tbl, 1, 5, array.join(s_arr6, ","), text_halign = text.align_center, bgcolor = bgColor_body, text_color = textColor, text_size = size.small)
Short Percent
https://www.tradingview.com/script/hLtBkW3A-Short-Percent/
barnabygraham
https://www.tradingview.com/u/barnabygraham/
25
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © barnabygraham //@version=5 indicator("Short Percent") setting=input.string('Percent of float held short',title='Choice',options=['Percent of float held short','Percent of volume short']) shs_out = request.financial(syminfo.tickerid, 'TOTAL_SHARES_OUTSTANDING', 'FQ') quandl_ticker = 'QUANDL:FINRA/FNSQ_' + str.replace_all(syminfo.ticker, '.', '_') shortFloat = (request.security(quandl_ticker, 'D', close))*10 shortFloatPercent=(shortFloat/(shs_out/100)) shortVol = request.security(str.tostring(syminfo.ticker) + "_SHORT_VOLUME", 'D', close) dailyVol = request.security(syminfo.tickerid, 'D', volume) shortVolumePercent=((shortVol/(dailyVol/100))) Final=setting=='Percent of float held short'?math.round(shortFloatPercent,2):math.round(shortVolumePercent,2) if barstate.isrealtime Final:=Final[1] plot(Final)
EV/GP
https://www.tradingview.com/script/3urqSWX7-EV-GP/
Pinochokolada
https://www.tradingview.com/u/Pinochokolada/
5
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Pinochokolada //@version=5 indicator("EV/GP") ev = request.financial(syminfo.tickerid, "ENTERPRISE_VALUE", "FQ") gp = request.financial(syminfo.tickerid, "GROSS_PROFIT", "FQ") evgp = ev/gp plot(evgp, color=color.maroon)
Moving Average Suite + VWAP + TICK
https://www.tradingview.com/script/Q3ih0X1F-Moving-Average-Suite-VWAP-TICK/
PtGambler
https://www.tradingview.com/u/PtGambler/
193
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © platsn // // This indicator combines some of the commonly used moving averages, VWAP, and TICK sentiment, all of which are useful for all types of trading // By default, this indicator includes: // - 21/50/100/200 period smoothed simple moving average // - great for determining trends // - also act as support / resistance line for price // - 9 period exponential moving average // - fast trend / direction indicator // - Volume Weighted Average Price // - no explaination required // - $TICK sentiment as background fill // - overall market sentiment and direction // - +/- 500 levels are colored green/red and are usually indication of institutional order flow --> critical for trading indexes such as SPY or QQQ // - deep green/red background indicates +/-1000 on the $TICK, which are usually associated with overbought or oversold //@version=5 indicator(title='Moving Average Suite + VWAP', shorttitle='MA Suite + VWAP', overlay=true, timeframe="", timeframe_gaps=true) //************************** Four Smoothed Moving Averages ********************** h_ma1 = input.bool(title='Show MA 1', defval=true, group='Display options') len1 = input.int(21, minval=1, title="SMMA 1", group = "Smoothed MA Inputs") src1 = close smma1 = 0.0 sma_1 = ta.sma(src1, len1) smma1 := na(smma1[1]) ? sma_1 : (smma1[1] * (len1 - 1) + src1) / len1 plot(h_ma1 ? smma1 : na, color=color.new(color.white, 0), linewidth=2, title='21 SMMA') h_ma2 = input.bool(title='Show MA 2', defval=true, group='Display options') len2 = input.int(50, minval=1, title="SMMA 2", group = "Smoothed MA Inputs") src2 = close smma2 = 0.0 sma_2 = ta.sma(src2, len2) smma2 := na(smma2[1]) ? sma_2 : (smma2[1] * (len2 - 1) + src2) / len2 plot(h_ma2 ? smma2 : na, color=color.new(#6aff00, 0), linewidth=2, title='50 SMMA') h_ma3 = input.bool(title='Show MA 3', defval=false, group='Display options') len3 = input.int(100, minval=1, title="SMMA 3", group = "Smoothed MA Inputs") src3 = close smma3 = 0.0 sma_3 = ta.sma(src3, len3) smma3 := na(smma3[1]) ? sma_3 : (smma3[1] * (len3 - 1) + src3) / len3 sma3plot = plot(h_ma3 ? smma3 : na, color=color.new(color.yellow, 0), linewidth=2, title='100 SMMA') h_ma4 = input.bool(title='Show MA 4', defval=true, group='Display options') len4 = input.int(200, minval=1, title="SMMA 4", group = "Smoothed MA Inputs") src4 = close smma4 = 0.0 sma_4 = ta.sma(src4, len4) smma4 := na(smma4[1]) ? sma_4 : (smma4[1] * (len4 - 1) + src4) / len4 sma4plot = plot(h_ma4 ? smma4 : na, color=color.new(#ff0500, 0), linewidth=2, title='200 SMMA') //********************************* EMA ************************************** h_ma5 = input.bool(title='Show EMA1', defval=true, group='Display options') len5 = input.int(9, minval=1, title="Fast EMA") src5 = input(close, title="Source") out1 = ta.ema(src5, len5) plot(h_ma5 ? out1 : na, title="EMA 1", color=color.blue, linewidth=2) h_ma6 = input.bool(title='Show EMA2', defval=true, group='Display options') len6 = input.int(21, minval=1, title="Slow EMA") src6 = input(close, title="Source") out2 = ta.ema(src6, len6) plot(h_ma6 ? out2 : na, title="EMA 2", color=color.orange, linewidth=2) // **************************** VWAP ***************************************** // Copied from TradingView Built-in var cumVol = 0. cumVol += nz(volume) if barstate.islast and cumVol == 0 runtime.error("No volume is provided by the data vendor.") computeVWAP(src, isNewPeriod, stDevMultiplier) => var float sumSrcVol = na var float sumVol = na var float sumSrcSrcVol = na sumSrcVol := isNewPeriod ? src * volume : src * volume + sumSrcVol[1] sumVol := isNewPeriod ? volume : volume + sumVol[1] // sumSrcSrcVol calculates the dividend of the equation that is later used to calculate the standard deviation sumSrcSrcVol := isNewPeriod ? volume * math.pow(src, 2) : volume * math.pow(src, 2) + sumSrcSrcVol[1] _vwap = sumSrcVol / sumVol variance = sumSrcSrcVol / sumVol - math.pow(_vwap, 2) variance := variance < 0 ? 0 : variance stDev = math.sqrt(variance) lowerBand = _vwap - stDev * stDevMultiplier upperBand = _vwap + stDev * stDevMultiplier [_vwap, lowerBand, upperBand] hideonDWM = input(false, title="Hide VWAP on 1D or Above", group="VWAP Settings") var anchor = input.string(defval = "Session", title="Anchor Period", options=["Session", "Week", "Month", "Quarter", "Year", "Decade", "Century", "Earnings", "Dividends", "Splits"], group="VWAP Settings") src = input(title = "Source", defval = hlc3, group="VWAP Settings") offset = input(0, title="Offset", group="VWAP Settings") showBands = input(false, title="Calculate Bands", group="Standard Deviation Bands Settings") stdevMult = input(1.0, title="Bands Multiplier", group="Standard Deviation Bands Settings") timeChange(period) => ta.change(time(period)) new_earnings = request.earnings(syminfo.tickerid, earnings.actual, barmerge.gaps_on, barmerge.lookahead_on, ignore_invalid_symbol=true) new_dividends = request.dividends(syminfo.tickerid, dividends.gross, barmerge.gaps_on, barmerge.lookahead_on, ignore_invalid_symbol=true) new_split = request.splits(syminfo.tickerid, splits.denominator, barmerge.gaps_on, barmerge.lookahead_on, ignore_invalid_symbol=true) isNewPeriod = switch anchor "Earnings" => not na(new_earnings) "Dividends" => not na(new_dividends) "Splits" => not na(new_split) "Session" => timeChange("D") "Week" => timeChange("W") "Month" => timeChange("M") "Quarter" => timeChange("3M") "Year" => timeChange("12M") "Decade" => timeChange("12M") and year % 10 == 0 "Century" => timeChange("12M") and year % 100 == 0 => false isEsdAnchor = anchor == "Earnings" or anchor == "Dividends" or anchor == "Splits" if na(src[1]) and not isEsdAnchor isNewPeriod := true float vwapValue = na float std = na float upperBandValue = na float lowerBandValue = na if not (hideonDWM and timeframe.isdwm) [_vwap, bottom, top] = computeVWAP(src, isNewPeriod, stdevMult) vwapValue := _vwap upperBandValue := showBands ? top : na lowerBandValue := showBands ? bottom : na plot(vwapValue, title="VWAP", color=#02f6fa, offset=offset, linewidth = 1 ) upperBand = plot(upperBandValue, title="Upper Band", color=color.green, offset=offset) lowerBand = plot(lowerBandValue, title="Lower Band", color=color.green, offset=offset) fill(upperBand, lowerBand, title="Bands Fill", color= showBands ? color.new(color.green, 95) : na) // ******************************* Trend Fill from 200 SMMA ****************************** trendFill = input.bool(title='Show Trend Fill', defval=true, group='Smoothed MA Inputs') ema2 = ta.ema(close, 2) ema2plot = plot(ema2, color=color.new(#2ecc71, 100), style=plot.style_line, linewidth=1, title='EMA(2)', editable=false) fill(ema2plot, sma4plot, color=ema2 > smma4 and trendFill ? color.new(color.green,85) : ema2 < smma4 and trendFill ? color.new(color.red,85) : na, title='Trend Fill') // ******************************* TICK Background Fill ********************************* displayTICK = input.bool(false, title="Fill background with TICK sentiment", group="TICK Brackground Fill") //get TICK data tickO = request.security("USI:TICK", timeframe.period, open) tickC = request.security("USI:TICK", timeframe.period, close) //Background bgcolor(displayTICK and tickC > 0 ? color.new(color.green,99) : color.new(color.red,99)) bgcolor(displayTICK and tickC > 499 ? color.new(color.green,95) : na) bgcolor(displayTICK and tickC < -499 ? color.new(color.red,95) : na) bgcolor(displayTICK and tickC > 999 ? color.new(color.green,95) : na) bgcolor(displayTICK and tickC < -999 ? color.new(color.red,95) : na) //Alert conditions alertcondition(tickC[1]<0 and tickC>0 and barstate.isconfirmed, "TICK turned green") alertcondition(tickC[1]>0 and tickC<0 and barstate.isconfirmed, "TICK turned red") alertcondition(tickC>499 and barstate.isconfirmed, "TICK > 500") alertcondition(tickC<-499 and barstate.isconfirmed, "TICK < 500") alertcondition(tickC>999 and barstate.isconfirmed, "TICK Overboughht") alertcondition(tickC<-999 and barstate.isconfirmed, "TICK Oversold")
Leonidas Squeeze Momentum System
https://www.tradingview.com/script/AWjeofo3-Leonidas-Squeeze-Momentum-System/
LeonidasCrypto
https://www.tradingview.com/u/LeonidasCrypto/
156
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // based on © OskarGallard implementation // custom version @leonidascrypto //@version=5 indicator(shorttitle="LSQMS", title="Leonidas Squeeze Momentum System", overlay=false) // Function to select the type of source get_src(Type) => if Type == "VWAP" ta.vwap else if Type == "Close" close else if Type == "Open" open else if Type == "HL2" hl2 else if Type == "HLC3" hlc3 else if Type == "OHLC4" ohlc4 else if Type == "Volume" nz(volume) else if Type == "High" high else if Type == "Low" low else if Type == "vwap(Close)" ta.vwap(close) else if Type == "vwap(Open)" ta.vwap(open) else if Type == "vwap(High)" ta.vwap(high) else if Type == "vwap(Low)" ta.vwap(low) else if Type == "AVG(vwap(H,L))" math.avg(ta.vwap(high), ta.vwap(low)) else if Type == "AVG(vwap(O,C))" math.avg(ta.vwap(open), ta.vwap(close)) else if Type == "OBV" // On Balance Volume ta.obv else if Type == "AccDist" // Accumulation Distribution ta.accdist else if Type == "PVT" // Price Volume Trend ta.pvt f_c_gradientAdvDecPro(_source, _center, _steps, _c_bearWeak, _c_bearStrong, _c_bullWeak, _c_bullStrong) => var float _qtyAdvDec = 0. var float _maxSteps = math.max(1, _steps) bool _xUp = ta.crossover(_source, _center) bool _xDn = ta.crossunder(_source, _center) float _chg = ta.change(_source) bool _up = _chg > 0 bool _dn = _chg < 0 bool _srcBull = _source > _center bool _srcBear = _source < _center _qtyAdvDec := _srcBull ? _xUp ? 1 : _up ? math.min(_maxSteps, _qtyAdvDec + 1) : _dn ? math.max(1, _qtyAdvDec - 1) : _qtyAdvDec : _srcBear ? _xDn ? 1 : _dn ? math.min(_maxSteps, _qtyAdvDec + 1) : _up ? math.max(1, _qtyAdvDec - 1) : _qtyAdvDec : _qtyAdvDec var color _return = na _return := _srcBull ? color.from_gradient(_qtyAdvDec, 1, _maxSteps, _c_bullWeak, _c_bullStrong) : _srcBear ? color.from_gradient(_qtyAdvDec, 1, _maxSteps, _c_bearWeak, _c_bearStrong) : _return // Kaufman's Adaptive Moving Average - Fast and Slow Ends fastK = 0.666 // KAMA Fast End slowK = 0.645 // KAMA Slow End kama(x, t)=> dist = math.abs(x[0] - x[1]) signal = math.abs(x - x[t]) noise = math.sum(dist, t) effr = noise != 0 ? signal/noise : 1 sc = math.pow(effr*(fastK - slowK) + slowK,2) KAMA = x KAMA := nz(KAMA[1]) + sc*(x - nz(KAMA[1])) KAMA // Jurik Moving Average of @everget jma(src, length, power, phase) => phaseRatio = phase < -100 ? 0.5 : phase > 100 ? 2.5 : phase / 100 + 1.5 beta = 0.45 * (length - 1) / (0.45 * (length - 1) + 2) alpha = math.pow(beta, power) JMA = 0.0 e0 = 0.0 e0 := (1 - alpha) * src + alpha * nz(e0[1]) e1 = 0.0 e1 := (src - e0) * (1 - beta) + beta * nz(e1[1]) e2 = 0.0 e2 := (e0 + phaseRatio * e1 - nz(JMA[1])) * math.pow(1 - alpha, 2) + math.pow(alpha, 2) * nz(e2[1]) JMA := e2 + nz(JMA[1]) JMA cti(sm, src, cd) => di = (sm - 1.0) / 2.0 + 1.0 c1 = 2 / (di + 1.0) c2 = 1 - c1 c3 = 3.0 * (cd * cd + cd * cd * cd) c4 = -3.0 * (2.0 * cd * cd + cd + cd * cd * cd) c5 = 3.0 * cd + 1.0 + cd * cd * cd + 3.0 * cd * cd i1 = 0.0 i2 = 0.0 i3 = 0.0 i4 = 0.0 i5 = 0.0 i6 = 0.0 i1 := c1*src + c2*nz(i1[1]) i2 := c1*i1 + c2*nz(i2[1]) i3 := c1*i2 + c2*nz(i3[1]) i4 := c1*i3 + c2*nz(i4[1]) i5 := c1*i4 + c2*nz(i5[1]) i6 := c1*i5 + c2*nz(i6[1]) bfr = -cd*cd*cd*i6 + c3*(i5) + c4*(i4) + c5*(i3) bfr a = 0.618 T3ma(src,Len) => e1 = ta.ema(src, Len) e2 = ta.ema(e1, Len) e3 = ta.ema(e2, Len) e4 = ta.ema(e3, Len) e5 = ta.ema(e4, Len) e6 = ta.ema(e5, Len) C1 = -a*a*a C2 = 3*a*a+3*a*a*a C3 = -6*a*a-3*a-3*a*a*a C4 = 1+3*a+a*a*a+3*a*a C1*e6+C2*e5+C3*e4+C4*e3 VIDYA(src,Len) => mom = ta.change(src) upSum = math.sum(math.max(mom, 0), Len) downSum = math.sum(-math.min(mom, 0), Len) out = (upSum - downSum) / (upSum + downSum) cmo = math.abs(out) alpha = 2 / (Len + 1) vidya = 0.0 vidya := src * alpha * cmo + nz(vidya[1]) * (1 - alpha * cmo) vidya // ZLEMA: Zero Lag zema(_src, _len) => _alpha = (_len - 1) / 2 _zlema0 = (_src + (_src - _src[_alpha])) _zlemaF = ta.ema(_zlema0, _len) ma(MAType, MASource, MAPeriod) => if MAPeriod > 0 if MAType == "SMA" ta.sma(MASource, MAPeriod) else if MAType == "EMA" ta.ema(MASource, MAPeriod) else if MAType == "WMA" ta.wma(MASource, MAPeriod) else if MAType == "RMA" ta.rma(MASource, MAPeriod) else if MAType == "HMA" ta.hma(MASource, MAPeriod) else if MAType == "DEMA" e = ta.ema(MASource, MAPeriod) 2 * e - ta.ema(e, MAPeriod) else if MAType == "TEMA" e = ta.ema(MASource, MAPeriod) 3 * (e - ta.ema(e, MAPeriod)) + ta.ema(ta.ema(e, MAPeriod), MAPeriod) else if MAType == "VWMA" ta.vwma(MASource, MAPeriod) else if MAType == "ALMA" ta.alma(MASource, MAPeriod, .85, 6) else if MAType == "CTI" cti(MAPeriod, MASource, 0) else if MAType == "KAMA" kama(MASource, MAPeriod) else if MAType == "SWMA" ta.swma(MASource) else if MAType == "JMA" jma(MASource, MAPeriod, 2, 50) else if MAType == "LSMA" ta.linreg(MASource, MAPeriod, 0) // Least Squares else if MAType == "Wild" wild = MASource wild := nz(wild[1]) + (MASource - nz(wild[1])) / MAPeriod else if MAType == "Tillson T3" T3ma(MASource, MAPeriod) else if MAType == "VIDYA" VIDYA(MASource, MAPeriod) else if MAType == "DWMA" // Double Weighted Moving Average ta.wma(ta.wma(MASource, MAPeriod), MAPeriod) else if MAType == "DVWMA" // Double Volume-Weighted Moving Average ta.vwma(ta.vwma(MASource, MAPeriod), MAPeriod) else if MAType == "Zero Lag" zema(MASource, MAPeriod) // Input - Squeeze Momentum Indicator show_Momen = input.bool(true, "▷ Show Momentum ", inline="mom", group="Squeeze Momentum Indicator") bgoff = input.bool(true, "Background Off", inline="mom", group="Squeeze Momentum Indicator") lengthM = input.int(20, "MOM Length", minval=1, step=1, inline="M", group="Squeeze Momentum Indicator") srcM = input.source(close, "Source", inline="M", group="Squeeze Momentum Indicator") typeMom = input.string('ALMA', "Type", inline = "M", group="Squeeze Momentum Indicator", options=["SMA", "EMA", "WMA", "DWMA", "VWMA", "DVWMA", "HMA", "ALMA", "Wild", "JMA", "KAMA", "Zero Lag", "Tillson T3", "VIDYA", "CTI", "RMA", "DEMA", "TEMA", "SWMA"]) length = input.int(20, "SQZ Length", minval=1, step=1, inline="S", group="Squeeze Momentum Indicator") src = input.source(ohlc4, "SQZ Source", inline="S", group="Squeeze Momentum Indicator") bbmatype = input.string('ALMA', "BB Calculation Type", inline = "bb", group="Squeeze Momentum Indicator", options=["SMA", "EMA", "WMA", "DWMA", "VWMA", "DVWMA", "HMA", "ALMA", "LSMA", "Wild", "JMA", "Zero Lag", "Tillson T3", "VIDYA", "KAMA", "CTI", "RMA", "DEMA", "TEMA", "SWMA"]) multBB = input.float(2.0 , "BB MultFactor", step=0.25, inline = "bb", group="Squeeze Momentum Indicator") //Bollinger Bands Multiplier kcmatype = input.string('ALMA', "Keltner Channel Calculation Type", inline = "kc", group="Squeeze Momentum Indicator", options=["SMA", "EMA", "WMA", "DWMA", "VWMA", "DVWMA", "HMA", "ALMA", "LSMA", "Wild", "JMA", "Zero Lag", "Tillson T3", "VIDYA", "KAMA", "CTI", "RMA", "DEMA", "TEMA", "SWMA"]) useTR = input.bool(true, "Use TrueRange (KC)", inline = "kc", group="Squeeze Momentum Indicator") drdiv = input.bool(false, "Draw Divergence", inline="l1", group="Squeeze Momentum Indicator") zeroSQZ = input.bool(false, "SQZ Zero Line", inline="l1", group="Squeeze Momentum Indicator") darkm = input.bool(false, "Gray Background for Dark Mode", inline="l1", group="Squeeze Momentum Indicator") fasttrend = input.bool(false, "Show Fast SQ", inline="l1", group="Squeeze Momentum Indicator") fastlen = input.int(6, "Fast SQ", inline="l1", group="Squeeze Momentum Indicator") //SQ Colors strongbullcolor = input(#00ffe7, title = "Strong Bull Color",group="Squeeze Momentum Indicator") weakbullcolor = input(#4000ff, title = "Weak Bull Color",group="Squeeze Momentum Indicator") strongbearcolor = input(#ff0032, title = "Strong Bear Color",group="Squeeze Momentum Indicator") weakbearcolor = input(#ffff00, title = "Weak Bear Color",group="Squeeze Momentum Indicator") fastsqcolor = input(color.yellow, title = "Fast SQ Color",group="Squeeze Momentum Indicator") stepn = input(5, title = "Max Gradient Steps",group="Squeeze Momentum Indicator") // Input - ADX and DMI scale = input.float(55.0, "Scala for ADX", inline="dmi0", group="Directional Movement Index") pos = input.color(color.white, "Positive slope", inline="dmi0", group="Directional Movement Index") neg = input.color(color.gray, "Negative slope", inline="dmi0", group="Directional Movement Index") show_ADX = input.bool(true, "Show ADX", inline="showDMI", group="Directional Movement Index") hideLabel = input.bool(false, "▷ Hide DMI Label ◁", inline= "showDMI", group="Directional Movement Index") adxlen = input.int(14, "ADX Smoothing", minval=1, maxval=50, group="Directional Movement Index") dilen = input.int(14, "DI Length", minval=1, group="Directional Movement Index") keyLevel = input.int(23, "Key level for ADX", group="Directional Movement Index") weakTrend = input.int(17, "Weak Trend Theshold", group="Directional Movement Index") histLabel = input.int(0 , "Historical Label Readings", minval=0, group="Directional Movement Index") keyColor = input.bool(false, "KeyLevel with color DMI", inline="k_level", group="Directional Movement Index") distance = input.int(-5, "Distance between KeyLevel and 0", inline="k_level", group="Directional Movement Index") //_________________________________________________________________________________ // Based on "Squeeze Momentum Indicator" - Author:@LazyBear and @J-Streak // https://www.tradingview.com/script/nqQ1DT5a-Squeeze-Momentum-Indicator-LazyBear/ // https://www.tradingview.com/script/557GijRq-JS-Squeeze-Pro-2/ //_________________________________________________________________________________ // Bollinger Bands Basis Line basis = ma(bbmatype, src, length) // Keltner Channel Basis Line basiskc = ma(kcmatype, src, length) // Keltner Channel Range range_src = useTR ? ta.tr : (high - low) range_kc = ma(kcmatype, range_src, length) // Keltner Channel Low Multiplier multlowKC = 2.0 // Keltner Channel Mid Multiplier multmidKC = 1.5 // Keltner Channel High Multiplier multhighKC = 1.0 // Bollinger Bands dev = multBB * ta.stdev(src, length) upperBB = basis + dev lowerBB = basis - dev //Keltner Channel Bands Low upperKCl = basiskc + range_kc * multlowKC lowerKCl = basiskc - range_kc * multlowKC //Keltner Channel Bands Mid upperKCm = basiskc + range_kc * multmidKC lowerKCm = basiskc - range_kc * multmidKC //Keltner Channel Bands High upperKCh = basiskc + range_kc * multhighKC lowerKCh = basiskc - range_kc * multhighKC //------------------------{ Squeeze Momentum Basics }------------------------------------ //Momentum ma_momentum = ma(typeMom, srcM, lengthM) sz = ta.linreg(srcM - math.avg(math.avg(ta.highest(high, lengthM), ta.lowest(low, lengthM)), ma_momentum), lengthM, 0) //Momentum Conditions sc1 = sz >= 0 sc2 = sz < 0 sc3 = sz >= sz[1] sc4 = sz < sz[1] //Squeeze On lowsqz = lowerBB > lowerKCl and upperBB < upperKCl lsf = lowsqz == false midsqz = lowerBB > lowerKCm and upperBB < upperKCm msf = midsqz == false highsqz = lowerBB > lowerKCh and upperBB < upperKCh hsf = highsqz == false //-----------------{ Indicator Components and Plots }--------------------------- //Squeeze Dot Colors orange_red = #FF4000 // Original Squeeze golden_yellow = #FFE500 // High Squeeze sqzproc = highsqz ? golden_yellow : midsqz ? orange_red : lowsqz ? color.gray : na fastsq= ta.ema(sz,fastlen) //Plot Zero Line color_zero = color.gray plot(zeroSQZ ? 0 : na, title="Squeeze Zero Line", color=color_zero, linewidth=2, style=plot.style_circles) //Squeeze Plot col = f_c_gradientAdvDecPro(sz, 0, stepn , weakbearcolor, strongbearcolor, weakbullcolor,strongbullcolor ) plot(show_Momen ? sz : na, title="Squeeze Momentum", color=col, style=plot.style_area) plot(fasttrend?fastsq: na,title="Fast SQ",color=fastsqcolor,style=plot.style_circles) //Background Conditions bg1_dark = color.new(color.gray, 95) bg2_dark = color.new(#673AB7, 95) bg3_dark = color.new(color.gray, 95) bg4_dark = color.new(#FFD600, 95) bg5_dark = color.new(#CE93D8, 95) clr1_bg = sc1 and sc3 ? color.new(#00EEFF, 80) : sc1 and sc4 ? color.new(#000EFF, 80) : sc2 and sc4 ? color.new(#FF0000, 80) : sc2 and sc3 ? color.new(#FFE500, 80) : color.new(color.gray, 80) clr2_bg = sc1 and sc3 ? color.new(#00bcd4, 80) : sc1 and sc4 ? color.new(#0D47A1, 80) : sc2 and sc4 ? color.new(#BA68C8, 80) : sc2 and sc3 ? color.new(#9C27B0, 80) : color.new(#673AB7, 80) clr3_bg = sc1 and sc3 ? color.new(#15FF00, 80) : sc1 and sc4 ? color.new(#388E3C, 80) : sc2 and sc4 ? color.new(#F44336, 80) : sc2 and sc3 ? color.new(#B71C1C, 80) : color.new(color.gray, 80) clr4_bg = sc1 and sc3 ? color.new(#fff59d, 80) : sc1 and sc4 ? color.new(#FFD600, 80) : sc2 and sc4 ? color.new(#FFCC80, 80) : sc2 and sc3 ? color.new(#FF9800, 80) : color.new(#702700, 80) clr5_bg = sc1 and sc3 ? color.new(#2196F3, 80) : sc1 and sc4 ? color.new(#0D47A1, 80) : sc2 and sc4 ? color.new(#EF9A9A, 80) : sc2 and sc3 ? color.new(#D32F2F, 80) : color.new(#CE93D8, 80) //Divergence Formula {Compliments of Ricardo Santos} ftf(_src) => _src[4] < _src[2] and _src[3] < _src[2] and _src[2] > _src[1] and _src[2] > _src[0] fbf(_src) => _src[4] > _src[2] and _src[3] > _src[2] and _src[2] < _src[1] and _src[2] < _src[0] ffract(_src) => fbf__1 = fbf(_src) ftf(_src) ? 1 : fbf__1 ? -1 : 0 fractaltop = ffract(sz) > 0 ? sz[2] : na fractalbot = ffract(sz) < 0 ? sz[2] : na high_prev = ta.valuewhen(fractaltop, sz[2], 1) high_price = ta.valuewhen(fractaltop, high[2], 1) low_prev = ta.valuewhen(fractalbot, sz[2], 1) low_price = ta.valuewhen(fractalbot, low[2], 1) regbeardiv = fractaltop and high[2] > high_price and sz[2] < high_prev hidbeardiv = fractaltop and high[2] < high_price and sz[2] > high_prev regbulldiv = fractalbot and low[2] < low_price and sz[2] > low_prev hidbulldiv = fractalbot and low[2] > low_price and sz[2] < low_prev //Divergence Plot plot(drdiv ? fractaltop ? sz[2] : na : na, 'Bearish Fractal', color=regbeardiv ? color.new(color.orange,1) : na, linewidth=2, offset=-2, editable=false) plot(drdiv ? fractalbot ? sz[2] : na : na, 'Bullish Fractal', color=regbulldiv ? color.new(color.blue,1) : na, linewidth=2, offset=-2, editable=false) plot(drdiv ? fractaltop ? sz[2] : na : na, 'Bearish Divergence', style=plot.style_circles, color=regbeardiv ? color.new(color.orange,1) : na, linewidth=3, offset=-2, editable=false) plot(drdiv ? fractalbot ? sz[2] : na : na, 'Bullish Divergence', style=plot.style_circles, color=regbulldiv ? color.new(color.blue,1) : na, linewidth=3, offset=-2, editable=false) //______________________________________________________________________________ // Based on "Directional Movement Index and ADX" // https://www.tradingview.com/script/VroqhJmg/ //______________________________________________________________________________ [diplus, diminus, adxValue] = ta.dmi(dilen, adxlen) biggest(series) => max = 0.0 max := nz(max[1], series) if series > max max := series max // Calculate ADX Scale ni = biggest(sz) adx_scale = (adxValue - keyLevel + distance) * ni/scale dmiBull = diplus >= diminus and adxValue >= keyLevel dmiBear = diplus < diminus and adxValue >= keyLevel dmiWeak = adxValue < keyLevel and adxValue > weakTrend dmiColor = dmiBull ? (adxValue > adxValue[1] ? #006400 : color.green) : dmiBear ? (adxValue > adxValue[1] ? #910000 : color.red ) : dmiWeak ? (adxValue > adxValue[1] ? color.black : color.gray ) : (adxValue > adxValue[1] ? #DAA80A : #FFC40C) color_ADX = adxValue > adxValue[1] ? pos : neg plot(show_ADX ? adx_scale : na, color = color_ADX, title = "ADX", linewidth = 2) plot(zeroSQZ ? na : (show_ADX ? distance* ni/scale : na), color = keyColor ? dmiColor : color_ADX, title = "Key Level", linewidth = 1, style = plot.style_line)
Advantage RSI Predictor
https://www.tradingview.com/script/KReI02Mp-Advantage-RSI-Predictor/
AdvantageTrading
https://www.tradingview.com/u/AdvantageTrading/
70
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © AdvantageTrading //@version=5 indicator(title="Advantage RSI Predictor", shorttitle="Advantage RSI Predictor", overlay=true, format=format.price, timeframe="", timeframe_gaps=true) rsiLengthInput = input.int(14, minval=1, title="Length", group="RSI Settings") rsiSourceInput = input.source(close, "Source", group="RSI Settings") up_level = input.float(70, "overbought level",maxval=99,minval=50, group="RSI Predictor Settings") down_level = input.float(30, "oversold level",maxval=50,minval=1, group="RSI Predictor Settings") line50 = input(true, '50-point line On/Off') up = ta.rma(math.max(ta.change(rsiSourceInput), 0), rsiLengthInput) down = ta.rma(-math.min(ta.change(rsiSourceInput), 0), rsiLengthInput) SF = 1/rsiLengthInput X1 = up_level/(100 - up_level) X2 = (100 - down_level)/down_level resistance = rsiSourceInput + (rsiLengthInput -1) * (X1 * down - up) support = rsiSourceInput - (rsiLengthInput -1) * (X2 * up - down) middle = rsiSourceInput - (rsiLengthInput -1) * (up - down) plot(resistance, "resistance", color=color.red, offset=1) plot(support, "support", color=color.red, offset=1) plot(line50 ? middle : na, "50-point line", color=color.black, offset=1)
BTC 1D Safety trade
https://www.tradingview.com/script/OECHlPtg-btc-1d-safety-trade/
Crypto_BitCoinTrader
https://www.tradingview.com/u/Crypto_BitCoinTrader/
202
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Crypto_BitCoinTrader //@version=5 indicator(title="Safety trade [Crypto_BCT]", shorttitle="Safety Trade [Crypto_BCT]", overlay=true, max_labels_count = 500) input_draw = input.string(defval = "Lines", title="Drawing", options=["Waves", "Lines"]) input_cash = input.float(defval = 1000.00, title="Initial capital (USD)", minval = 1.00) input_perc_line_1 = input.float(defval = 27.2020, title = "Line 1 shift up %") input_perc_line_2 = input.float(defval = 12.7845, title = "Line 2 shift up %") input_perc_line_4 = input.float(defval = 9.1156, title = "Line 4 shift down %") input_perc_line_5 = input.float(defval = 19.0250, title = "Line 5 shift down %") lenght = input(12, "Lenght SMA") src = close Source_MA = ta.sma(src, lenght) curr = syminfo.currency basecurr = syminfo.basecurrency // Date Year = input(2021) Month = input(1) Day = input(1) Hours = input(0) Minutes = input(0) start = timestamp(Year, Month, Day, Hours, Minutes) line_1 = Source_MA + (Source_MA * input_perc_line_1/100) line_2 = Source_MA + (Source_MA * input_perc_line_2/100) line_3 = Source_MA line_4 = Source_MA - (Source_MA * input_perc_line_4/100) line_5 = Source_MA - (Source_MA * input_perc_line_5/100) plot(input_draw == "Waves" ? line_1 : na, linewidth = 2, color=color.red, title="MA1") plot(input_draw == "Waves" ? line_2 : na, linewidth = 1, color=#FF7373, title="MA2") plot(input_draw == "Waves" ? line_3 : na, linewidth = 1, color=color.white, title="MA3") plot(input_draw == "Waves" ? line_4 : na, linewidth = 1, color=#76CD76, title="MA4") plot(input_draw == "Waves" ? line_5 : na, linewidth = 2, color=color.green, title="MA5") // 1 var label_1 = label.new(na, na, style=label.style_label_left, xloc = xloc.bar_index) label.set_x(label_1, bar_index + 3) label.set_y(label_1, line_1) label.set_text(label_1, str.tostring(float (line_1), "#.##")) label.set_color(label_1, color.red) label.set_textcolor(label_1, color.white) Y_position_line_1 = line_1 if input_draw == "Lines" var level_line_1 = line.new(na,na,na,na) line.set_x1(level_line_1, bar_index[9]) line.set_x2(level_line_1, bar_index) line.set_y1(level_line_1, Y_position_line_1) line.set_y2(level_line_1, Y_position_line_1) line.set_color(level_line_1, color.red) line.set_width(level_line_1, 3) // 2 var label_2 = label.new(na, na, style=label.style_label_left, xloc = xloc.bar_index) label.set_x(label_2, bar_index + 3) label.set_y(label_2, line_2) label.set_text(label_2, str.tostring(float (line_2), "#.##")) label.set_color(label_2, color = #EF9292) label.set_textcolor(label_2, color.white) Y_position_line_2 = line_2 if input_draw == "Lines" var level_line_2 = line.new(na,na,na,na) line.set_x1(level_line_2, bar_index[9]) line.set_x2(level_line_2, bar_index) line.set_y1(level_line_2, Y_position_line_2) line.set_y2(level_line_2, Y_position_line_2) line.set_color(level_line_2, color = #EF9292) line.set_width(level_line_2, 2) // 3 var label_3 = label.new(na, na, style=label.style_label_left, xloc = xloc.bar_index) label.set_x(label_3, bar_index + 3) label.set_y(label_3, line_3) label.set_text(label_3, str.tostring(float (line_3), "#.##")) label.set_color(label_3, color.white) label.set_textcolor(label_3, color.black) Y_position_line_3 = line_3 if input_draw == "Lines" var level_line_3 = line.new(na,na,na,na) line.set_x1(level_line_3, bar_index[9]) line.set_x2(level_line_3, bar_index) line.set_y1(level_line_3, Y_position_line_3) line.set_y2(level_line_3, Y_position_line_3) line.set_color(level_line_3, color.white) // 4 var label_4 = label.new(na, na, style=label.style_label_left, xloc = xloc.bar_index) label.set_x(label_4, bar_index + 3) label.set_y(label_4, line_4) label.set_text(label_4, str.tostring(float (line_4), "#.##")) label.set_color(label_4, color = color.green) label.set_textcolor(label_4, color.white) Y_position_line_4 = line_4 if input_draw == "Lines" var level_line_4 = line.new(na,na,na,na) line.set_x1(level_line_4, bar_index[9]) line.set_x2(level_line_4, bar_index) line.set_y1(level_line_4, Y_position_line_4) line.set_y2(level_line_4, Y_position_line_4) line.set_color(level_line_4, color = color.green) line.set_width(level_line_4, 2) // 5 var label_5 = label.new(na, na, style=label.style_label_left, xloc = xloc.bar_index) label.set_x(label_5, bar_index + 3) label.set_y(label_5, line_5) label.set_text(label_5, str.tostring(float (line_5), "#.##")) label.set_color(label_5, color = #116211) label.set_textcolor(label_5, color.white) Y_position_line_5 = line_5 if input_draw == "Lines" var level_line_5 = line.new(na,na,na,na) line.set_x1(level_line_5, bar_index[9]) line.set_x2(level_line_5, bar_index) line.set_y1(level_line_5, Y_position_line_5) line.set_y2(level_line_5, Y_position_line_5) line.set_color(level_line_5, color = #116211) line.set_width(level_line_5, 3) CrossBuyClose100 = ta.cross(high, line_1) CrossBuyClose50 = ta.cross(high, line_2) CrossBuy25 = ta.cross(close, line_3) CrossBuy50 = ta.cross(low, line_4) CrossBuy100 = ta.cross(low, line_5) alertcondition(CrossBuy50, title="Buy 50%", message="Buy 50% alert") alertcondition(CrossBuy100, title="Buy 100%", message="Buy 100% alert") alertcondition(CrossBuyClose50, title="Close 50% Buy", message="Close 50% Buy alert") alertcondition(CrossBuyClose100, title="Close 100% Buy", message="Close 100% Buy alert") alertcondition(CrossBuyClose50, title="Sell 50%", message="Sell 50% alert") alertcondition(CrossBuyClose100, title="Sell 100%", message="Sell 100% alert") alertcondition(CrossBuy50, title="Close 50% Sell", message="Close 50% Sell alert") alertcondition(CrossBuy100, title="Close 100% Sell", message="Close 100% Sell alert") var Buy25Counter = 0 var Buy50Counter = 0 var Buy100Counter = 0 var CloseBuy50Counter = 0 var CloseBuy100Counter = 0 var float Cash = input_cash var float Coin = 0.00 if time >= start and CrossBuy25 and Buy25Counter == 0 and not CrossBuy50 and Buy50Counter == 0 and Buy100Counter == 0 Buy25 = label.new(na, na, yloc = yloc.belowbar) label.set_x(Buy25, bar_index) label.set_xloc(Buy25, bar_index, xloc.bar_index) label.set_y(Buy25, low) label.set_text(Buy25, "buy 25%") label.set_color(Buy25, color.green) label.set_textcolor(Buy25, color.green) label.set_style(Buy25, label.style_arrowup) label.set_size(Buy25, size.normal) Buy25Counter := Buy25Counter + 1 CloseBuy100Counter := 0 Coin := Coin + ((Cash*0.25) / close) Cash := Cash - (Cash*0.25) if time >= start and CrossBuy50 and Buy50Counter == 0 and not CrossBuy100 and Buy100Counter == 0 Buy50 = label.new(na, na, yloc = yloc.belowbar) label.set_x(Buy50, bar_index) label.set_xloc(Buy50, bar_index, xloc.bar_index) label.set_y(Buy50, low) label.set_text(Buy50, "buy 50%") label.set_color(Buy50, color.green) label.set_textcolor(Buy50, color.green) label.set_style(Buy50, label.style_arrowup) label.set_size(Buy50, size.normal) Buy50Counter := Buy50Counter + 1 CloseBuy100Counter := 0 Coin := Coin + ((Cash*0.5) / close) Cash := Cash - (Cash*0.5) if time >= start and CrossBuy100 and Buy100Counter == 0 Buy100 = label.new(na, na, yloc = yloc.belowbar) label.set_x(Buy100, bar_index) label.set_xloc(Buy100, bar_index, xloc.bar_index) label.set_y(Buy100, low) label.set_text(Buy100, "buy 100%") label.set_color(Buy100, color.green) label.set_textcolor(Buy100, color.green) label.set_style(Buy100, label.style_arrowup) label.set_size(Buy100, size.normal) Buy100Counter := Buy100Counter + 1 CloseBuy100Counter := 0 Coin := Coin + (Cash / close) Cash := Cash - Cash if CrossBuyClose50 and (Buy25Counter > 0 or Buy50Counter > 0 or Buy100Counter > 0) and not CrossBuyClose100 BuyClose50 = label.new(na, na, yloc = yloc.abovebar) label.set_x(BuyClose50, bar_index) label.set_xloc(BuyClose50, bar_index, xloc.bar_index) label.set_y(BuyClose50, high) label.set_text(BuyClose50, "close 50% long") label.set_color(BuyClose50, color.red) label.set_textcolor(BuyClose50, color.red) label.set_style(BuyClose50, label.style_arrowdown) label.set_size(BuyClose50, size.normal) CloseBuy50Counter := CloseBuy50Counter + 1 Buy25Counter := 0 Buy50Counter := 0 Buy100Counter := 0 Cash := Cash + ((Coin*0.5)*close) Coin := Coin - (Coin*0.5) if CrossBuyClose100 and (Buy25Counter > 0 or Buy50Counter > 0 or Buy100Counter > 0 or CloseBuy50Counter > 0) BuyClose100 = label.new(na, na, yloc = yloc.abovebar) label.set_x(BuyClose100, bar_index) label.set_xloc(BuyClose100, bar_index, xloc.bar_index) label.set_y(BuyClose100, high) label.set_text(BuyClose100, "close ALL long") label.set_color(BuyClose100, color.red) label.set_textcolor(BuyClose100, color.red) label.set_style(BuyClose100, label.style_arrowdown) label.set_size(BuyClose100, size.normal) CloseBuy100Counter := CloseBuy100Counter + 1 CloseBuy50Counter := 0 Buy25Counter := 0 Buy50Counter := 0 Buy100Counter := 0 Cash := Cash + (Coin*close) Coin := Coin - Coin green = color.new(#1b5e20, 60) bgcolor(color=Buy100Counter > 0 and Buy100Counter[1] == 0 ? green : na, title = "Buy 100%") red = color.new(#801922, 60) bgcolor(color=CloseBuy100Counter > 0 and CloseBuy100Counter[1] == 0 ? red : na, title = "Close 100%") Profit = (Cash+(Coin*close)) / input_cash var Table = table.new(position = position.top_right, columns = 2, rows = 6, frame_color = color.white, frame_width = 2, bgcolor = #333333, border_width = 1) table.set_border_color(table_id = Table, border_color=#888888) table.cell(table_id = Table, column = 0, row = 0, text = "LONG Position", text_color = color.white) table.cell(table_id = Table, column = 1, row = 0, text = "PRICE", text_color = color.white) table.cell(table_id = Table, column = 0, row = 1, text = "Close ALL", text_color = color.white, bgcolor = color.red) table.cell(table_id = Table, column = 1, row = 1, text = str.tostring(float (line_1), "#.##"), text_color = color.white, bgcolor = color.red) table.cell(table_id = Table, column = 0, row = 2, text = "Close 50%", text_color = color.white, bgcolor = #EF9292) table.cell(table_id = Table, column = 1, row = 2, text = str.tostring(float (line_2), "#.##"), text_color = color.white, bgcolor = #EF9292) table.cell(table_id = Table, column = 0, row = 3, text = "Open BUY 25%", text_color = color.black, bgcolor = color.white) table.cell(table_id = Table, column = 1, row = 3, text = str.tostring(float (line_3), "#.##"), text_color = color.black, bgcolor = color.white) table.cell(table_id = Table, column = 0, row = 4, text = "Open BUY 50%", text_color = color.white, bgcolor = color.green) table.cell(table_id = Table, column = 1, row = 4, text = str.tostring(float (line_4), "#.##"), text_color = color.white, bgcolor = color.green) table.cell(table_id = Table, column = 0, row = 5, text = "Open BUY 100%", text_color = color.white, bgcolor = #116211) table.cell(table_id = Table, column = 1, row = 5, text = str.tostring(float (line_5), "#.##"), text_color = color.white, bgcolor = #116211) var TableCapital = table.new(position = position.bottom_right, columns = 3, rows = 2, frame_color = color.white, frame_width = 2, bgcolor = #333333, border_width = 1) table.set_border_color(table_id = TableCapital, border_color=#888888) table.cell(table_id = TableCapital, column = 0, row = 0, text = curr + " on hand", text_color = color.white) table.cell(table_id = TableCapital, column = 1, row = 0, text = basecurr + " on hand", text_color = color.white) table.cell(table_id = TableCapital, column = 2, row = 0, text = "Profit", text_color = color.white) table.cell(table_id = TableCapital, column = 0, row = 1, text = str.tostring(Cash, "#.##"), text_color = color.white) table.cell(table_id = TableCapital, column = 1, row = 1, text = str.tostring(Coin, "#.########"), text_color = color.white) table.cell(table_id = TableCapital, column = 2, row = 1, text = str.tostring((Profit*100)-100, "#.##"), text_color = color.white) alertcondition(Buy25Counter > 0 and Buy25Counter[1] == 0, title="Buy 25%", message="Buy 25% alert") alertcondition(Buy50Counter > 0 and Buy50Counter[1] == 0, title="Buy 50%", message="Buy 50% alert") alertcondition(Buy100Counter > 0 and Buy100Counter[1] == 0, title="Buy 100%", message="Buy 100% alert") alertcondition(CloseBuy50Counter > 0 and CloseBuy50Counter[1] == 0, title="Close 50% long", message="Close 50% long alert") alertcondition(CloseBuy100Counter > 0 and CloseBuy100Counter[1] == 0, title="Close 100% long", message="Close 100% long alert")
Internals
https://www.tradingview.com/script/0fGRgrOi-Internals/
TraderCreatorPro
https://www.tradingview.com/u/TraderCreatorPro/
82
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © TraderCreatorPro //@version=5 indicator("Internals", overlay = true) //inputs normalcolor = input.color (color.gray) // the color if it is under the certain percentage colorchange = input.color(color.white) //the color it will change to if... percolor = input.int(100)// the percerntage the color will change with BoxPlacement = input.string(position.bottom_right, "Box Placement", options = [position.bottom_right, position.bottom_left, position.top_right, position.top_center, position.bottom_center]) ShowPcall = input.bool(true, "Put to Call Ratio") ShowADD = input.bool (true, "Advance Decline") ShowTick = input.bool (true, "Tick Mark") ShowVix = input.bool (true, "VIX") //Prepare a table var table myTable = table.new(BoxPlacement, 1, 4, bgcolor = normalcolor, border_color = color.black, border_width = 2) //Indicator math stuff PCALL = math.round(request.security("PC", "1", close),2) TICK = math.round(request.security("TICK", "1", close),2) ADD = request.security("ADD", "1", close) VIX = request.security("VIX", "1", close) //Draw Table if barstate.islast table.cell(myTable, 0,0, text = "PCALL: " + str.tostring(PCALL), text_color = ShowPcall? color.white: na, bgcolor = PCALL > 1? color.red :ShowPcall? color.gray: na) table.cell(myTable, 0,1, text = "TICK: " + str.tostring(TICK), text_color = ShowTick? color.white:na, bgcolor = ShowTick and TICK > 900? color.green : ShowTick and TICK <-900? color.red :ShowTick? color.gray: na) table.cell(myTable, 0,2, text = "ADD: " + str.tostring(ADD), text_color = ShowADD? color.white: na, bgcolor = ShowADD and ADD < -2000 ? color.red: ShowADD and ADD > 2000 ? color.green: ShowADD? color.gray: na) table.cell(myTable, 0,3, text = "VIX: " + str.tostring(VIX), text_color = ShowVix? color.white: na, bgcolor = ShowVix? color.gray:na) plot(na)
CA - China Rates
https://www.tradingview.com/script/MVDif5Hg-CA-China-Rates/
camiloaguilar1
https://www.tradingview.com/u/camiloaguilar1/
19
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © camiloaguilar1 //@version=5 indicator("CA - China Rates") // https://data.nasdaq.com/data/BCB/17899-official-interest-rate-china f = request.quandl("BCB/17899", barmerge.gaps_off, 0) fxi = request.security("FXI", timeframe.period, close) plot(f, title="China Rate") plot(fxi, title="FXI", color=color.green)
Delta Percentage
https://www.tradingview.com/script/05n5s0Nq/
kicknoob
https://www.tradingview.com/u/kicknoob/
9
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © kicknoob //@version=5 indicator("Delta Percentage",overlay=false) coin1 = input.string(title="Choose firstpair Coin ", defval="BTCUSDT") coin2 = input.string(title="Choose second pair Coin ", defval="ETHUSDT") coin3 = input.string(title="Choose third pair Coin ", defval="BNBUSDT") coin4 = input.string(title="Choose fourth pair Coin ", defval="DOGEUSDT") coin5 = input.string(title="Choose fifth pair Coin ", defval="LTCUSDT") coin6 = input.string(title="Choose sixth pair Coin ", defval="FILUSDT") coin7 = input.string(title="Choose seventh pair Coin ", defval="SOLUSDT") coin8 = input.string(title="Choose eight pair Coin ", defval="DOTUSDT") coin9 = input.string(title="Choose ninth pair Coin ", defval="LINKUSDT") c1 = request.security(coin1,timeframe.period,close) c2 = request.security(coin2,timeframe.period,close) c3 = request.security(coin3,timeframe.period,close) c4 = request.security(coin4,timeframe.period,close) c5 = request.security(coin5,timeframe.period,close) c6 = request.security(coin6,timeframe.period,close) c7 = request.security(coin7,timeframe.period,close) c8 = request.security(coin8,timeframe.period,close) c9 = request.security(coin9,timeframe.period,close) monthsBack = input.int(3, minval = 0) yearsBack = input.int(0, minval = 0) fromCurrentDateTime = input(false, "Calculate from current Date/Time instead of first of the month") targetDate = time >= timestamp( year(timenow) - yearsBack, month(timenow) - monthsBack, fromCurrentDateTime ? dayofmonth(timenow) : 1, fromCurrentDateTime ? hour(timenow) : 0, fromCurrentDateTime ? minute(timenow) : 0, fromCurrentDateTime ? second(timenow) : 0) beginMonth = not targetDate[1] and targetDate var float src1 = na var float src2 = na var float src3 = na var float src4 = na var float src5 = na var float src6 = na var float src7 = na var float src8 = na var float src9 = na if beginMonth src1 := c1 src2 := c2 src3 := c3 src4 := c4 src5 := c5 src6 := c6 src7 := c7 src8 := c8 src9 := c9 total1 = (c1-src1)/src1*100 total2 = (c2-src2)/src2*100 total3 = (c3-src3)/src3*100 total4 = (c4-src4)/src4*100 total5 = (c5-src5)/src5*100 total6 = (c6-src6)/src6*100 total7 = (c7-src7)/src7*100 total8 = (c8-src8)/src8*100 total9 = (c9-src9)/src9*100 plot(total1,title="Coin 1",color=color.red) plot(total2,title="Coin 2",color=color.blue) plot(total3,title="Coin 3",color=color.green) plot(total4,title="Coin 4",color=color.yellow) plot(total5,title="Coin 5",color=color.orange) plot(total6,title="Coin 6",color=color.gray) plot(total7,title="Coin 7",color=color.purple) plot(total8,title="Coin 8",color=color.maroon) plot(total9,title="Coin 9",color=color.white)
Levels Of Greed
https://www.tradingview.com/script/jrBgtwyL-Levels-Of-Greed/
AstrideUnicorn
https://www.tradingview.com/u/AstrideUnicorn/
395
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © AstrideUnicorn //@version=5 indicator("Levels Of Greed", overlay=true) // Define the source price series for the indicator calculations source = close // The indicator inputs length = input.int(defval=70, minval=30, maxval=150, title = "Window", tooltip="Higher values are better for measuring longer up-trends.") stability = input.int(defval=20, minval=10, maxval=20, title = "Levels Stability", tooltip="The higher the value is, the more stable and long the levels are, but the lag slightly increases.") mode = input.string(defval="Cool Guys Mode", options=['Cool Guys Mode','Serious Guys Mode']) // Calculate the current base level as the recent lowest price current_low= ta.lowest(high,length) // Calculate the rolling standard deviation of the source price stdev = ta.stdev(source,4*length) // Define the condition that an up-move has started (the price is above the latest // low for a specified amount of bars) condition1 = ta.highest(current_low,stability) == ta.lowest(current_low,stability) // During a decline don't update the rolling standard deviation on each bar, // to fix the distance between the levels of fear if condition1 stdev:=stdev[1] // Calculate the levels of fear greed_level_1 = current_low + 1*stdev greed_level_2 = current_low + 2*stdev greed_level_3 = current_low + 3*stdev greed_level_4 = current_low + 4*stdev greed_level_5 = current_low + 5*stdev greed_level_6 = current_low + 6*stdev greed_level_7 = current_low + 7*stdev // Store the previous value of base level current_low_previous = ta.valuewhen(condition1==true, current_low, 1) // Define the conditional color of the fear levels to make them visible only //during a decline greed_levels_color = condition1?color.green:na // Plot the levels of fear plot(greed_level_1, color= greed_levels_color, linewidth=1) plot(greed_level_2, color= greed_levels_color, linewidth=2) plot(greed_level_3, color= greed_levels_color, linewidth=3) plot(greed_level_4, color= greed_levels_color, linewidth=4) plot(greed_level_5, color= greed_levels_color, linewidth=5) plot(greed_level_6, color= greed_levels_color, linewidth=6) plot(greed_level_7, color= greed_levels_color, linewidth=7) // Prolongate the levels of fear when a decline is over and a rebound has started greed_levels_color_previous = condition1==false?color.green:na plot(ta.valuewhen(condition1==true, greed_level_1, 1), color= greed_levels_color_previous, linewidth=1) plot(ta.valuewhen(condition1==true, greed_level_2, 1), color= greed_levels_color_previous, linewidth=2) plot(ta.valuewhen(condition1==true, greed_level_3, 1), color= greed_levels_color_previous, linewidth=3) plot(ta.valuewhen(condition1==true, greed_level_4, 1), color= greed_levels_color_previous, linewidth=4) plot(ta.valuewhen(condition1==true, greed_level_5, 1), color= greed_levels_color_previous, linewidth=5) plot(ta.valuewhen(condition1==true, greed_level_6, 1), color= greed_levels_color_previous, linewidth=6) plot(ta.valuewhen(condition1==true, greed_level_7, 1), color= greed_levels_color_previous, linewidth=7) // Condition that defines the position of the fear levels labels: on the fourth // bar after a new set of fear levels is formed. draw_label_condition = ta.barssince(condition1[1]==false and condition1==true)==3 // Condition that checks if the mode for the labels is the Cool Guys Mode coolmode = mode == "Cool Guys Mode" // Plot the emoji labels if the Cool Guys Mode is selected plotchar(coolmode and draw_label_condition?greed_level_1:na,location=location.absolute, char = "😌", size=size.small) plotchar(coolmode and draw_label_condition?greed_level_2:na,location=location.absolute, char = "😋", size=size.small) plotchar(coolmode and draw_label_condition?greed_level_3:na,location=location.absolute, char = "😃", size=size.small) plotchar(coolmode and draw_label_condition?greed_level_4:na,location=location.absolute, char = "😮", size=size.small) plotchar(coolmode and draw_label_condition?greed_level_5:na,location=location.absolute, char = "😍", size=size.small) plotchar(coolmode and draw_label_condition?greed_level_6:na,location=location.absolute, char = "🤪", size=size.small) plotchar(coolmode and draw_label_condition?greed_level_7:na,location=location.absolute, char = "🤑", size=size.small) // Plot the number labels if the Serious Guys Mode is selected plotchar(coolmode==false and draw_label_condition?greed_level_1:na,location=location.absolute, char = "1", size=size.small) plotchar(coolmode==false and draw_label_condition?greed_level_2:na,location=location.absolute, char = "2", size=size.small) plotchar(coolmode==false and draw_label_condition?greed_level_3:na,location=location.absolute, char = "3", size=size.small) plotchar(coolmode==false and draw_label_condition?greed_level_4:na,location=location.absolute, char = "4", size=size.small) plotchar(coolmode==false and draw_label_condition?greed_level_5:na,location=location.absolute, char = "5", size=size.small) plotchar(coolmode==false and draw_label_condition?greed_level_6:na,location=location.absolute, char = "6", size=size.small) plotchar(coolmode==false and draw_label_condition?greed_level_7:na,location=location.absolute, char = "7", size=size.small)
Super Multi Trend [Salty]
https://www.tradingview.com/script/mSAv5Yqw-Super-Multi-Trend-Salty/
markmiotke
https://www.tradingview.com/u/markmiotke/
150
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © markmiotke //@version=5 indicator('Super Multi Trend [Salty]', overlay=false) // # 3 indicators: // 1st is the relationship of 8:13:21 EMAs, to show when they are stacked bullish, bearish, or neutral to help gauge momentum. // 2nd adds in the relationship of the 34 EMA High and 34 EMA Low, to get the trend of the 34 EMA (high, close, low) Wave. // 3rd is the relationship of 5:8:13:21:34:55 EMAs, to show when they are stacked bullish, bearish, or neutral to help gauge momentum and trend strength using more EMAs and colors. // Lighter colors indicate higher levels of bullishness or lesser levels of bearishness. Yellow indicates neutral or choppy price action. // These relationships are shown for the current symbol, and optionally for 3 additional symbols if desired. To hide unwanted rows uncheck them on the Setting Style Tab and uncheck Show Market Lables. BrightGreen = #7CFC00 LightPink = #FFB9D2 DarkGreen = #397934 DarkRed = #B22222 //Super Multi Trend Default Colors C_VeryBullish = BrightGreen C_Bullish = color.green C_SlightlyBullish = DarkGreen C_Sideways = color.yellow C_SlightlyBearish = LightPink C_Bearish = color.red C_VeryBearish = DarkRed C_Blank = color.new(color.black, 100) //Transp = 100 is invisible C_Label = color.new(color.black, 0) sizeOption = input.string(title='Label Size', options=['Auto', 'Huge', 'Large', 'Normal', 'Small', 'Tiny'], defval='Normal') bShowMarketTickers = input(title='Show Market Lables', defval=true) var string i_Tickers = input.string('SPY_QQQ_DIA', 'Market Tickers', options=['SPY_QQQ_DIA', 'ES1!_NQ1!_YM1!', 'SPX_NDX_DJI', 'User Specified Tickers']) var string userTicker1 = input.string('XLY', 'User Specified Ticker1') var string userTicker2 = input.string('AMZN', 'User Specified Ticker2') var string userTicker3 = input.string('TSLA', 'User Specified Ticker3') Ticker_1 = i_Tickers == 'SPY_QQQ_DIA' ? 'SPY' : i_Tickers == 'ES1!_NQ1!_YM1!' ? 'ES1!' : i_Tickers == 'SPX_NDX_DJI' ? 'SPX' : userTicker1 Ticker_2 = i_Tickers == 'SPY_QQQ_DIA' ? 'QQQ' : i_Tickers == 'ES1!_NQ1!_YM1!' ? 'NQ1!' : i_Tickers == 'SPX_NDX_DJI' ? 'NDX' : userTicker2 Ticker_3 = i_Tickers == 'SPY_QQQ_DIA' ? 'DIA' : i_Tickers == 'ES1!_NQ1!_YM1!' ? 'YM1!' : i_Tickers == 'SPX_NDX_DJI' ? 'DJI' : userTicker3 labelSize = sizeOption == 'Huge' ? size.huge : sizeOption == 'Large' ? size.large : sizeOption == 'Small' ? size.small : sizeOption == 'Tiny' ? size.tiny : sizeOption == 'Auto' ? size.auto : size.normal Simple_Trend() => EMA34High = ta.ema(high, 34) EMA34Low = ta.ema(low, 34) EMA8 = ta.ema(close, 8) EMA21 = ta.ema(close, 21) EMA13 = ta.ema(close, 13) stacked81321 = EMA8 > EMA13 and EMA13 > EMA21 ? 1 : EMA8 < EMA13 and EMA13 < EMA21 ? -1 : 0 WaveState = EMA8 > EMA13 and EMA13 > EMA21 and EMA21 > EMA34High ? 1 : EMA8 < EMA13 and EMA13 < EMA21 and EMA21 < EMA34Low ? -1 : 0 [stacked81321, WaveState] Super_Trend() => EMA5 = ta.ema(close, 5) EMA8 = ta.ema(close, 8) EMA13 = ta.ema(close, 13) EMA21 = ta.ema(close, 21) EMA34 = ta.ema(close, 34) EMA55 = ta.ema(close, 55) stacked5813213455 = EMA5 >= EMA8 and EMA8 >= EMA13 and EMA13 >= EMA21 and EMA21 > EMA34 and EMA34 > EMA55 ? 3 : EMA5 < EMA8 and EMA8 >= EMA13 and EMA13 >= EMA21 and EMA21 > EMA34 and EMA34 > EMA55 ? 1 : EMA8 < EMA13 and EMA13 >= EMA21 and EMA21 > EMA34 and EMA34 > EMA55 ? 2 : EMA5 <= EMA8 and EMA8 <= EMA13 and EMA13 <= EMA21 and EMA21 < EMA34 and EMA34 < EMA55 ? -3 : EMA5 > EMA8 and EMA8 <= EMA13 and EMA13 <= EMA21 and EMA21 < EMA34 and EMA34 < EMA55 ? -1 : EMA8 > EMA13 and EMA13 <= EMA21 and EMA21 < EMA34 and EMA34 < EMA55 ? -2 : 0 [stacked5813213455] text_gen(prefix, ticker, flag) => flag_text = flag == 3 ? 'BullStrong' : flag == 2 ? 'BullWeak' : flag == 1 ? 'Bullish' : flag == -3 ? 'BearStrong' : flag == -2 ? 'BearWeak' : flag == -1 ? 'Bearish' : 'S/W' prefix + '(' + ticker + ') : ' + flag_text flag_color(flag) => flag == 3 ? C_VeryBullish : flag == 2 ? C_SlightlyBullish : flag == 1 ? C_Bullish : flag == -1 ? C_Bearish : flag == -3 ? C_VeryBearish : flag == -2 ? C_SlightlyBearish : C_Sideways //15 t1_81321 //14 t1_wave //13 t1_SuperTrend// [t1_81321, t1_wave] = request.security(Ticker_1, '', Simple_Trend()) [t1_SuperTrend] = request.security(Ticker_1, '', Super_Trend()) var t1_81321_label = bShowMarketTickers ? label.new(x=na, y=15, xloc=xloc.bar_index, yloc=yloc.price, style=label.style_label_left, color=#00000000, size=labelSize, textalign=text.align_left) : na label.set_x(t1_81321_label, bar_index) label.set_tooltip(t1_81321_label, text_gen('8:13:21', Ticker_1, t1_81321)) label.set_text(t1_81321_label, Ticker_1 + ' (8:13:21)') label.set_textcolor(t1_81321_label, C_Label) plotshape(series=15, title='8:13:21 : Ticker #1', style=shape.square, location=location.absolute, color=flag_color(t1_81321)) var t1_wave_label = bShowMarketTickers ? label.new(x=na, y=14, xloc=xloc.bar_index, yloc=yloc.price, style=label.style_label_left, color=#00000000, size=labelSize, textalign=text.align_left) : na label.set_x(t1_wave_label, bar_index) label.set_tooltip(t1_wave_label, text_gen('Wave', Ticker_1, t1_wave)) label.set_text(t1_wave_label, Ticker_1 + ' (Wave)') label.set_textcolor(t1_wave_label, C_Label) plotshape(series=14, title='Wave : Ticker #1', style=shape.square, location=location.absolute, color=flag_color(t1_wave)) var t1_SuperTrend_label = bShowMarketTickers ? label.new(x=na, y=13, xloc=xloc.bar_index, yloc=yloc.price, style=label.style_label_left, color=#00000000, size=labelSize, textalign=text.align_left) : na label.set_x(t1_SuperTrend_label, bar_index) label.set_tooltip(t1_SuperTrend_label, text_gen('SuperTrend', Ticker_1, t1_SuperTrend)) label.set_text(t1_SuperTrend_label, Ticker_1 + ' (SuperTrend)') label.set_textcolor(t1_SuperTrend_label, flag_color(t1_SuperTrend)) plotshape(series=13, title='SuperTrend : Ticker #1', style=shape.square, location=location.absolute, color=flag_color(t1_SuperTrend)) //11 t2_81321 //10 t2_wave //9 t2_SuperTrend [t2_81321, t2_wave] = request.security(Ticker_2, '', Simple_Trend()) [t2_SuperTrend] = request.security(Ticker_2, '', Super_Trend()) var t2_81321_label = bShowMarketTickers ? label.new(x=na, y=11, xloc=xloc.bar_index, yloc=yloc.price, style=label.style_label_left, color=#00000000, size=labelSize, textalign=text.align_left) : na label.set_x(t2_81321_label, bar_index) label.set_tooltip(t2_81321_label, text_gen('8:13:21', Ticker_2, t2_81321)) label.set_text(t2_81321_label, Ticker_2 + ' (8:13:21)') label.set_textcolor(t2_81321_label, C_Label) plotshape(series=11, title='8:13:21 : Ticker #2', style=shape.square, location=location.absolute, color=flag_color(t2_81321)) var t2_wave_label = bShowMarketTickers ? label.new(x=na, y=10, xloc=xloc.bar_index, yloc=yloc.price, style=label.style_label_left, color=#00000000, size=labelSize, textalign=text.align_left) : na label.set_x(t2_wave_label, bar_index) label.set_tooltip(t2_wave_label, text_gen('Wave', Ticker_2, t2_wave)) label.set_text(t2_wave_label, Ticker_2 + ' (Wave)') label.set_textcolor(t2_wave_label, C_Label) plotshape(series=10, title='Wave : Ticker #2', style=shape.square, location=location.absolute, color=flag_color(t2_wave)) var t2_SuperTrend_label = bShowMarketTickers ? label.new(x=na, y=9, xloc=xloc.bar_index, yloc=yloc.price, style=label.style_label_left, color=#00000000, size=labelSize, textalign=text.align_left) : na label.set_x(t2_SuperTrend_label, bar_index) label.set_tooltip(t2_SuperTrend_label, text_gen('SuperTrend', Ticker_2, t2_SuperTrend)) label.set_text(t2_SuperTrend_label, Ticker_2 + ' (SuperTrend)') label.set_textcolor(t2_SuperTrend_label, flag_color(t2_SuperTrend)) plotshape(series=9, title='SuperTrend : Ticker #2', style=shape.square, location=location.absolute, color=flag_color(t2_SuperTrend)) //7 t3_81321 //6 t3_wave //5 t3_SuperTrend [t3_81321, t3_wave] = request.security(Ticker_3, '', Simple_Trend()) [t3_SuperTrend] = request.security(Ticker_3, '', Super_Trend()) var t3_81321_label = bShowMarketTickers ? label.new(x=na, y=7, xloc=xloc.bar_index, yloc=yloc.price, style=label.style_label_left, color=#00000000, size=labelSize, textalign=text.align_left) : na label.set_x(t3_81321_label, bar_index) label.set_tooltip(t3_81321_label, text_gen('8:13:21', Ticker_3, t3_81321)) label.set_text(t3_81321_label, Ticker_3 + ' (8:13:21)') label.set_textcolor(t3_81321_label, C_Label) plotshape(series=7, title='8:13:21 : Ticker #3', style=shape.square, location=location.absolute, color=flag_color(t3_81321)) var t3_wave_label = bShowMarketTickers ? label.new(x=na, y=6, xloc=xloc.bar_index, yloc=yloc.price, style=label.style_label_left, color=#00000000, size=labelSize, textalign=text.align_left) : na label.set_x(t3_wave_label, bar_index) label.set_tooltip(t3_wave_label, text_gen('Wave', Ticker_3, t3_wave)) label.set_text(t3_wave_label, Ticker_3 + ' (Wave)') label.set_textcolor(t3_wave_label, C_Label) plotshape(series=6, title='8:13:21 : Ticker #3', style=shape.square, location=location.absolute, color=flag_color(t3_wave)) var t3_SuperTrend_label = bShowMarketTickers ? label.new(x=na, y=5, xloc=xloc.bar_index, yloc=yloc.price, style=label.style_label_left, color=#00000000, size=labelSize, textalign=text.align_left) : na label.set_x(t3_SuperTrend_label, bar_index) label.set_tooltip(t3_SuperTrend_label, text_gen('SuperTrend', Ticker_3, t3_SuperTrend)) label.set_text(t3_SuperTrend_label, Ticker_3 + ' (SuperTrend)') label.set_textcolor(t3_SuperTrend_label, flag_color(t3_SuperTrend)) plotshape(series=5, title='SuperTrend : Ticker #3', style=shape.square, location=location.absolute, color=flag_color(t3_SuperTrend)) //3 main_81321 //2 main_wave //1 main_SuperTrend [main_81321, main_wave] = Simple_Trend() [main_SuperTrend] = Super_Trend() var main_81321_label = label.new(x=na, y=3, xloc=xloc.bar_index, yloc=yloc.price, style=label.style_label_left, color=#00000000, size=labelSize, textalign=text.align_left) label.set_x(main_81321_label, bar_index) label.set_tooltip(main_81321_label, text_gen('8:13:21', syminfo.ticker, main_81321)) label.set_text(main_81321_label, syminfo.ticker + " (8:13:21)") label.set_textcolor(main_81321_label, C_Label) plotshape(series=3, title='8:13:21 : Main', style=shape.square, location=location.absolute, color=flag_color(main_81321)) var main_wave_label = label.new(x=na, y=2, xloc=xloc.bar_index, yloc=yloc.price, style=label.style_label_left, color=#00000000, size=labelSize, textalign=text.align_left) label.set_x(main_wave_label, bar_index) label.set_tooltip(main_wave_label, text_gen('Wave', syminfo.ticker, main_wave)) label.set_text(main_wave_label, syminfo.ticker + ' (Wave)') label.set_textcolor(main_wave_label, C_Label) plotshape(series=2, title='Wave : Main', style=shape.square, location=location.absolute, color=flag_color(main_wave)) var main_SuperTrend_label = label.new(x=na, y=1, xloc=xloc.bar_index, yloc=yloc.price, style=label.style_label_left, color=#00000000, size=labelSize, textalign=text.align_left) label.set_x(main_SuperTrend_label, bar_index) label.set_tooltip(main_SuperTrend_label, text_gen('SuperTrend', syminfo.ticker, main_SuperTrend)) label.set_text(main_SuperTrend_label, syminfo.ticker + ' (SuperTrend)') label.set_textcolor(main_SuperTrend_label, flag_color(main_SuperTrend)) plotshape(series=1, title='SuperTrend Main', style=shape.square, location=location.absolute, color=flag_color(main_SuperTrend)) //Add Blank rows for spacing //Row 16 Blank plotshape(16, 'Blank 16', location=location.absolute, color=C_Blank, show_last=1) //Row 12 Blank plotshape(12, 'Blank 12', location=location.absolute, color=C_Blank, show_last=1) //Row 8 Blank plotshape(8, 'Blank 8', location=location.absolute, color=C_Blank, show_last=1) //Row 4 Blank plotshape(4, 'Blank 4', location=location.absolute, color=C_Blank, show_last=1) //Row 0 Blank plotshape(0, 'Blank 0', location=location.absolute, color=C_Blank, show_last=1)
Hour Vertical Lines
https://www.tradingview.com/script/aw3aEnaJ-Hour-Vertical-Lines/
RexDogActual
https://www.tradingview.com/u/RexDogActual/
233
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © xkavalis //@version=5 indicator("Hour Vertical Lines", shorttitle="hVL",overlay=true) cur_minute = minute do_plot = false if(cur_minute == 0 and cur_minute[1] > 0) do_plot := true else do_plot := false vline(BarIndex, Color, LineStyle, LineWidth) => line.new(BarIndex, low - ta.tr, BarIndex, high + ta.tr, xloc.bar_index, extend.both, Color, LineStyle, LineWidth) if (do_plot) vline(bar_index[0], #FF8000ff, line.style_dotted, 1)
WAP Maverick - (Dual EMA Smoothed VWAP) - [mutantdog]
https://www.tradingview.com/script/QD7zcHVJ-WAP-Maverick-Dual-EMA-Smoothed-VWAP-mutantdog/
mutantdog
https://www.tradingview.com/u/mutantdog/
404
study
5
MPL-2.0
// This wapSwitch code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © mutantdog //@version=5 indicator ('WAP Maverick v2.1', 'WAP Maverick', true) string S01 = 'open' string S02 = 'high' string S03 = 'low' string S04 = 'close' string S11 = 'hl2' string S12 = 'hlc3' string S13 = 'ohlc4' string S14 = 'hlcc4' string S51 = 'oc2' string S52 = 'hlc2-o2' string S53 = 'hl-oc2' string S54 = 'cc-ohlc4' string T01 = 'Input from chart, can be used to select other indicator. Select AUX in main or side wapSwitch to use. (note: "indicator on indicator" function may be restricted to Premium and Pro+ accounts).' string T02 = 'Session size in minutes when Anchor is set to Intraday only. Setting 0 value will use current timeframe.' string T03 = 'EMA length used for smoothing, is independant from anchor. WAP is calculated as ema(numerator,length) / ema(denominator,length).' string T04 = 'Shifts WAP (and bands) up / down by multiple of Standard Deviation.' string T05 = 'Only active bands will be used for alerts. Hi bands based on Arithmetic WAP, Lo bands based on Harmonic WAP.' string T06 = 'Up crosses against Arithmetic WAP, down crosses against Harmonic WAP.' string T07 = 'Applied to active bands only.' string T08 = 'Visual only, does not affect main alerts.' // ------ // INPUTS // ------ auxSource = input.source (close, 'Aux In', tooltip=T01) wapSource = input.string ('hlc3', 'Source', [S01, S02, S03, S04, S11, S12, S13, S14, S51, S52, S53, S54, '* AUX'], group='WAP') wapAnchor = input.string ('Week', '(w)Anchor', ['Day', 'Week', 'Month', 'Quarter', 'Year', 'Intraday'], group='WAP') wapMinutes = input.int (240, '(w)Intraday', minval=0, maxval=1440, step=60, tooltip=T02, group='WAP') emaLength = input.int (21, '(m)Length', minval=1, tooltip=T03, group='WAP') devShift = input.float (0, 'Deviate', step=0.05, tooltip=T04, group='WAP') useMa = input.bool (true, 'EMA Smoothing', group='WAP') bandMult_a = input.float (1, 'Bands A: Mult', minval=0, step=0.1, inline='11', group='Bands') activeHi_a = input.bool (false, 'Hi', inline='11', group='Bands') activeLo_a = input.bool (false, 'Lo', tooltip=T05, inline='11', group='Bands') bandMult_b = input.float (2, 'Bands B: Mult', minval=0, step=0.1, inline='12', group='Bands') activeHi_b = input.bool (false, 'Hi', inline='12', group='Bands') activeLo_b = input.bool (false, 'Lo', inline='12', group='Bands') bandMult_c = input.float (3, 'Bands C: Mult', minval=0, step=0.1, inline='13', group='Bands') activeHi_c = input.bool (false, 'Hi', inline='13', group='Bands') activeLo_c = input.bool (false, 'Lo', inline='13', group='Bands') sideSource = input.string ('close', 'Source', [S01, S02, S03, S04, S11, S12, S13, S14, S51, S52, S53, S54, '* AUX'], group='Side') sideFilter = input.string ('none', 'Filter', ['none', 'SMA', 'EMA', 'WMA', 'RMA', 'VWMA', 'HMA', 'VWEMA'], group='Side') sideLength = input.int (8, 'Length', minval=1, group='Side') showUp_0 = input.bool (false, 'Up', inline='33', group='Crosses') showDn_0 = input.bool (false, 'Down - WAP', tooltip=T06, inline='33', group='Crosses') showUp_a = input.bool (false, 'Up', inline='34', group='Crosses') showDn_a = input.bool (false, 'Down - Bands: A', tooltip=T07, inline='34', group='Crosses') showUp_b = input.bool (false, 'Up', inline='35', group='Crosses') showDn_b = input.bool (false, 'Down - Bands: B', tooltip=T07, inline='35', group='Crosses') showUp_c = input.bool (false, 'Up', inline='36', group='Crosses') showDn_c = input.bool (false, 'Down - Bands: C', tooltip=T07, inline='36', group='Crosses') showAlerts = input.bool (true, 'Show Alerts', tooltip=T08, inline='37', group='Crosses') bullHue = input.color (#87CEEB, '', inline='42', group='Visual') bearHue = input.color (#B8860B, '', inline='42', group='Visual') bandHue = input.color (#006666, '', inline='42', group='Visual') neutralHue = input.color (#808080, '', inline='42', group='Visual') sideHue = input.color (#BDB76B, '', inline='42', group='Visual') alertHue = input.color (#D8BFD8, '', inline='42', group='Visual') wapOpacP = input.int (75, 'Opacity: WAP', minval=0, maxval=100, step=5, inline='47', group='Visual') bandOpacP = input.int (50, 'Bands', minval=0, maxval=100, step=5, inline='47', group='Visual') wapOpacF = input.int (50, 'Fill: WAP    ', minval=0, maxval=100, step=5, inline='48', group='Visual') bandOpacF = input.int (15, 'Bands', minval=0, maxval=100, step=5, inline='48', group='Visual') sideOpac = input.int (30, 'Opacity: Side', minval=0, maxval=100, step=5, inline='49', group='Visual') alertOpac = input.int (60, 'Alerts', minval=0, maxval=100, step=5, inline='49', group='Visual') // --------- // FUNCTIONS // --------- source_switch (src, aux) => wapSwitch = switch src 'open' => open 'high' => high 'low' => low 'close' => close 'hl2' => hl2 'hlc3' => hlc3 'ohlc4' => ohlc4 'hlcc4' => hlcc4 'oc2' => (open + close) / 2 'hlc2-o2' => (high + low + close - open) / 2 'hl-oc2' => high + low - (open + close) / 2 'cc-ohlc4' => 2 * close - ohlc4 '* AUX' => aux // wap_wanchor (src, prd, mins) => int sessionsize = na sessionsize := mins != 0 ? mins : timeframe.multiplier makesession = timeframe.isminutes ? str.tostring (sessionsize) : timeframe.period timechange = switch prd 'Day' => ta.change (time ('D')) 'Week' => ta.change (time ('W')) 'Month' => ta.change (time ('M')) 'Quarter' => ta.change (time ('3M')) 'Year' => ta.change (time ('12M')) 'Intraday' => ta.change (time (makesession)) na (src[1]) ? true : timechange // wap_maverick (src, len, anch) => var float sumSrcVol = na var float sumVol = na var float sumSrcSrcVol = na var float sumVolSrc = na fixVolume = volume > 1 ? volume : 1 sumSrcVol := anch ? fixVolume * src : fixVolume * src + sumSrcVol[1] sumVol := anch ? fixVolume : fixVolume + sumVol[1] sumSrcSrcVol := anch ? fixVolume * math.pow(src, 2) : fixVolume * math.pow(src, 2) + sumSrcSrcVol[1] sumVolSrc := anch ? fixVolume / src : fixVolume / src + sumVolSrc[1] var float mavAri = na var float mavHar = na var float mavVari = na mavAri := ta.ema (sumSrcVol, len) / ta.ema (sumVol, len) mavHar := ta.ema (sumVol, len) / ta.ema (sumVolSrc, len) mavVari := ta.ema (sumSrcSrcVol, len) / ta.ema (sumVol, len) - math.pow (mavAri, 2) mavDev = math.sqrt (mavVari) [mavAri, mavHar, mavDev] // filter_switch (src, len, mode) => filter = switch mode 'none' => src 'SMA' => ta.sma (src, len) 'EMA' => ta.ema (src, len) 'WMA' => ta.wma (src, len) 'RMA' => ta.rma (src, len) 'VWMA' => ta.vwma (src, len) 'VWEMA' => ta.ema (src * volume, len) / ta.ema (volume, len) 'HMA' => len >= 2 ? ta.hma (src, len) : src // // ------- // PROCESS // ------- wapSwitch = source_switch (wapSource, auxSource) wapWanchor = wap_wanchor (wapSwitch, wapAnchor, wapMinutes) mavLength = useMa ? emaLength : 1 [wAri, wHar, wmDev] = wap_maverick (wapSwitch, mavLength, wapWanchor) wmAri = wAri + devShift * wmDev wmHar = wHar + devShift * wmDev wmMid = (wmAri + wmHar) / 2 aloBand = activeLo_a ? wmHar - wmDev * bandMult_a : na ahiBand = activeHi_a ? wmAri + wmDev * bandMult_a : na bloBand = activeLo_b ? wmHar - wmDev * bandMult_b : na bhiBand = activeHi_b ? wmAri + wmDev * bandMult_b : na cloBand = activeLo_c ? wmHar - wmDev * bandMult_c : na chiBand = activeHi_c ? wmAri + wmDev * bandMult_c : na sideSwitch = source_switch (sideSource, auxSource) sideMain = filter_switch (sideSwitch, sideLength, sideFilter) // ---------------- // VISUALS & ALERTS // ---------------- wm_gradient (wap, sid, dev, bear, bull, mult) => delt = (sid - wap) / dev rma2 = ta.rma (delt, 2) rma3 = ta.rma (delt, 3) bear2 = color.from_gradient (rma2, -1.5, 0, color.new (bear, 100 - mult/2), color.new (bear, 100 - mult/10) ) bull2 = color.from_gradient (rma2, 0, 1.5, color.new (bull, 100 - mult/10), color.new (bull, 100 - mult/2) ) bear3 = color.from_gradient (rma3, -2.5, 0, color.new (bear, 100 - mult), color.new (bear, 100 - mult/10) ) bull3 = color.from_gradient (rma3, 0, 2.5, color.new (bull, 100 - mult/10), color.new (bull, 100 - mult) ) fill2 = rma2 > 0 ? bull2 : rma2 < 0 ? bear2 : na fill3 = rma3 > 0 ? bull3 : rma3 < 0 ? bear3 : na [fill2, fill3] // // COLOURS bullColour = color.new (bullHue, 100 - wapOpacP) bearColour = color.new (bearHue, 100 - wapOpacP) neutralColour = color.new (neutralHue, 100 - wapOpacP) bandColour = color.new (bandHue, 100 - bandOpacP) sideColour = color.new (sideHue, 100 - sideOpac) alertColour = color.new (alertHue, 100 - alertOpac) bandFill = color.new (bandHue, 100 - bandOpacF/2) ariColour = (sideMain > wmAri) and (sideMain[1] > wmAri[1]) ? bullColour : (sideMain < wmAri) and (sideMain[1] < wmAri[1]) ? bearColour : neutralColour harColour = (sideMain > wmHar) and (sideMain[1] > wmHar[1]) ? bullColour : (sideMain < wmHar) and (sideMain[1] < wmHar[1]) ? bearColour : neutralColour midColour = (sideMain > wmMid) and (sideMain[1] > wmMid[1]) ? bullColour : (sideMain < wmMid) and (sideMain[1] < wmMid[1]) ? bearColour : neutralColour [wapFillA, wapFillB] = wm_gradient (wmMid, sideMain, wmDev, bearHue, bullHue, wapOpacF) // PLOTS ariPlot = plot (wmAri, 'WAP: Arithmetic', ariColour, 2) harPlot = plot (wmHar, 'WAP: Harmonic', harColour, 2) midPlot = plot (wmMid, 'WAP: Mid (hidden)', midColour, 1, display=display.none) ahiPlot = plot (ahiBand, 'Band A: Hi', bandColour, 2) aloPlot = plot (aloBand, 'Band A: Lo', bandColour, 2) bhiPlot = plot (bhiBand, 'Band B: Hi', bandColour, 2) bloPlot = plot (bloBand, 'Band B: Lo', bandColour, 2) chiPlot = plot (chiBand, 'Band C: Hi', bandColour, 2) cloPlot = plot (cloBand, 'Band C: Lo', bandColour, 2) sidePlot = plot (sideMain, 'Side', sideColour, 2) fill (ariPlot, harPlot, wapFillA, 'Fill WAP A') fill (ariPlot, harPlot, wapFillB, 'Fill WAP B') fill (ariPlot, ahiPlot, bandFill, 'Fill Band A: Hi') fill (harPlot, aloPlot, bandFill, 'Fill Band A: Lo') fill (ariPlot, bhiPlot, bandFill, 'Fill Band B: Hi') fill (harPlot, bloPlot, bandFill, 'Fill Band B: Lo') fill (ariPlot, chiPlot, bandFill, 'Fill Band C: Hi') fill (harPlot, cloPlot, bandFill, 'Fill Band C: Lo') // ALERTS wapUp = showUp_0 ? ta.crossover (sideMain, wmAri) : na wapDn = showDn_0 ? ta.crossunder (sideMain, wmHar) : na aloUp = showUp_a ? ta.crossover (sideMain, aloBand) : na ahiUp = showUp_a ? ta.crossover (sideMain, ahiBand) : na bloUp = showUp_b ? ta.crossover (sideMain, bloBand) : na bhiUp = showUp_b ? ta.crossover (sideMain, bhiBand) : na cloUp = showUp_c ? ta.crossover (sideMain, cloBand) : na chiUp = showUp_c ? ta.crossover (sideMain, chiBand) : na aloDn = showDn_a ? ta.crossunder (sideMain, aloBand) : na ahiDn = showDn_a ? ta.crossunder (sideMain, ahiBand) : na bloDn = showDn_b ? ta.crossunder (sideMain, bloBand) : na bhiDn = showDn_b ? ta.crossunder (sideMain, bhiBand) : na cloDn = showDn_c ? ta.crossunder (sideMain, cloBand) : na chiDn = showDn_c ? ta.crossunder (sideMain, chiBand) : na atrPlot = ta.atr (4) plotshape (showAlerts and wapUp ? wmHar - atrPlot : na, 'Buy: WAP', shape.triangleup, location.absolute, alertColour, size=size.tiny, display=display.pane) plotshape (showAlerts and wapDn ? wmAri + atrPlot : na, 'Sell: WAP', shape.triangledown, location.absolute, alertColour, size=size.tiny, display=display.pane) plotshape (showAlerts and aloUp ? aloBand - atrPlot : na, 'Buy: Loband A', shape.triangleup, location.absolute, alertColour, size=size.tiny, display=display.pane) plotshape (showAlerts and ahiUp ? ahiBand - atrPlot : na, 'Buy: Hiband A', shape.triangleup, location.absolute, alertColour, size=size.tiny, display=display.pane) plotshape (showAlerts and bloUp ? bloBand - atrPlot : na, 'Buy: Loband B', shape.triangleup, location.absolute, alertColour, size=size.tiny, display=display.pane) plotshape (showAlerts and bhiUp ? bhiBand - atrPlot : na, 'Buy: Hiband B', shape.triangleup, location.absolute, alertColour, size=size.tiny, display=display.pane) plotshape (showAlerts and cloUp ? cloBand - atrPlot : na, 'Buy: Loband C', shape.triangleup, location.absolute, alertColour, size=size.tiny, display=display.pane) plotshape (showAlerts and chiUp ? chiBand - atrPlot : na, 'Buy: Hiband C', shape.triangleup, location.absolute, alertColour, size=size.tiny, display=display.pane) plotshape (showAlerts and aloDn ? aloBand + atrPlot : na, 'Sell: Loband A', shape.triangledown, location.absolute, alertColour, size=size.tiny, display=display.pane) plotshape (showAlerts and ahiDn ? ahiBand + atrPlot : na, 'Sell: Hiband A', shape.triangledown, location.absolute, alertColour, size=size.tiny, display=display.pane) plotshape (showAlerts and bloDn ? bloBand + atrPlot : na, 'Sell: Loband B', shape.triangledown, location.absolute, alertColour, size=size.tiny, display=display.pane) plotshape (showAlerts and bhiDn ? bhiBand + atrPlot : na, 'Sell: Hiband B', shape.triangledown, location.absolute, alertColour, size=size.tiny, display=display.pane) plotshape (showAlerts and cloDn ? cloBand + atrPlot : na, 'Sell: Loband C', shape.triangledown, location.absolute, alertColour, size=size.tiny, display=display.pane) plotshape (showAlerts and chiDn ? chiBand + atrPlot : na, 'Sell: Hiband C', shape.triangledown, location.absolute, alertColour, size=size.tiny, display=display.pane) alertcondition (ta.crossover (sideMain, wmAri), '00: Side Above WAP', 'UP SIGNAL: Side Tracker Above WAP') alertcondition (ta.crossunder (sideMain, wmHar), '00: Side Below WAP', 'DOWN SIGNAL: Side Tracker Below WAP') alertcondition (aloUp or ahiUp or bloUp or bhiUp or cloUp or chiUp, '01: Side Above [Selected Bands]', 'UP SIGNAL: Side Tracker Crossed Above Selected Band') alertcondition (aloDn or ahiDn or bloDn or bhiDn or cloDn or chiDn, '01: Side Below [Selected Bands]', 'DOWN SIGNAL: Side Tracker Crossed Below Selected Band') alertcondition (aloUp or ahiUp or bloUp or bhiUp or cloUp or chiUp or wapUp, '02: Side Above [All Selected]', 'UP SIGNAL: Side Tracker Crossed Above Selected Band / WAP') alertcondition (aloDn or ahiDn or bloDn or bhiDn or cloDn or chiDn or wapDn, '02: Side Below [All Selected]', 'DOWN SIGNAL: Side Tracker Crossed Below Selected Band / WAP')
Intraday Price change in Top 5 stocks
https://www.tradingview.com/script/LLwcG8sD-Intraday-Price-change-in-Top-5-stocks/
IDKMan66
https://www.tradingview.com/u/IDKMan66/
18
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ //@version=5 indicator('% change Top 5') AAPL_close = request.security('AAPL', 'D', close) AAPL_close_recent = request.security('AAPL', '1', close) AMZN_close = request.security('AMZN', 'D', close) AMZN_close_recent = request.security('AMZN', '1', close) GOOGL_close = request.security('GOOGL', 'D', close) GOOGL_close_recent = request.security('GOOGL', '1', close) MSFT_close = request.security('MSFT', 'D', close) MSFT_close_recent = request.security('MSFT', '1', close) TSLA_close = request.security('TSLA', 'D', close) TSLA_close_recent = request.security('TSLA', '1', close) price_changeAAPL = (AAPL_close_recent - AAPL_close) / AAPL_close price_changeAMZN = (AMZN_close_recent - AMZN_close) / AMZN_close price_changeGOOGL = (GOOGL_close_recent - GOOGL_close) / GOOGL_close price_changeMSFT = (MSFT_close_recent - MSFT_close) / MSFT_close price_changeTSLA = (TSLA_close_recent - TSLA_close) / TSLA_close price_change_bluechips = (price_changeAAPL + price_changeAMZN + price_changeGOOGL + price_changeMSFT + price_changeTSLA) / 5 * 100 plot(0) plot(series=price_change_bluechips, style=plot.style_histogram, linewidth=3, color=close >= open ? color.green : color.red)
Risk Reward Position Size Calculator
https://www.tradingview.com/script/3U7H8gbf-Risk-Reward-Position-Size-Calculator/
TraderCreatorPro
https://www.tradingview.com/u/TraderCreatorPro/
375
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © TraderCreatorPro //@version=5 indicator("Position Size Calculator", "Calculator", true) //User Inputs AccountSize = input.float(10000, "Account Size to base Risk off of") AccountRisk = input.float(10, "Percentage Risk Of your Account Size") avg = input.price(00,title = "Average Entry") stop = input.float(00,title = "Stop Price") target =input.float(00,title = "Target Price") StockorOption = input.bool(false, title = "Check = Option, Uncheck = Stock") ShowAccountSize = input.bool (false, "Your Account Size") ShowRisk = input.bool (true, "Percentage and Dollar Risk") ShowRisk2 = input.bool (false, "Shows Dollar Risk Per share)") ShowPositionSize = input.bool(true, "Calculated Position Size Based off your stop") ShowRiskReward = input.bool(true, "Shows Risk Vs Reward") Showavg = input.bool(true, "Show Avg Entry") ShowStop = input.bool(true, "Show Stop Price") ShowTarget = input.bool(true, "Show Target Price") ShowTargetGain = input.bool(true, "Show Target Gain") PlotStop = input.bool(true, "Draw Stop on Chart", group = "Plot Lines") PlotTarget = input.bool(true, "Draw Target On Chart", group = "Plot Lines") PlotAvg = input.bool(false, "Draw Avg Price On Chart", group = "Plot Lines") textcolor = input.color(color.white, "Color of Table Text") backgroundcolor= input.color (color.gray, "Color of Table Background") BoxPlacement = input.string(position.top_right, "Box Placement", options = [position.bottom_right, position.bottom_left, position.top_right, position.top_center, position.bottom_center]) //Risk Pershare DollarRisk1 = StockorOption? (math.abs(avg - stop))*100 : math.abs(avg - stop) //Percentage risk to Dollar risk PerctoDol = (AccountRisk/100) * AccountSize //Calculated Position Size CalcPosition = math.round(PerctoDol/DollarRisk1,2) //Target Gain Per share TargetGain = StockorOption? (math.abs(avg - target))*100 : math.abs(avg - target) //Target Gain Percentage Targetper= math.round((TargetGain + avg) / avg,2) //TargetGain Dollar amount TargetDollar = math.round(TargetGain * CalcPosition,2) //Risk Reward Calculation RiskReward = math.round(TargetGain/DollarRisk1,2) //position size math stuff var table myTable = table.new(BoxPlacement, 1, 9, border_width=1) if barstate.islast //Table Cells table.cell(myTable, 0,4,ShowRisk? "Risk: %" + str.tostring(AccountRisk) + " or $" + str.tostring(PerctoDol):na,text_color = ShowRisk? textcolor : na, bgcolor = ShowRisk? backgroundcolor : na) table.cell(myTable, 0,5,ShowRisk2? "Risk per shr $" + str.tostring(DollarRisk1):na,text_color = ShowRisk2? textcolor : na, bgcolor = ShowRisk2? backgroundcolor : na) table.cell(myTable, 0,0,ShowAccountSize? "Act Sz: $" + str.tostring(AccountSize):na,text_color = ShowAccountSize? textcolor : na, bgcolor = ShowAccountSize? backgroundcolor : na) table.cell(myTable, 0,3, ShowStop? "Stop: " + str.tostring(stop):na, text_color = ShowStop? textcolor : na, bgcolor = ShowStop? backgroundcolor : na) table.cell(myTable, 0,2, ShowTarget? "Target: " + str.tostring(target):na, text_color = ShowTarget? textcolor : na, bgcolor = ShowTarget? backgroundcolor : na) table.cell(myTable, 0,7, ShowRiskReward? "RR: " + str.tostring(RiskReward):na, text_color = ShowRiskReward? textcolor : na, bgcolor = ShowRiskReward? backgroundcolor : na) table.cell(myTable, 0,8, ShowPositionSize? "Max Position: " + str.tostring(CalcPosition):na,text_color = ShowPositionSize? textcolor : na, bgcolor = ShowPositionSize? backgroundcolor : na) table.cell(myTable, 0,1, Showavg? "Entry: " + str.tostring(avg):na, text_color = Showavg? textcolor : na, bgcolor = Showavg? backgroundcolor : na) table.cell(myTable, 0,6,ShowTargetGain? "Gain: %" + str.tostring(Targetper) + " or $" + str.tostring(TargetDollar):na,text_color = ShowTargetGain? textcolor : na, bgcolor = ShowTargetGain? backgroundcolor : na) //Plot Lines? plot(PlotStop? stop: na, "Stop", color.red) plot (PlotTarget? target :na, "Target", color.green) plot(PlotAvg? avg :na, "Entry", color.yellow)
Volume Weighted Real Relative Strength (RS/RW)
https://www.tradingview.com/script/h7ZNI2Qi-Volume-Weighted-Real-Relative-Strength-RS-RW/
dealsatm
https://www.tradingview.com/u/dealsatm/
686
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © dealsatm // @version=5 indicator(title="Volume Weighted Real Relative Strength", shorttitle="VRRS") // Input section RefTicker = input.symbol(title="Market Reference", defval="SPY") Sector_Auto_Selection = input.bool(title="Auto Sector Selection", defval=true) SecTicker = input.symbol(title="Sector Reference", defval="SPY") Volume_Weighted = input.bool(title="Volume Weighted", defval=true) gap = input( title="Plot Gap", defval=0) RollingLength = input( title="Rolling Length", defval=21) RollingLength_short = input( title="Rolling Length for Vol (Short term)", defval=21) RollingLength_long = input( title="Rolling Length for Vol (Long term, Days)", defval=5) upper = input(title="Upper", defval=1) lower = input(title="Lower", defval=-1) // Input for rate of change VRRS length = input( title = "Length for linear regression", defval = 6 ) bullish_rate = input.float( title = "Bullish change rate (%/bar)", defval = 0.25 ) bullish_color = input.color( title = "Bullish color", defval = color.green ) bearish_rate = input.float( title = "Bearish change rate (%/bar)", defval = -0.25 ) bearish_color = input.color( title = "Bearish color", defval = color.red ) // Sector database, load all at once XLC = array.from("ATVI","CHTR","CMCSA","DIS","DISCA","DISCK","DISH","EA","FB","FOX","FOXA","GOOG","GOOGL","IPG","LUMN","LYV","MTCH","NFLX","NWS","NWSA","OMC","T","TMUS","TTWO","TWTR","VIAC","VZ") XLY = array.from("AAP","AMZN","APTV","AZO","BBWI","BBY","BKNG","BWA","CCL","CMG","CZR","DG","DHI","DLTR","DPZ","DRI","EBAY","ETSY","EXPE","F","GM","GPC","GPS","GRMN","HAS","HD","HLT","KMX","LEN","LKQ","LOW","LVS","MAR","MCD","MGM","MHK","NCLH","NKE","NVR","NWL","ORLY","PENN","PHM","POOL","PVH","RCL","RL","ROST","SBUX","TGT","TJX","TPR","TSCO","TSLA","UA","UAA","ULTA","VFC","WHR","WYNN","YUM") XLP = array.from("ADM","BF.B","CAG","CHD","CL","CLX","COST","CPB","EL","GIS","HRL","HSY","K","KHC","KMB","KO","KR","LW","MDLZ","MKC","MNST","MO","PEP","PG","PM","SJM","STZ","SYY","TAP","TSN","WBA","WMT") XLE = array.from("APA","BKR","COP","CTRA","CVX","DVN","EOG","FANG","HAL","HES","KMI","MPC","MRO","OKE","OXY","PSX","PXD","SLB","VLO","WMB","XOM") XLF = array.from("AFL","AIG","AIZ","AJG","ALL","AMP","AON","AXP","BAC","BEN","BK","BLK","BRK.B","BRO","C","CB","CBOE","CFG","CINF","CMA","CME","COF","DFS","FDS","FITB","FRC","GL","GS","HBAN","HIG","ICE","IVZ","JPM","KEY","L","LNC","MCO","MET","MKTX","MMC","MS","MSCI","MTB","NDAQ","NTRS","PBCT","PFG","PGR","PNC","PRU","RE","RF","RJF","SBNY","SCHW","SIVB","SPGI","STT","SYF","TFC","TROW","TRV","USB","WFC","WRB","WTW","ZION") XLV = array.from("A","ABBV","ABC","ABMD","ABT","ALGN","AMGN","ANTM","BAX","BDX","BIIB","BIO","BMY","BSX","CAH","CERN","CI","CNC","COO","CRL","CTLT","CVS","DGX","DHR","DVA","DXCM","EW","GILD","HCA","HOLX","HSIC","HUM","IDXX","ILMN","INCY","IQV","ISRG","JNJ","LH","LLY","MCK","MDT","MRK","MRNA","MTD","OGN","PFE","PKI","REGN","RMD","STE","SYK","TECH","TFX","TMO","UHS","UNH","VRTX","VTRS","WAT","WST","XRAY","ZBH","ZTS") XLI = array.from("AAL","ALK","ALLE","AME","AOS","BA","CARR","CAT","CHRW","CMI","CPRT","CSX","CTAS","DAL","DE","DOV","EFX","EMR","ETN","EXPD","FAST","FBHS","FDX","FTV","GD","GE","GNRC","GWW","HII","HON","HWM","IEX","INFO","IR","ITW","J","JBHT","JCI","LDOS","LHX","LMT","LUV","MAS","MMM","NLSN","NOC","NSC","ODFL","OTIS","PCAR","PH","PNR","PWR","RHI","ROK","ROL","ROP","RSG","RTX","SNA","SWK","TDG","TT","TXT","UAL","UNP","UPS","URI","VRSK","WAB","WM","XYL") XLB = array.from("ALB","AMCR","APD","AVY","BLL","CE","CF","CTVA","DD","DOW","ECL","EMN","FCX","FMC","IFF","IP","LIN","LYB","MLM","MOS","NEM","NUE","PKG","PPG","SEE","SHW","VMC","WRK") XLRE = array.from("AMT","ARE","AVB","BXP","CBRE","CCI","DLR","DRE","EQIX","EQR","ESS","EXR","FRT","HST","IRM","KIM","MAA","O","PEAK","PLD","PSA","REG","SBAC","SPG","UDR","VNO","VTR","WELL","WY") XLK = array.from("AAPL","ACN","ADBE","ADI","ADP","ADSK","AKAM","AMAT","AMD","ANET","ANSS","APH","AVGO","BR","CDAY","CDNS","CDW","CRM","CSCO","CTSH","CTXS","DXC","ENPH","EPAM","FFIV","FIS","FISV","FLT","FTNT","GLW","GPN","HPE","HPQ","IBM","INTC","INTU","IPGP","IT","JKHY","JNPR","KEYS","KLAC","LRCX","MA","MCHP","MPWR","MSFT","MSI","MU","NLOK","NOW","NTAP","NVDA","NXPI","ORCL","PAYC","PAYX","PTC","PYPL","QCOM","QRVO","SEDG","SNPS","STX","SWKS","TDY","TEL","TER","TRMB","TXN","TYL","V","VRSN","WDC","XLNX","ZBRA") XLU = array.from("AEE","AEP","AES","ATO","AWK","CMS","CNP","D","DTE","DUK","ED","EIX","ES","ETR","EVRG","EXC","FE","LNT","NEE","NI","NRG","PEG","PNW","PPL","SO","SRE","WEC","XEL") get_sector_close( _Ticker ) => request.security(symbol=_Ticker, timeframe="", expression=close) cal_VRRS(_TickerClose, _RefClose,_VolWeight, _RollingLength) => _TickerSMA = ta.sma( _TickerClose, _RollingLength) _TickerChange = _TickerClose - _TickerSMA[1] _RefSMA = ta.sma( _RefClose, _RollingLength) _RefChange = _RefClose - _RefSMA[1] (_TickerChange/_TickerSMA[1] - _RefChange/_RefSMA[1]) * _VolWeight * 100 factor = 78 if str.contains(timeframe.period,'D') factor := 1 if str.contains(timeframe.period,'S') factor := 1 if str.contains(timeframe.period,'W') factor := 1 if str.contains(timeframe.period,'M') factor := 1 RollingLength_long := RollingLength_long * factor //##########Rolling Price Change########## RefClose = request.security(symbol=RefTicker, timeframe="", expression=close) RefOpen = request.security(symbol=RefTicker, timeframe="", expression=open) RefHigh = request.security(symbol=RefTicker, timeframe="", expression=high) RefLow = request.security(symbol=RefTicker, timeframe="", expression=low) RefSMA = request.security(symbol=RefTicker, timeframe="", expression=ta.sma(close,RollingLength) ) RefSMAD = request.security(symbol=RefTicker, timeframe="D", expression=ta.sma(close,1) ) RefCloseD = request.security(symbol=RefTicker, timeframe="D", expression=close) Refdo = request.security(symbol=RefTicker, timeframe="D", expression=open ) //Volume sma AvgVol_long = ta.sma(volume,RollingLength_long) AvgVol_short = ta.sma(volume,RollingLength_short) //##########Calculations########## VolWeight = AvgVol_short[1]/AvgVol_long[1] if not Volume_Weighted VolWeight := 1 // VRSS vs Market (1st reference) VRRS = cal_VRRS(close, RefClose, VolWeight, RollingLength) // VRSS vs SecTicker (2st Reference). Calculate it even if we do not need SecClose = get_sector_close( SecTicker ) SecVRRS = cal_VRRS(close, SecClose, VolWeight, RollingLength) XSecVRRS = switch array.includes(XLC, syminfo.ticker) => cal_VRRS(close, get_sector_close( 'XLC' ), VolWeight, RollingLength) array.includes(XLY, syminfo.ticker) => cal_VRRS(close, get_sector_close( 'XLY' ), VolWeight, RollingLength) array.includes(XLP, syminfo.ticker) => cal_VRRS(close, get_sector_close( 'XLP' ), VolWeight, RollingLength) array.includes(XLE, syminfo.ticker) => cal_VRRS(close, get_sector_close( 'XLE' ), VolWeight, RollingLength) array.includes(XLF, syminfo.ticker) => cal_VRRS(close, get_sector_close( 'XLF' ), VolWeight, RollingLength) array.includes(XLV, syminfo.ticker) => cal_VRRS(close, get_sector_close( 'XLV' ), VolWeight, RollingLength) array.includes(XLI, syminfo.ticker) => cal_VRRS(close, get_sector_close( 'XLI' ), VolWeight, RollingLength) array.includes(XLB, syminfo.ticker) => cal_VRRS(close, get_sector_close( 'XLB' ), VolWeight, RollingLength) array.includes(XLRE, syminfo.ticker) => cal_VRRS(close, get_sector_close( 'XLRE' ), VolWeight, RollingLength) array.includes(XLK, syminfo.ticker) => cal_VRRS(close, get_sector_close( 'XLK' ), VolWeight, RollingLength) array.includes(XLU, syminfo.ticker) => cal_VRRS(close, get_sector_close( 'XLU' ), VolWeight, RollingLength) =>SecVRRS UseSecTicker = switch array.includes(XLC, syminfo.ticker) => 'XLC' array.includes(XLY, syminfo.ticker) => 'XLY' array.includes(XLP, syminfo.ticker) => 'XLP' array.includes(XLE, syminfo.ticker) => 'XLE' array.includes(XLF, syminfo.ticker) => 'XLF' array.includes(XLV, syminfo.ticker) => 'XLV' array.includes(XLI, syminfo.ticker) => 'XLI' array.includes(XLB, syminfo.ticker) => 'XLB' array.includes(XLRE, syminfo.ticker) => 'XLRE' array.includes(XLK, syminfo.ticker) => 'XLK' array.includes(XLU, syminfo.ticker) => 'XLU' => array.get( str.split(SecTicker,':' ),1 ) if not Sector_Auto_Selection UseSecTicker := array.get( str.split(SecTicker,':' ),1 ) //##########Plot########## // Plot VRRS vs ticker #1 RealRelativeStrength = plot(VRRS, title="VRRS vs Market", style=plot.style_columns, color=(VRRS>=0 ? (VRRS[1] < VRRS ? color.rgb(0,255,0,0) : color.rgb(150,255,150,0) ) : (VRRS[1] < VRRS ? color.rgb(255,150,150,0) : color.rgb(255,0,0,0)))) // Plot VRRS vs ticker #2 // This plot is taking time. Finding solution for it? // If you want to disable this feature to speed up, put // at the begining of the following line SecRealRelativeStrength = plot( not Sector_Auto_Selection ? SecVRRS + gap : XSecVRRS + gap, title="VRRS vs Sector", color=color.white) // and remove the // at the begining of the following 2 lines //SecRealRelativeStrength = plot( SecVRRS + gap, title="VRRS vs Sector", color=color.white) //UseSecTicker := array.get( str.split(SecTicker,':' ),1 ) Baseline = plot(gap, "Baseline", color=color.black) //fill(SecRealRelativeStrength, Baseline, color = SecVRRS >= 0 ? color.rgb(255,0,255,100) : color.rgb(250, 250, 0, 100), title="Fill color: Reference Ticker #2") // Plot Change of ticker #1 vs close price of previous day plotbar((RefOpen/RefCloseD-1)*100, (RefHigh/RefCloseD-1)*100, (RefLow/RefCloseD-1)*100, (RefClose/RefCloseD-1)*100, title="Reference Change", color = open < close ? color.rgb(255, 0, 255, 0) : color.rgb(255, 255, 0, 0))//, wickcolor=open < close ? color.white : color.lime) // Draw horizontal line upperline = plot(upper, "Upper limmit", color=color.gray) lowerline = plot(lower, "Lower limmit", color=color.gray) // Calculate rate of change X = bar_index Y = VRRS Y_ = ta.linreg( Y, length, 0 ) rate = Y_[0]-Y_[1] correlation = ta.correlation( Y, Y_, length ) // Show data var tbl = table.new( position.bottom_left, 6, 1, frame_color = color.yellow, frame_width=1, border_width=2, border_color=color.new(color.white, 100) ) rate_color = rate[0] >= bullish_rate ? bullish_color : ( rate[0] <= bearish_rate ? bearish_color : color.black ) table.cell( tbl, 0, 0, 'Change Rate', text_halign = text.align_center, bgcolor = color.gray, text_color = color.white, text_size = size.small) table.cell( tbl, 1, 0, str.tostring(rate[0],"#.##")+' %/bar', text_halign = text.align_center, bgcolor = rate_color, text_color = color.white, text_size = size.small) table.cell( tbl, 2, 0, 'Certainty', text_halign = text.align_center, bgcolor = color.gray, text_color = color.white, text_size = size.small) table.cell( tbl, 3, 0, str.tostring(correlation[0]*100,"#.##")+'%', text_halign = text.align_center, bgcolor = rate_color, text_color = color.white, text_size = size.small) table.cell( tbl, 4, 0, 'Sector Ref', text_halign = text.align_center, bgcolor = color.gray, text_color = color.white, text_size = size.small) table.cell( tbl, 5, 0, UseSecTicker, text_halign = text.align_center, bgcolor = color.black, text_color = color.white, text_size = size.small)
Simplified candlesticks
https://www.tradingview.com/script/heCdKsCv-Simplified-candlesticks/
RomanLosev
https://www.tradingview.com/u/RomanLosev/
70
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © romanlosevdelfi //@version=5 indicator("Simplified candlesticks", overlay=true) slow_ema = ta.ema(close, 21) fast_ema = ta.ema(close, 8) veryslow_ema = ta.ema(close, 100) //plot(slow_ema, color=color.red) //plot(fast_ema, color=color.blue) //plot(veryslow_ema, color=color.yellow) current_bar_size_ww = high - low current_bar_size = math.max(close, open) - math.min(close, open) look_back = 60 bar_sizes = 0.0 bar_sizes_avg = 0.0 current_bar_size_m = 0.0 current_bar_size_a = 0.0 for offset = 1 to look_back current_bar_size_a := math.max(close[offset], open[offset]) - math.min(close[offset], open[offset]) bar_sizes := bar_sizes + current_bar_size_a if(current_bar_size_a > current_bar_size_m) current_bar_size_m := current_bar_size_a bar_sizes_avg := bar_sizes / look_back bar_sizes_ww_avg = 0.0 current_bar_size_ww_m = 0.0 current_bar_size_ww_a = 0.0 for offset = 1 to look_back current_bar_size_ww_a :=high[offset] - low[offset] bar_sizes := bar_sizes + current_bar_size_ww_a if(current_bar_size_ww_a > current_bar_size_ww_m) current_bar_size_ww_m := current_bar_size_ww_a bar_sizes_ww_avg := bar_sizes / look_back //plot(veryslow_ema) //plot(slow_ema, color=color.green) //current_bar_size > bar_sizes_avg * 2.5 and //plot(current_bar_size) //plot(current_bar_size_m, color=color.red) current_bar_highest = current_bar_size > current_bar_size_m * 1.5 ? true : false small_wicks = current_bar_size / current_bar_size_ww > 0.7 ? true : false verybig_wicks = current_bar_size / current_bar_size_ww < 0.1 ? true : false //bullish long stickbar plotshape(current_bar_highest and small_wicks and close > open and slow_ema > veryslow_ema, color = color.green, style = shape.arrowup, text = "Continuation LS") plotshape(current_bar_highest and small_wicks and close > open and slow_ema < veryslow_ema and fast_ema > slow_ema, color = color.green, style = shape.arrowup, text = "Reversal LS") plotshape(current_bar_highest and small_wicks and close < open and slow_ema < veryslow_ema, color = color.red, style = shape.arrowdown, text = "Continuation LS", location = location.belowbar) plotshape(current_bar_highest and small_wicks and close < open and slow_ema > veryslow_ema and fast_ema < slow_ema, color = color.red, style = shape.arrowdown, text = "Reversal LS", location = location.belowbar) upper_wick_size = high - math.max(open, close) bottom_wick_size = math.min(open, close) - low big_wicks_upper = upper_wick_size / current_bar_size_ww > 0.2 and upper_wick_size / current_bar_size_ww < 0.4 ? true : false big_wicks_bottom = bottom_wick_size / current_bar_size_ww > 0.2 and bottom_wick_size / current_bar_size_ww < 0.4 ? true : false no_wicks_upper = upper_wick_size / current_bar_size_ww < 0.1 ? true : false no_wicks_bottom = bottom_wick_size / current_bar_size_ww < 0.1 ? true : false plotshape(big_wicks_upper and big_wicks_bottom and current_bar_size_ww > bar_sizes_ww_avg * 1.7, color = color.yellow, style = shape.arrowup, text = "Possible consolidation", location = location.belowbar ) biger_wicks_upper = upper_wick_size / current_bar_size_ww > 0.4 and upper_wick_size / current_bar_size_ww < 0.6 ? true : false plotshape(biger_wicks_upper and no_wicks_bottom and current_bar_size_ww > bar_sizes_ww_avg * 1.5 and close > open and close[1] < open, color = color.yellow, style = shape.arrowup, text = "Bulls weakness", location = location.abovebar ) plotshape(biger_wicks_upper and no_wicks_bottom and current_bar_size_ww > bar_sizes_ww_avg * 1.5 and close > open and close[1] > open and fast_ema < slow_ema and slow_ema > veryslow_ema, color = color.red, style = shape.arrowup, text = "Bulls weakness / Reversal", location = location.belowbar ) biger_wicks_bottom = bottom_wick_size / current_bar_size_ww > 0.4 and bottom_wick_size / current_bar_size_ww < 0.6 ? true : false plotshape(biger_wicks_bottom and no_wicks_upper and current_bar_size_ww > bar_sizes_ww_avg * 1.5 and close < open and close[1] > open, color = color.yellow, style = shape.arrowup, text = "Bears weakness", location = location.abovebar ) plotshape(biger_wicks_bottom and no_wicks_upper and current_bar_size_ww > bar_sizes_ww_avg * 1.5 and close < open and close[1] < open and fast_ema > slow_ema and slow_ema < veryslow_ema, color = color.green, style = shape.arrowup, text = "Bears weakness / Reversal", location = location.belowbar ) plotshape(upper_wick_size / current_bar_size_ww > 0.4 and bottom_wick_size / current_bar_size_ww > 0.4 and current_bar_size_ww > bar_sizes_ww_avg * 1.5 and slow_ema > veryslow_ema , color = color.purple, style = shape.arrowup, text = "Doji", location = location.abovebar ) plotshape(upper_wick_size / current_bar_size_ww > 0.4 and bottom_wick_size / current_bar_size_ww > 0.4 and current_bar_size_ww > bar_sizes_ww_avg * 1.5 and slow_ema < veryslow_ema , color = color.purple, style = shape.arrowup, text = "Doji", location = location.belowbar )
Daily Sun Flares Class X
https://www.tradingview.com/script/1txbBWSh-Daily-Sun-Flares-Class-X/
firerider
https://www.tradingview.com/u/firerider/
18
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © firerider //@version=5 indicator('Daily Sun Flares Class X') // from SunPy python package / GOES varip int[] f_class = array.from(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) calculateCandleTimeDiff() => // 2015-01-01 00:00 signal day time serie start. referenceUnixTime = 1420066800 candleUnixTime = time / 1000 + 1 timeDiff = candleUnixTime - referenceUnixTime timeDiff < 0 ? na : timeDiff getSignalCandleIndex() => timeDiff = calculateCandleTimeDiff() // Day index, days count elapsed from reference date. candleIndex = math.floor(timeDiff / 86400) candleIndex < 0 ? na : candleIndex getSignal() => // Map array data items indexes to candles. int candleIndex = getSignalCandleIndex() int itemsCount = array.size(f_class) // Return na for candles where indicator data is not available. int index = candleIndex >= itemsCount ? na : candleIndex signal = if index >= 0 and itemsCount > 1 array.get(f_class, index) else na signal // Compose signal time serie from array data. int SignalSerie = getSignal() // Calculate plot offset estimating market week open days plot(series=SignalSerie, style=plot.style_histogram, linewidth=4, color=color.new(color.red, 0))
Volume Footprint [LuxAlgo]
https://www.tradingview.com/script/cdU6E9rm-Volume-Footprint-LuxAlgo/
LuxAlgo
https://www.tradingview.com/u/LuxAlgo/
3,091
study
5
CC-BY-NC-SA-4.0
// This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/ // © LuxAlgo //@version=5 indicator("Volume Footprint [LuxAlgo]",overlay=true,max_boxes_count=500,max_lines_count=500) method = input.string('Atr','Interval Size Method',options=['Atr','Manual'],inline='a',confirm=true) length = input.float(14,'',inline='a',confirm=true) percent = input.bool(false,'As Percentage',confirm=true) look = input.string('Candle','Display Type', options=['Candle','Regular','Gradient'],group='Style',confirm=true) bull = input.color(#089981,'Trend Color',inline='b',confirm=true) bear = input.color(#f23645,'',inline='b',confirm=true) col_a = input.color(#bbd9fb,'Gradient Box Color',inline='c',confirm=true) col_b = input.color(#0c3299,'',inline='c',confirm=true) reg_col = input.color(#bbd9fb,'Regular Box Color',confirm=true) //---- varip prices = '' varip deltas = '' varip delta = 0. varip prev = 0. //---- r = high-low atr = ta.atr(math.round(length)) size = method == 'Atr' ? atr : length k = math.round(r/size) + 1 split_prices = str.split(prices,',') split_deltas = str.split(deltas,',') //---- n = bar_index if barstate.isconfirmed if array.size(split_prices) > 0 for i = 1 to k top = low + i/k*r btm = low + (i-1)/k*r sum = 0. for j = 0 to array.size(split_prices)-1 value = str.tonumber(array.get(split_prices,j)) d = str.tonumber(array.get(split_deltas,j)) sum := value < top and value >= btm ? sum + d : sum color bgcolor = na color border_color = na color text_color = na if look == 'Candle' bgcolor := color.new(close > open ? bull : bear,50) border_color := close > open ? bull : bear text_color := close > open ? bull : bear else if look == 'Gradient' bgcolor := color.from_gradient(sum,0,volume,col_a,col_b) border_color := bgcolor else bgcolor := reg_col border_color := color.gray txt = percent ? str.tostring(sum/volume*100,format.percent) : str.tostring(sum,'#.#####') if look != 'Candle' line.new(n,high,n,low,color=close > open ? bull : bear,width=3) box.new(n,top,n+1,btm,text = txt,text_color=color.gray, bgcolor=bgcolor,border_color=border_color) array.clear(split_prices) array.clear(split_deltas) //---- if barstate.isnew delta := 0 prev := 0 deltas := '' prices := '' else if barstate.islast delta := volume - prev prev := volume deltas += str.tostring(delta) + ',' prices += str.tostring(close) + ','
Seasons
https://www.tradingview.com/script/vqSv4K4k-Seasons/
jamiedubauskas
https://www.tradingview.com/u/jamiedubauskas/
25
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © jamiedubauskas //@version=5 indicator(title = "Seasons", shorttitle = "Seasons", overlay = true) show_summer = input.bool(title = "Summer", defval = true) show_spring = input.bool(title = "Spring", defval = false) show_winter = input.bool(title = "Winter", defval = false) show_fall = input.bool(title = "Fall", defval = false) current_hemisphere = input.string(title = "Current Hemisphere", options = ["Northern", "Southern"], defval = "Northern") is_summer = current_hemisphere == "Northern" ? month >= 6 and month <= 8 : month == 12 or month == 1 or month == 2 is_spring = current_hemisphere == "Northern" ? month >= 3 and month <= 5 : month >= 9 and month <= 11 is_fall = current_hemisphere == "Northern" ? month >= 9 and month <= 11 : month >= 3 and month <= 5 is_winter = current_hemisphere == "Northern" ? month == 12 or month == 1 or month == 2 : month >= 6 and month <= 8 // plotting the instances of summmer bgcolor(is_summer and show_summer ? color.new(color.yellow, 75) : na) bgcolor(is_spring and show_spring ? color.new(color.blue, 75) : na) bgcolor(is_fall and show_fall ? color.new(color.orange, 75) : na) bgcolor(is_winter and show_winter ? color.new(color.white, 75) : na)
Momentum Score
https://www.tradingview.com/script/ktTB3cp9/
AlexanderRios
https://www.tradingview.com/u/AlexanderRios/
87
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © AlexanderRios //@version=5 indicator(title='Momentum Score', shorttitle='MS', format=format.price, precision=2, timeframe='') len1 = input.int(1, minval=1) len2 = input.int(3, minval=1) len3 = input.int(6, minval=1) len4 = input.int(12, minval=1) w1 = input.int(12, minval=0) w2 = input.int(4, minval=0) w3 = input.int(2, minval=0) w4 = input.int(1, minval=0) source = input(close, 'Source') roc1 = ta.roc(source, len1) roc2 = ta.roc(source, len2) roc3 = ta.roc(source, len3) roc4 = ta.roc(source, len4) // Momentum Score ms = w1 * roc1 + w2 * roc2 + w3 * roc3 + w4 * roc4 plot(ms, title='Momentum Score (MS)', style=plot.style_histogram, color=ms > 0 ? color.green : color.red) hline(0, color=#C0C0C0, title='Zero Line')
Multi-Timeframe 10X
https://www.tradingview.com/script/zVqMQdO2-Multi-Timeframe-10X/
Beardy_Fred
https://www.tradingview.com/u/Beardy_Fred/
305
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Beardy_Fred //@version=5 indicator(title="MTF 10X", overlay = true) //INPUTS len = input.int(14, "Directional Length") ADX_T = input.int(20, "ADX Length") //DMI CALCULATIONS - Tradingview Built-In DMI Indicator up = ta.change(high) down = -ta.change(low) plusDM = na(up) ? na : (up > down and up > 0 ? up : 0) minusDM = na(down) ? na : (down > up and down > 0 ? down : 0) trur = ta.rma(ta.tr, len) plus = fixnan(100 * ta.rma(plusDM, len) / trur) minus = fixnan(100 * ta.rma(minusDM, len) / trur) sum = plus + minus adx = 100 * ta.rma(math.abs(plus - minus) / (sum == 0 ? 1 : sum), len) //10X CALCULATIONS D_Up = (plus > minus) and (adx > ADX_T) D_Down = (minus > plus) and (adx > ADX_T) Neutral = (adx < ADX_T) D_Up_Color = input.color(color.new(color.green, 0), title = "Uptrend") D_Down_Color = input.color(color.new(color.red, 0), title = "Downtrend") Neutral_Color = input.color(color.new(color.yellow, 0), title = "Neutral") MTF10_Color = Neutral ? Neutral_Color : D_Up ? D_Up_Color : D_Down ? D_Down_Color : na //MULTI TIMEFRAME SQUEEZE COLOR [MTF10_1m] = request.security(syminfo.tickerid, "1", [MTF10_Color]) [MTF10_5m] = request.security(syminfo.tickerid, "5", [MTF10_Color]) [MTF10_15m] = request.security(syminfo.tickerid, "15", [MTF10_Color]) [MTF10_30m] = request.security(syminfo.tickerid, "30", [MTF10_Color]) [MTF10_1H] = request.security(syminfo.tickerid, "60", [MTF10_Color]) [MTF10_4H] = request.security(syminfo.tickerid, "240", [MTF10_Color]) [MTF10_D] = request.security(syminfo.tickerid, "D", [MTF10_Color]) [MTF10_W] = request.security(syminfo.tickerid, "W", [MTF10_Color]) [MTF10_M] = request.security(syminfo.tickerid, "M", [MTF10_Color]) tableYposInput = input.string("top", "Panel position", options = ["top", "middle", "bottom"]) tableXposInput = input.string("right", "", options = ["left", "center", "right"]) var table TTM = table.new(tableYposInput + "_" + tableXposInput, 10, 1, border_width = 1) TC = input.color(color.new(color.white, 0), "Table Text Color") TS = input.string(size.small, "Table Text Size", options = [size.tiny, size.small, size.normal, size.large]) if barstate.isconfirmed table.cell(TTM, 0, 0, "10X", text_color = color.new(color.white, 0), bgcolor = color.new(color.gray, 0), text_size = TS) table.cell(TTM, 1, 0, "1m", text_color = TC, bgcolor = MTF10_1m, text_size = TS) table.cell(TTM, 2, 0, "5m", text_color = TC, bgcolor = MTF10_5m, text_size = TS) table.cell(TTM, 3, 0, "15m", text_color = TC, bgcolor = MTF10_15m, text_size = TS) table.cell(TTM, 4, 0, "30m", text_color = TC, bgcolor = MTF10_30m, text_size = TS) table.cell(TTM, 5, 0, "1H", text_color = TC, bgcolor = MTF10_1H, text_size = TS) table.cell(TTM, 6, 0, "4H", text_color = TC, bgcolor = MTF10_4H, text_size = TS) table.cell(TTM, 7, 0, "D", text_color = TC, bgcolor = MTF10_D, text_size = TS) table.cell(TTM, 8, 0, "W", text_color = TC, bgcolor = MTF10_W, text_size = TS) table.cell(TTM, 9, 0, "M", text_color = TC, bgcolor = MTF10_M, text_size = TS)
Value chart
https://www.tradingview.com/script/sbOEojcE-Value-chart/
Neimad-openware
https://www.tradingview.com/u/Neimad-openware/
36
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Neimad-openware //@version=5 indicator("Value chart") Period = input.int(5, minval=2) plot1 = plot(8, color=color.new(color.white,100),linewidth=1, style=plot.style_line) plot2 = plot(10, color=color.new(color.white,100), linewidth=1, style=plot.style_line) plot3 = plot(-8, color=color.new(color.white,100),linewidth=1, style=plot.style_line) plot4 = plot(-10, color=color.new(color.white,100), linewidth=1, style=plot.style_line) fill(plot1, plot2, color=color.new(color.red, 50)) fill(plot3, plot4, color=color.new(color.green, 50)) _valueA = 0.2 * ta.sma(high-low, Period) _valueB = ta.sma((high+low)/2, Period) _open = (open-_valueB)/_valueA _high = (high-_valueB)/_valueA _low = (low-_valueB)/_valueA _close = (close-_valueB)/_valueA plotbar(_open, _high, _low, _close, color = _close > _open ? color.green : color.red)
TropRSI
https://www.tradingview.com/script/qBQcV70B-TropRSI/
Troptrap
https://www.tradingview.com/u/Troptrap/
65
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © mildSnail31034 //@version=5 indicator("TropRSI",overlay=false) len = input(50, title="EMA length") ma = input(14,title="RSI length") lbR = input(title="Pivot Lookback Right", defval=1) lbL = input(title="Pivot Lookback Left", defval=5) rangeUpper = input(title="Max of Lookback Range", defval=60) rangeLower = input(title="Min of Lookback Range", defval=5) plotBull = input(title="Plot Bullish", defval=true) plotHiddenBull = input(title="Plot Hidden Bullish", defval=false) plotBear = input(title="Plot Bearish", defval=true) plotHiddenBear = input(title="Plot Hidden Bearish", defval=false) bearColor = color.red bullColor = color.green hiddenBullColor = color.new(color.green, 80) hiddenBearColor = color.new(color.red, 80) textColor = color.white noneColor = color.new(color.white, 100) ema = ta.ema(close,len) e = hl2-ema rsie = ta.rsi(e,ma) mid = plot(50,title="Mid") greenred = rsie>50?#00660065:#CC000065 rs = plot(rsie,title="TropRSI",color=color.black) fill(rs,mid,color=greenred,title="Fill color") ob = hline(70) os = hline(30) top = hline(100) bot = hline(0) fill(ob,top,color=#ADE86145,title="Overbought area") fill(os,bot,color=#FFCCCC45,title="Oversold area") osc = rsie plFound = na(ta.pivotlow(osc, lbL, lbR)) ? false : true phFound = na(ta.pivothigh(osc, lbL, lbR)) ? false : true _inRange(cond) => bars = ta.barssince(cond == true) rangeLower <= bars and bars <= rangeUpper //------------------------------------------------------------------------------ // Regular Bullish // Osc: Higher Low oscHL = osc[lbR] > ta.valuewhen(plFound, osc[lbR], 1) and _inRange(plFound[1]) // Price: Lower Low priceLL = low[lbR] < ta.valuewhen(plFound, low[lbR], 1) bullCond = plotBull and priceLL and oscHL and plFound plot( plFound ? osc[lbR] : na, offset=-lbR, title="Regular Bullish", linewidth=2, color=(bullCond ? bullColor : noneColor) ) plotshape( bullCond ? osc[lbR] : na, offset=-lbR, title="Regular Bullish Label", text=" Bull ", style=shape.labelup, location=location.absolute, color=bullColor, textcolor=textColor ) //------------------------------------------------------------------------------ // Hidden Bullish // Osc: Lower Low oscLL = osc[lbR] < ta.valuewhen(plFound, osc[lbR], 1) and _inRange(plFound[1]) // Price: Higher Low priceHL = low[lbR] > ta.valuewhen(plFound, low[lbR], 1) hiddenBullCond = plotHiddenBull and priceHL and oscLL and plFound plot( plFound ? osc[lbR] : na, offset=-lbR, title="Hidden Bullish", linewidth=2, color=(hiddenBullCond ? hiddenBullColor : noneColor) ) plotshape( hiddenBullCond ? osc[lbR] : na, offset=-lbR, title="Hidden Bullish Label", text=" H Bull ", style=shape.labelup, location=location.absolute, color=bullColor, textcolor=textColor ) //------------------------------------------------------------------------------ // Regular Bearish // Osc: Lower High oscLH = osc[lbR] < ta.valuewhen(phFound, osc[lbR], 1) and _inRange(phFound[1]) // Price: Higher High priceHH = high[lbR] > ta.valuewhen(phFound, high[lbR], 1) bearCond = plotBear and priceHH and oscLH and phFound plot( phFound ? osc[lbR] : na, offset=-lbR, title="Regular Bearish", linewidth=2, color=(bearCond ? bearColor : noneColor) ) plotshape( bearCond ? osc[lbR] : na, offset=-lbR, title="Regular Bearish Label", text=" Bear ", style=shape.labeldown, location=location.absolute, color=bearColor, textcolor=textColor ) //------------------------------------------------------------------------------ // Hidden Bearish // Osc: Higher High oscHH = osc[lbR] > ta.valuewhen(phFound, osc[lbR], 1) and _inRange(phFound[1]) // Price: Lower High priceLH = high[lbR] < ta.valuewhen(phFound, high[lbR], 1) hiddenBearCond = plotHiddenBear and priceLH and oscHH and phFound plot( phFound ? osc[lbR] : na, offset=-lbR, title="Hidden Bearish", linewidth=2, color=(hiddenBearCond ? hiddenBearColor : noneColor) ) plotshape( hiddenBearCond ? osc[lbR] : na, offset=-lbR, title="Hidden Bearish Label", text=" H Bear ", style=shape.labeldown, location=location.absolute, color=bearColor, textcolor=textColor )
Modified QQE-ZigZag [Non Repaint During Candle Building]
https://www.tradingview.com/script/fJVMc2eU/
Hutmacher42
https://www.tradingview.com/u/Hutmacher42/
533
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Hutmacher42 // | | | | | | | | | | | | | | // V V V V V V V Please Read V V V V V V V //>>>>>>>>>> This is a modified Version of Peter_O's Momentum Based ZigZag [QQE] <<<<<<<<<<< // This is only a test, and i want to share it with the community // It works like other ZigZags // Because Peters_O's original Version is only non repaint on closed historical Data , // during a Candle building process it can still repaint (signal appears / 21 seconds later signal disapears / 42 seconds later signal appears again in the same candle / etc.), // but that isnt important for backtesting, its only important for realtime PivotPoints during a candle // My goal for this zigzag was to make it absolute non repaint neither during a candle building process (current candle), // so once the signal is shown there is no chance that it disapers and shown a few seconds later again on that same candle, it can only show up one time per candle an thats it, // and that makes it absolute non repaint in all time frames. //===========================================================================================================================================// // ==> Thanks to Glaz , for bringing the QQE to Tradingview <3 // ==> Thanks to Peter_O , for sharing his idea to use the QQE as base for a Zigzag // and for sharing his MTF RSI with the Community <3 // ==> Thanks to HeWhoMustNotBeNamed, for sharing his awesome Supertrend Library, // and for sharing his Divergence Detection Script with the Community <3 // Glaz's QQE : https://www.tradingview.com/script/tJ6vtBBe-QQE/ // Peter_O's Momentum ZigZag : https://www.tradingview.com/script/gY4ilk5N-Momentum-based-ZigZag-incl-QQE-NON-REPAINTING/ // Peter_O's MTF RSI : https://www.tradingview.com/script/JwWWwZOD-RSI-MTF-by-PeterO/ // HeWhoMustNotBeNamed's SuperTrend Lib : https://www.tradingview.com/script/guHY9dmv-supertrend/ // HeWhoMustNotBeNamed's Divergence Detector : https://www.tradingview.com/script/vnzbp63L-Zigzag-Trend-Divergence-Detector/ //===========================================================================================================================================// // Info: - Every Calculation in that Script is Non-Repaint // - i added Info Symbol to every Parameter // Changes: - I changed the MTF RSI a little bit, you can choose between two version // - I changed the QQE a little bit, its now using the MTF RSI , and its using High and Low values as Source to make it absolute non repaint during a candle is building // - I added a little Divergence Calculation beween price and the MTF RSI that is used for the ZigZag // - I changed the Supertrend calculation and make it less complex // Important: ==> It is not possible to backtest this script correctly with historical Data, its only possible in Realtime, // because the QQE is using crossunders with RSILowSource and the QQE Line to find the Tops and, // because the QQE is using crossovers with RSIHighSource and the QQE Line to find the Bottoms, // and that means it is not possible to find the correct Time/Moment when that crossovers / crossunders happen in historical Data // =============> Please be sure you understand the Calculation and Backtest it in Realtime when you want to use it, // because i didn't published this script for real trading // =============> Im not a financial advisor and youre using this script at your own risk // =============> Please do your own research //@version=5 indicator("Modified Momentum QQE-ZigZag [Non Repaint During Candle Building]", overlay = true, max_labels_count = 500) //- Parameter Info -// //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// // Info: RSI-QQE ZigZag info_r1_type = "Choose between Cutlers and Wilders RSI" info_r1_len = "==> Rsi-Len: Set the Length for the RSI\n==> Mtf-Mult: Length Multiplier for RSI to get MTF Resolution" info_r1_mult = "==> QQE-Mult: Set the distance between QQE and RSI (works similar like Supertrend Mult)\n==> Rsi-Smooth: Smooth the Rsi with EMA" //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// // Info: Divergence / Convergence info_d1_src = "==> Div_Src: Choose source for different Rsi, \n (but with the same settings as QQE-RSI)\n==> Choose how many pivot points should be included in the calculation" info_d1_limit = "==> Div-Botlimit: Shows only the Divs that are under that limit\n==> Div-Toplimit: Shows only the Divs that are over that limit" info_d2_limit = "==> Conv-Botlimit: Shows only the Convs that are under that limit\n==> Conv-Toplimit: Shows only the Convs that are over that limit" //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// // Info: Supertrend info_s1_incl = "Wanna include the ZigZag in the Supertrend calculation?" info_s1_len = "==> MA-Len: Set the Length for the Base of the Supertend\n==> MA-Type: Choose the Base Type for the Supertrend" info_s1_atr = "==> Atr-Len: Set the Length for the Atr\n==> Atr:Mult: Set the Multiplier for the ATR" //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// //- Inputs -// //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// // Input: RSI-QQE ZigZag r1_type = input.string("Wilders", title = "Rsi-Type", options = ["Cutlers", "Wilders"], group = "ZigZag", inline = "R_0", tooltip = info_r1_type) r1_len = input.int(14, title = "Rsi-Len", group = "ZigZag", inline = "R_2") r1_mtf = input.int(2, title = "Mtf-Mult", group = "ZigZag", inline = "R_2", tooltip = info_r1_len) r1_mult = input.float(3, title = "QQe-Mult", group = "ZigZag", inline = "Q_1") r1_smooth = input.int(1, title = "Smooth", group = "ZigZag", inline = "Q_1", tooltip = info_r1_mult) l1_bull = input.color(color.green, title = "Bull-Col", group = "ZigZag", inline = "Q_2") l1_bear = input.color(color.red, title = "Bear-Col", group = "ZigZag", inline = "Q_2") l1_zz = input.color(#5b9cf6, title = "ZigZag", group = "ZigZag", inline = "Q_3") l1_line = input.int(1, title = "Line", group = "ZigZag", inline = "Q_3") l1_points = input.int(1, title = "•", group = "ZigZag", inline = "Q_3") //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// // Input: RSI Divergence / Convergence d1_src = input.source(close, title = "Div-Src", group = "Divergence / Convergence", inline = "D_0") d1_pp = input.string("1", title = "PPs-Back", options = ["1", "2", "3"], group = "Divergence / Convergence", inline = "D_0", tooltip = info_d1_src) d1_botlimit = input.float(28, title = "Div-BotLimit", group = "Divergence / Convergence", inline = "D_1") d1_toplimit = input.float(70, title = "Div-TopLimit", group = "Divergence / Convergence", inline = "D_1", tooltip = info_d1_limit) l1_pos = input.color(color.yellow, title = "Div▲", group = "Divergence / Convergence", inline = "C_2") l1_neg = input.color(#ab47bc, title = "Div▼", group = "Divergence / Convergence", inline = "C_2") d1_show = input.bool(true, title = "Show-Divergence", group = "Divergence / Convergence", inline = "C_2") d2_botlimit = input.float(52.5, title = "Conv-BotLimit", group = "Divergence / Convergence", inline = "D_2") d2_toplimit = input.float(47.5, title = "Conv-TopLimit", group = "Divergence / Convergence", inline = "D_2", tooltip = info_d2_limit) l2_pos = input.color(#26c6da, title = "Conv▲", group = "Divergence / Convergence", inline = "C_3") l2_neg = input.color(#ff9200, title = "Conv▼", group = "Divergence / Convergence", inline = "C_3") d2_show = input.bool(true, title = "Show-Convergence", group = "Divergence / Convergence", inline = "C_3") //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// // Input: Supertrend s1_show = input.bool(true, title = "Show-Supertrend", group = "Supertrend", inline = "S_00") s1_len = input.int(34, title = "Ma-Len", group = "Supertrend", inline = "S_1") s1_type = input.string("EMA", title = "Ma-Type", options = ["SMA", "EMA", "HH / LL"], group = "Supertrend", inline = "S_1", tooltip = info_s1_len) s1_atr_len = input.int(34, title = "Atr-Len", group = "Supertrend", inline = "S_2") s1_atr_mult = input.float(4.25, title = "Atr-Mult", group = "Supertrend", inline = "S_2", tooltip = info_s1_atr) s1_incl = input.bool(true, title = "Include-ZigZag", group = "Supertrend", inline = "S_0", tooltip = info_s1_incl) s1_bull = input.color(color.green, title = "UpTrend", group = "Supertrend", inline = "S_3") s1_bear = input.color(color.red, title = "DownTrend", group = "Supertrend", inline = "S_3") s1_line = input.int(1, title = "Line", group = "Supertrend", inline = "S_3") //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// //- Functions -// //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// // Function: Modified MTF Relative Strength Index f_rsi(_src, _len, _mtf, _type)=> _change = _src - _src[_mtf] _up = math.max(_change, 0) _down = (-math.min(_change, 0)) _up_change = _type == "Wilders" ? ta.rma(_up, (_len * _mtf)) : _type == "Cutlers" ? ta.sma(_up, (_len * _mtf)) : na _down_change = _type == "Wilders" ? ta.rma(_down, (_len * _mtf)) : _type == "Cutlers" ? ta.sma(_down, (_len * _mtf)) : na _rsi = _down_change == 0 ? 100 : _up_change == 0 ? 0 : 100 - (100 / (1 + _up_change / _down_change)) //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// // Function: ZigZag f_zz(_dir, _high, _low)=> _up = _dir == 1 _down = _dir == -1 _peak = 0.0 _peak := _high > _peak[1] and _up or _down[1] and _up ? _high : nz(_peak[1]) _bottom = 0.0 _bottom := _low < _bottom[1] and _down or _up[1] and _down ? _low : nz(_bottom[1]) _zz = _up and _down[1] ? _bottom[1] : _up[1] and _down ? _peak[1] : na _top = _down and _up[1] ? _peak[1] : na _bot = _up and _down[1] ? _bottom[1] : na [_zz, _top, _bot] //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// // Function: Modified QQE f_qqe(_len, _mtf, _type, _smooth, _atr_mult)=> _wilders = _len * 2 - 1 _up = 0.0 _up_rsi = f_rsi(low, _len, _mtf, _type) _up_ema = ta.ema(_up_rsi, _smooth) _up_atr = math.abs(_up_ema[1] - _up_ema) _up_diff = ta.ema(ta.ema(_up_atr, _wilders), _wilders) * _atr_mult _up_ma = _up_ema - _up_diff _up := _up_ema[1] > _up[1] and _up_ema > _up[1] ? math.max(_up_ma, _up[1]) : _up_ma _dn = 0.0 _dn_rsi = f_rsi(high, _len, _mtf, _type) _dn_ema = ta.ema(_dn_rsi, _smooth) _dn_atr = math.abs(_dn_ema[1] - _dn_ema) _dn_diff = ta.ema(ta.ema(_dn_atr, _wilders), _wilders) * _atr_mult _dn_ma = _dn_ema + _dn_diff _dn := _dn_ema[1] < _dn[1] and _dn_ema < _dn[1] ? math.min(_dn_ma, _dn[1]) : _dn_ma _trend = 0 _trend := ta.crossover(_dn_ema, _dn[1]) ? 1 : ta.crossunder(_up_ema, _up[1]) ? -1 : nz(_trend[1], _trend) //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// // Function: Supertrend f_supertrend(_top, _bot, _incl, _len, _type, _atr_len, _atr_mult)=> _atr = ta.atr(_atr_len) * _atr_mult _up_ma = _type == "EMA" ? ta.ema(low[1], _len) : _type == "SMA" ? ta.sma(low[1], _len) : _type == "HH / LL" ? ta.lowest(low[1], _len) : na _up_b = _incl ? _bot[1] - _atr : na _up = _up_ma - _atr _up := low[1] > _up[1] ? math.max(_up, _up[1], nz(_up_b, _up - 1)) : _up _dn_ma = _type == "EMA" ? ta.ema(high[1], _len) : _type == "SMA" ? ta.sma(high[1], _len) : _type == "HH / LL" ? ta.highest(high[1], _len) : na _dn_t = _incl ? _top[1] + _atr : na _dn = _dn_ma + _atr _dn := high[1] < _dn[1] ? math.min(_dn, _dn[1], nz(_dn_t, _dn + 1)) : _dn _trend = 0 _trend := ta.crossover(high[1], _dn[1]) ? 1 : ta.crossunder(low[1], _up[1]) ? -1 : nz(_trend[1], _trend) [_trend, _up, _dn] //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// //- Calculations -// //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// // Calc: Rsi QQE ZigZag qqe_trend = f_qqe(r1_len, r1_mtf, r1_type, r1_smooth, r1_mult) [zz, zz_top, zz_bot] = f_zz(qqe_trend, high, low) //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// // Calc: Supertrend [s_trend, s_up, s_dn] = f_supertrend(zz_top, zz_bot, s1_incl, s1_len, s1_type, s1_atr_len, s1_atr_mult) st_up = s_trend == 1 ? s_up : na st_dn = s_trend == -1 ? s_dn : na //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// // Calc: RSI QQE Divergence rsi = f_rsi(d1_src, r1_len, r1_mtf, r1_type) [rsi_zz, rsi_top, rsi_bot] = f_zz(qqe_trend, rsi, rsi) prev_bot_1 = ta.valuewhen(zz_bot, zz_bot, 1) prev_bot_2 = ta.valuewhen(zz_bot, zz_bot, 2) prev_bot_3 = ta.valuewhen(zz_bot, zz_bot, 3) prev_top_1 = ta.valuewhen(zz_top, zz_top, 1) prev_top_2 = ta.valuewhen(zz_top, zz_top, 2) prev_top_3 = ta.valuewhen(zz_top, zz_top, 3) rsi_prev_bot_1 = ta.valuewhen(rsi_bot, rsi_bot, 1) rsi_prev_bot_2 = ta.valuewhen(rsi_bot, rsi_bot, 2) rsi_prev_bot_3 = ta.valuewhen(rsi_bot, rsi_bot, 3) rsi_prev_top_1 = ta.valuewhen(rsi_top, rsi_top, 1) rsi_prev_top_2 = ta.valuewhen(rsi_top, rsi_top, 2) rsi_prev_top_3 = ta.valuewhen(rsi_top, rsi_top, 3) pos_limit_1 = rsi_bot < d1_botlimit and rsi_prev_bot_1 < d1_botlimit ? true : false pos_limit_2 = rsi_bot < d1_botlimit and rsi_prev_bot_2 < d1_botlimit ? true : false pos_limit_3 = rsi_bot < d1_botlimit and rsi_prev_bot_3 < d1_botlimit ? true : false pos_limit_4 = rsi_bot < d2_botlimit and rsi_prev_bot_1 < d2_botlimit ? true : false pos_limit_5 = rsi_bot < d2_botlimit and rsi_prev_bot_2 < d2_botlimit ? true : false pos_limit_6 = rsi_bot < d2_botlimit and rsi_prev_bot_3 < d2_botlimit ? true : false neg_limit_1 = rsi_top > d1_toplimit and rsi_prev_top_1 > d1_toplimit ? true : false neg_limit_2 = rsi_top > d1_toplimit and rsi_prev_top_2 > d1_toplimit ? true : false neg_limit_3 = rsi_top > d1_toplimit and rsi_prev_top_3 > d1_toplimit ? true : false neg_limit_4 = rsi_top > d2_toplimit and rsi_prev_top_1 > d2_toplimit ? true : false neg_limit_5 = rsi_top > d2_toplimit and rsi_prev_top_2 > d2_toplimit ? true : false neg_limit_6 = rsi_top > d2_toplimit and rsi_prev_top_3 > d2_toplimit ? true : false pos_div_1 = zz_bot < prev_bot_1 and rsi_bot > rsi_prev_bot_1 and pos_limit_1 ? true : false pos_div_2 = zz_bot < prev_bot_2 and rsi_bot > rsi_prev_bot_2 and pos_limit_2 ? true : false pos_div_3 = zz_bot < prev_bot_3 and rsi_bot > rsi_prev_bot_3 and pos_limit_3 ? true : false pos_con_1 = zz_bot > prev_bot_1 and rsi_bot < rsi_prev_bot_1 and pos_limit_4 ? true : false pos_con_2 = zz_bot > prev_bot_2 and rsi_bot < rsi_prev_bot_2 and pos_limit_5 ? true : false pos_con_3 = zz_bot > prev_bot_3 and rsi_bot < rsi_prev_bot_3 and pos_limit_6 ? true : false neg_div_1 = zz_top > prev_top_1 and rsi_top < rsi_prev_top_1 and neg_limit_1 ? true : false neg_div_2 = zz_top > prev_top_2 and rsi_top < rsi_prev_top_2 and neg_limit_2 ? true : false neg_div_3 = zz_top > prev_top_3 and rsi_top < rsi_prev_top_3 and neg_limit_3 ? true : false neg_con_1 = zz_top < prev_top_1 and rsi_top > rsi_prev_top_1 and neg_limit_4 ? true : false neg_con_2 = zz_top < prev_top_2 and rsi_top > rsi_prev_top_2 and neg_limit_5 ? true : false neg_con_3 = zz_top < prev_top_3 and rsi_top > rsi_prev_top_3 and neg_limit_6 ? true : false pos_div_add = d1_pp == "1" ? pos_div_1 : d1_pp == "2" ? pos_div_1 or pos_div_2 : d1_pp == "3" ? pos_div_1 or pos_div_2 or pos_div_3 : false pos_div = d1_show == true ? pos_div_add : false pos_con_add = d1_pp == "1" ? pos_con_1 : d1_pp == "2" ? pos_con_1 or pos_con_2 : d1_pp == "3" ? pos_con_1 or pos_con_2 or pos_con_3 : false pos_con = d2_show == true ? pos_con_add : false neg_div_add = d1_pp == "1" ? neg_div_1 : d1_pp == "2" ? neg_div_1 or neg_div_2 : d1_pp == "3" ? neg_div_1 or neg_div_2 or neg_div_3 : false neg_div = d1_show == true ? neg_div_add : false neg_con_add = d1_pp == "1" ? neg_con_1 : d1_pp == "2" ? neg_con_1 or neg_con_2 : d1_pp == "3" ? neg_con_1 or neg_con_2 or neg_con_3 : false neg_con = d2_show == true ? neg_con_add : false div_col = pos_div ? l1_pos : neg_div ? l1_neg : pos_con ? l2_pos : neg_con ? l2_neg : na //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// // Calc: ZigZag Continuation Labels incr_bull = zz_bot > prev_bot_1 ? true : false decr_bull = zz_bot < prev_bot_1 ? true : false incr_bear = zz_top < prev_top_1 ? true : false decr_bear = zz_top > prev_top_1 ? true : false zz_col = decr_bull and pos_div == true ? l1_pos : decr_bear and neg_div == true ? l1_neg : incr_bull and pos_div == true ? l1_pos : incr_bear and neg_div == true ? l1_neg : decr_bull and pos_con == true ? l2_pos : decr_bear and neg_con == true ? l2_neg : incr_bull and pos_con == true ? l2_pos : incr_bear and neg_con == true ? l2_neg : decr_bull and pos_div == false and pos_con == false ? l1_bear : decr_bear and neg_div == false and neg_con == false ? l1_bull : incr_bull and pos_div == false and pos_con == false ? l1_bull : incr_bear and neg_div == false and neg_con == false ? l1_bear : color.new(color.white, 100) zz_txt = decr_bull and pos_div == true ? "LL\nDiv▲" : decr_bear and neg_div == true ? "HH\nDiv▼" : incr_bull and pos_div == true ? "HL\nDiv▲" : incr_bear and neg_div == true ? "LH\nDiv▼" : decr_bull and pos_con == true ? "LL\nConv▲" : decr_bear and neg_con == true ? "HH\nConv▼" : incr_bull and pos_con == true ? "HL\nConv▲" : incr_bear and neg_con == true ? "LH\nConv▼" : decr_bull and pos_div == false and pos_con == false ? "LL" : decr_bear and neg_div == false and neg_con == false ? "HH" : incr_bull and pos_div == false and pos_con == false ? "HL" : incr_bear and neg_div == false and neg_con == false ? "LH" : "none" lbl_col = color.new(color.white, 100) //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// //- Drawings -// //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// // Draw: ZigZag plot(zz, title = "ZigZag", color = l1_zz, linewidth = l1_line, editable = true) plot(zz, title = "Pivots", color = zz_col, linewidth = l1_points, style = plot.style_circles, editable = true) //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// // Draw: Supertrend plot(s1_show ? st_up : na, title = "Up-Trend", color = s1_bull, linewidth = s1_line, editable = true, style = plot.style_linebr) plot(s1_show ? st_dn : na, title = "Down-Trend", color = s1_bear, linewidth = s1_line, editable = true, style = plot.style_linebr) //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// // Draw: Divergence Labels barcolor(div_col, editable = true) label.new(x = zz_bot ? bar_index : na , y = zz_bot, text = zz_txt, textcolor = zz_col, color = lbl_col, style = label.style_label_up, size = size.small) label.new(x = zz_top ? bar_index : na , y = zz_top, text = zz_txt, textcolor = zz_col, color = lbl_col, style = label.style_label_down, size = size.small) //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// //- Alters -// //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// // Alert: ZigZag Continuation alertcondition(incr_bull, title = "HL", message = "HL") alertcondition(decr_bear, title = "HH", message = "HH") alertcondition(incr_bear, title = "LH", message = "LH") alertcondition(decr_bull, title = "LL", message = "LL") alertcondition(pos_div, title = "Pos Div", message = "Pos Div") alertcondition(neg_div, title = "Neg Div", message = "Neg Div") alertcondition(pos_con, title = "Pos Conv", message = "Pos Conv") alertcondition(neg_con, title = "Neg Conv", message = "Neg Conv") //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
Fusion: Trend and thresholds
https://www.tradingview.com/script/W07SP7KE-Fusion-Trend-and-thresholds/
Koalems
https://www.tradingview.com/u/Koalems/
45
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Koalems // @version=5 // *************************************************************************************************** // // // NOTES // // // *************************************************************************************************** // https://www.tradingview.com/pine-script-docs/en/v5/concepts/Timeframes.html#pagetimeframes // *************************************************************************************************** // // // CONSTANTS // // // *************************************************************************************************** rad2DegConst = 180 / math.pi maxBarsBack = 4999 // *************************************************************************************************** // // // TYPE // // // *************************************************************************************************** indicator( title = 'Fusion: Trend and thresholds', shorttitle = 'Fusion: Trend', max_bars_back = maxBarsBack, overlay=false) // *************************************************************************************************** // // // INPUT // // // *************************************************************************************************** // *************************************************************************************************** // Trend // *************************************************************************************************** Group7110 = '7110 Trend: Show' trendShowOnMainChart = input.bool(false, group=Group7110, title='On main chart') Group7120 = '7120 Trend: Show any chart' trendShow = input.bool(false, group=Group7120, title='Trend line') trendShowColorsShowThresholds = input.bool(false, group=Group7120, title='  Colors show thresholds', tooltip="If unchecked colors show direction of trend only.") trendShowThresholdMarkers = input.bool(false, group=Group7120, title='Threshold markers') Group7130 = '7130 Trend: Show off main chart' trendShowSlope = input.bool(true, group=Group7130, title='Slope line') and not trendShowOnMainChart trendShowThresholdAsFill = input.bool(true, group=Group7130, title='Threshold as fill') and not trendShowOnMainChart trendShowZeroLine = input.bool(true, group=Group7130, title='Zero line') and not trendShowOnMainChart trendShowPRLines = input.bool(false, group=Group7120, title='Percentile rank lines') and not trendShowOnMainChart Group7150 = '7150 Trend: Threshold levels' tooltiptrendPR = '0 - 100, percentile rank value. For shorts we look for lower than the percentile rank and visa versa for longs.' trendThresholdLong = input.float(70, group=Group7150, minval=0, maxval=100, step=1, title='Threshold slope long', tooltip=tooltiptrendPR) trendThresholdShort = input.float(30, group=Group7150, minval=0, maxval=100, step=1, title='Threshold slope short', tooltip=tooltiptrendPR) Group7160 = '7160 Trend: Indicator settings' trendTimeFrameMatchChart = input.bool(false, group=Group7160, title='Time frame same as chart or') trendTimeFrame = input.string('480', group=Group7160, title='  Custom time frame') trendSrcOrig = input.source(hl2, group=Group7160, title='Source') trendMASwitch = input.string('EHMA', group=Group7160, title='Source: MA variation', options=['EMA', 'EHMA', 'HMA', 'LINREG', 'RMA', 'SMA', 'SWMA', 'TEHMA', 'VWMA', 'WMA']) trendMaLen = input.int(100, group=Group7160, minval=2, title='Source: MA Length') trendSlopeLen = input.int(15, group=Group7160, minval=1, title='Slope: length') trendSlopePercentageRankLen = input.int(5000, group=Group7160, minval=1, title='Percentage rank length') Group7170 = '7170 Trend: Display settings' trendColorZeroLine = input.color(color.new(color.white, 25), group=Group7170, title='Zero line') // We don't use inputs for these because then we loose colors on the style tab. trendLongBaseColor = color.new(color.green, 0) trendShortBaseColor = color.new(color.red, 0) trendNoTrendBaseColor = color.new(color.white, 0) // *************************************************************************************************** // // // FUNCTIONS // // // *************************************************************************************************** SlopeCalc(src, Xrange) => // x1 = 0 // Theoretically everything stems from x1, x2, y1, y2 but we assume // x2 = Xrange // x1 = 0 which means we can just use Xrange instead of x1 & x2. y1 = ta.linreg(src, Xrange, Xrange) // Get Y1 for X (Xrange) using Linear Regression (best line fit) y2 = ta.linreg(src, Xrange, 0) // Get Y2 for X ( 0 ) using Linear Regression (best line fit) // Xrange = Xrange - 0 // Set the X range Yrange = y2 - y1 // Set the Y range slope = Yrange / Xrange // Distance formula from pythagoras slope // https://alanhull.com/hull-moving-average // Hull Moving Average (HMA) formula // Integer(SquareRoot(Period)) WMA [2 x Integer(Period/2) WMA(Price) - Period WMA(Price)] // THMA is even more weighted to shorter timeframes than the EMA. The 'T' is for Tripple and is like a Tripple EMA // so TEHMA would be more correct. HMA (_src, _length) => ta.wma(2 * ta.wma(_src, _length / 2) - ta.wma(_src, _length ), math.round(math.sqrt(_length))) EHMA(_src, _length) => ta.ema(2 * ta.ema(_src, _length / 2) - ta.ema(_src, _length ), math.round(math.sqrt(_length))) THMA(_src, _length) => ta.wma(3 * ta.wma(_src, _length / 3) - ta.wma(_src, _length / 2) - ta.wma(_src, _length), _length) HullMode(modeSwitch, src, len) => modeSwitch == 'HMA' ? HMA (src, len) : modeSwitch == 'EHMA' ? EHMA(src, len) : modeSwitch == 'TEHMA' ? THMA(src, len / 2) : na MaTypes(source, length, smoothingMode) => float ma = switch smoothingMode 'EMA' => ta.ema(source, length) 'EHMA' => HullMode(smoothingMode, source, length) 'HMA' => HullMode(smoothingMode, source, length) 'LINREG' => ta.linreg(source, length, 0) 'RMA' => ta.rma(source, length) 'SMA' => ta.sma(source, length) "SWMA" => ta.swma(source) 'TEHMA' => HullMode(smoothingMode, source, length) "VWMA" => ta.vwma(source, length) 'WMA' => ta.wma(source, length) => runtime.error("No matching MA type found.") float(na) ma // *************************************************************************************************** // // // MAIN // // // *************************************************************************************************** // *************************************************************************************************** // Trend // *************************************************************************************************** rangeSrc = request.security(syminfo.tickerid, trendTimeFrame, trendSrcOrig) if trendTimeFrameMatchChart rangeSrc := trendSrcOrig trendMa = MaTypes(rangeSrc, trendMaLen, trendMASwitch) trendSlope = SlopeCalc(trendMa, trendSlopeLen) trendMaDir = trendMa > trendMa[2] ? 1 : trendMa < trendMa[2] ? -1 : 0 // 1 = up, -1 = down, 0 = horizontal // Percentage rank trendTooLow = ta.percentile_linear_interpolation(trendSlope, trendSlopePercentageRankLen, trendThresholdShort) trendTooHigh = ta.percentile_linear_interpolation(trendSlope, trendSlopePercentageRankLen, trendThresholdLong) trendLong = trendSlope > trendTooHigh // Source too high by being above the percentage rank trendShort = trendSlope < trendTooLow // Source too low by being below the percentage rank trendLongStart = not trendLong[1] and trendLong trendShortStart = not trendShort[1] and trendShort trendLongEnd = trendLong[1] and not trendLong trendShortEnd = trendShort[1] and not trendShort // *************************************************************************************************** // // // SHOW // // // *************************************************************************************************** plot(trendShowPRLines ? trendTooHigh : na, color=color.aqua, title='Percentile rank high') plot(trendShowPRLines ? trendTooLow : na, color=color.aqua, title='Percentile rank low') trendFillCond = trendShowThresholdAsFill and (trendLong or trendShort) color trendDirColor = switch trendMaDir 1 => color.new(trendLongBaseColor, 0) 0 => color.new(trendNoTrendBaseColor, 0) -1 => color.new(trendShortBaseColor, 0) color trendDirColorFill = switch trendMaDir 1 => color.new(trendLongBaseColor, 88) 0 => color.new(trendNoTrendBaseColor, 88) -1 => color.new(trendShortBaseColor, 88) color trendDirColorFillOutline = switch trendMaDir 1 => color.new(trendLongBaseColor, 50) 0 => color.new(trendNoTrendBaseColor, 50) -1 => color.new(trendShortBaseColor, 50) if trendShowColorsShowThresholds trendDirColor := trendLong ? color.new(trendLongBaseColor, 0) : trendShort ? color.new(trendShortBaseColor, 0) : color.new(trendNoTrendBaseColor, 0) plot(trendShow ? trendMa : na, color=trendDirColor, style=plot.style_line, title='Trend MA line') plot(trendShowSlope and not trendFillCond ? trendSlope : na, color=color.new(color.orange, 0), style=plot.style_linebr, title='Trend slope line') hline(trendShowZeroLine and not trendShowThresholdAsFill ? 0 : na, color=trendColorZeroLine, linestyle=hline.style_dotted, title='Zero line') trendGoLongShortOnly = plot(trendFillCond ? trendSlope : na, color=trendDirColorFillOutline, style = plot.style_linebr, title='Trend go long/short plot') trendGoLongShortOnlyZero = plot(trendShowThresholdAsFill ? 0 : na, color=trendColorZeroLine, style=plot.style_line, title='Zero line') fill(trendGoLongShortOnly, trendGoLongShortOnlyZero, color=trendDirColorFill, title='Trend go long/short fill') plotshape(trendShowThresholdMarkers and trendLongStart, color=color.new(trendLongBaseColor, 45), text='Start', style=shape.labeldown, location=location.top, size=size.small, textcolor=color.white, title='Trend: Long start') plotshape(trendShowThresholdMarkers and trendLongEnd, color=color.new(trendLongBaseColor, 45), text='End', style=shape.labeldown, location=location.top, size=size.small, textcolor=color.white, title='Trend: Long end') plotshape(trendShowThresholdMarkers and trendShortStart, color=color.new(trendShortBaseColor, 45), text='Start', style=shape.labelup, location=location.bottom, size=size.small, textcolor=color.white, title='Trend: Short start') plotshape(trendShowThresholdMarkers and trendShortEnd, color=color.new(trendShortBaseColor, 45), text='End', style=shape.labelup, location=location.bottom, size=size.small, textcolor=color.white, title='Trend: Short end')
Moving Average Waves
https://www.tradingview.com/script/b8hi9oRV-Moving-Average-Waves/
LucasVivien
https://www.tradingview.com/u/LucasVivien/
148
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © LucasVivien //@version=4 study("Moving Average Waves", shorttitle="MA Waves", overlay=true, precision=0) //////////////////////////////////////////////////////////////////////////////// // INPUTS // //////////////////////////////////////////////////////////////////////////////// Source = input(title="Source" , type=input.source , defval=close, group="Source & Type") MAtype = input(title="MA Type" , type=input.string , defval="EMA", group="Source & Type" , options=["EMA", "SMA", "HMA", "WMA", "VWMA"]) FirstMAlen = input(title="Base length" , type=input.integer, defval=10 , group="Moving Average Length", minval=1, maxval=2000) SpacingFactor = input(title="Spacing Factor", type=input.integer, defval=1 , group="Moving Average Length", minval=1, maxval=100) ColorStyle = input(title="Colors Style" , type=input.string , defval="A" , group="Lines Display" , options=["A", "B", "C", "D", "E", "F", "G"]) MAwidth = input(title="Width" , type=input.integer, defval=1 , group="Lines Display" , minval=1, maxval=20) MAdisplay = input(title="# Ploted" , type=input.integer, defval=20 , group="Lines Display" , minval=1, maxval=20) Transp = input(title="Transparency" , type=input.integer, defval=30 , group="Lines Display" , minval=0, maxval=100) // spacingtype = input(title="Spacing Type Style", type=input.string, defval="Linear", options=["Linear", "logarithmic", "Exponential", "D"], tooltip="")) //////////////////////////////////////////////////////////////////////////////// // MA LENGHT // //////////////////////////////////////////////////////////////////////////////// ma1length = FirstMAlen * SpacingFactor ma2length = FirstMAlen * SpacingFactor * 2 ma3length = FirstMAlen * SpacingFactor * 3 ma4length = FirstMAlen * SpacingFactor * 4 ma5length = FirstMAlen * SpacingFactor * 5 ma6length = FirstMAlen * SpacingFactor * 6 ma7length = FirstMAlen * SpacingFactor * 7 ma8length = FirstMAlen * SpacingFactor * 8 ma9length = FirstMAlen * SpacingFactor * 9 ma10length = FirstMAlen * SpacingFactor * 10 ma11length = FirstMAlen * SpacingFactor * 11 ma12length = FirstMAlen * SpacingFactor * 12 ma13length = FirstMAlen * SpacingFactor * 13 ma14length = FirstMAlen * SpacingFactor * 14 ma15length = FirstMAlen * SpacingFactor * 15 ma16length = FirstMAlen * SpacingFactor * 16 ma17length = FirstMAlen * SpacingFactor * 17 ma18length = FirstMAlen * SpacingFactor * 18 ma19length = FirstMAlen * SpacingFactor * 19 ma20length = FirstMAlen * SpacingFactor * 20 //////////////////////////////////////////////////////////////////////////////// // MA TYPES // //////////////////////////////////////////////////////////////////////////////// MA1 = ema(Source, ma1length) MA2 = ema(Source, ma2length) MA3 = ema(Source, ma3length) MA4 = ema(Source, ma4length) MA5 = ema(Source, ma5length) MA6 = ema(Source, ma6length) MA7 = ema(Source, ma7length) MA8 = ema(Source, ma8length) MA9 = ema(Source, ma9length) MA10 = ema(Source, ma10length) MA11 = ema(Source, ma11length) MA12 = ema(Source, ma12length) MA13 = ema(Source, ma13length) MA14 = ema(Source, ma14length) MA15 = ema(Source, ma15length) MA16 = ema(Source, ma16length) MA17 = ema(Source, ma17length) MA18 = ema(Source, ma18length) MA19 = ema(Source, ma19length) MA20 = ema(Source, ma20length) if MAtype == "SMA" MA1 := sma(Source, ma1length) MA2 := sma(Source, ma2length) MA3 := sma(Source, ma3length) MA4 := sma(Source, ma4length) MA5 := sma(Source, ma5length) MA6 := sma(Source, ma6length) MA7 := sma(Source, ma7length) MA8 := sma(Source, ma8length) MA9 := sma(Source, ma9length) MA10 := sma(Source, ma10length) MA11 := sma(Source, ma11length) MA12 := sma(Source, ma12length) MA13 := sma(Source, ma13length) MA14 := sma(Source, ma14length) MA15 := sma(Source, ma15length) MA16 := sma(Source, ma16length) MA17 := sma(Source, ma17length) MA18 := sma(Source, ma18length) MA19 := sma(Source, ma19length) MA20 := sma(Source, ma20length) if MAtype == "HMA" MA1 := hma(Source, ma1length) MA2 := hma(Source, ma2length) MA3 := hma(Source, ma3length) MA4 := hma(Source, ma4length) MA5 := hma(Source, ma5length) MA6 := hma(Source, ma6length) MA7 := hma(Source, ma7length) MA8 := hma(Source, ma8length) MA9 := hma(Source, ma9length) MA10 := hma(Source, ma10length) MA11 := hma(Source, ma11length) MA12 := hma(Source, ma12length) MA13 := hma(Source, ma13length) MA14 := hma(Source, ma14length) MA15 := hma(Source, ma15length) MA16 := hma(Source, ma16length) MA17 := hma(Source, ma17length) MA18 := hma(Source, ma18length) MA19 := hma(Source, ma19length) MA20 := hma(Source, ma20length) if MAtype == "WMA" MA1 := wma(Source, ma1length) MA2 := wma(Source, ma2length) MA3 := wma(Source, ma3length) MA4 := wma(Source, ma4length) MA5 := wma(Source, ma5length) MA6 := wma(Source, ma6length) MA7 := wma(Source, ma7length) MA8 := wma(Source, ma8length) MA9 := wma(Source, ma9length) MA10 := wma(Source, ma10length) MA11 := wma(Source, ma11length) MA12 := wma(Source, ma12length) MA13 := wma(Source, ma13length) MA14 := wma(Source, ma14length) MA15 := wma(Source, ma15length) MA16 := wma(Source, ma16length) MA17 := wma(Source, ma17length) MA18 := wma(Source, ma18length) MA19 := wma(Source, ma19length) MA20 := wma(Source, ma20length) if MAtype == "VWMA" MA1 := vwma(Source, ma1length) MA2 := vwma(Source, ma2length) MA3 := vwma(Source, ma3length) MA4 := vwma(Source, ma4length) MA5 := vwma(Source, ma5length) MA6 := vwma(Source, ma6length) MA7 := vwma(Source, ma7length) MA8 := vwma(Source, ma8length) MA9 := vwma(Source, ma9length) MA10 := vwma(Source, ma10length) MA11 := vwma(Source, ma11length) MA12 := vwma(Source, ma12length) MA13 := vwma(Source, ma13length) MA14 := vwma(Source, ma14length) MA15 := vwma(Source, ma15length) MA16 := vwma(Source, ma16length) MA17 := vwma(Source, ma17length) MA18 := vwma(Source, ma18length) MA19 := vwma(Source, ma19length) MA20 := vwma(Source, ma20length) //////////////////////////////////////////////////////////////////////////////// // MA COLORS // //////////////////////////////////////////////////////////////////////////////// var ma1color1 = color.rgb(0, 0, 0, Transp) var ma2color1 = color.rgb(0, 0, 0, Transp) var ma3color1 = color.rgb(0, 0, 0, Transp) var ma4color1 = color.rgb(0, 0, 0, Transp) var ma5color1 = color.rgb(0, 0, 0, Transp) var ma6color1 = color.rgb(0, 0, 0, Transp) var ma7color1 = color.rgb(0, 0, 0, Transp) var ma8color1 = color.rgb(0, 0, 0, Transp) var ma9color1 = color.rgb(0, 0, 0, Transp) var ma10color1 = color.rgb(0, 0, 0, Transp) var ma11color1 = color.rgb(0, 0, 0, Transp) var ma12color1 = color.rgb(0, 0, 0, Transp) var ma13color1 = color.rgb(0, 0, 0, Transp) var ma14color1 = color.rgb(0, 0, 0, Transp) var ma15color1 = color.rgb(0, 0, 0, Transp) var ma16color1 = color.rgb(0, 0, 0, Transp) var ma17color1 = color.rgb(0, 0, 0, Transp) var ma18color1 = color.rgb(0, 0, 0, Transp) var ma19color1 = color.rgb(0, 0, 0, Transp) var ma20color1 = color.rgb(0, 0, 0, Transp) var ma1color2 = color.rgb(0, 0, 0, Transp) var ma2color2 = color.rgb(0, 0, 0, Transp) var ma3color2 = color.rgb(0, 0, 0, Transp) var ma4color2 = color.rgb(0, 0, 0, Transp) var ma5color2 = color.rgb(0, 0, 0, Transp) var ma6color2 = color.rgb(0, 0, 0, Transp) var ma7color2 = color.rgb(0, 0, 0, Transp) var ma8color2 = color.rgb(0, 0, 0, Transp) var ma9color2 = color.rgb(0, 0, 0, Transp) var ma10color2 = color.rgb(0, 0, 0, Transp) var ma11color2 = color.rgb(0, 0, 0, Transp) var ma12color2 = color.rgb(0, 0, 0, Transp) var ma13color2 = color.rgb(0, 0, 0, Transp) var ma14color2 = color.rgb(0, 0, 0, Transp) var ma15color2 = color.rgb(0, 0, 0, Transp) var ma16color2 = color.rgb(0, 0, 0, Transp) var ma17color2 = color.rgb(0, 0, 0, Transp) var ma18color2 = color.rgb(0, 0, 0, Transp) var ma19color2 = color.rgb(0, 0, 0, Transp) var ma20color2 = color.rgb(0, 0, 0, Transp) if ColorStyle == "A" ma1color1 := color.rgb(121, 134, 121, Transp) ma2color1 := color.rgb(115, 140, 115, Transp) ma3color1 := color.rgb(108, 147, 108, Transp) ma4color1 := color.rgb(102, 153, 102, Transp) ma5color1 := color.rgb(96, 159, 96, Transp) ma6color1 := color.rgb(89, 166, 89, Transp) ma7color1 := color.rgb(83, 172, 83, Transp) ma8color1 := color.rgb(77, 179, 77, Transp) ma9color1 := color.rgb(70, 185, 70, Transp) ma10color1 := color.rgb(64, 191, 64, Transp) ma11color1 := color.rgb(57, 198, 57, Transp) ma12color1 := color.rgb(51, 204, 51, Transp) ma13color1 := color.rgb(45, 210, 45, Transp) ma14color1 := color.rgb(38, 217, 38, Transp) ma15color1 := color.rgb(32, 223, 32, Transp) ma16color1 := color.rgb(25, 230, 25, Transp) ma17color1 := color.rgb(19, 236, 19, Transp) ma18color1 := color.rgb(13, 242, 13, Transp) ma19color1 := color.rgb(6, 249, 6, Transp) ma20color1 := color.rgb(0, 255, 0, Transp) ma1color2 := color.rgb(134, 121, 121, Transp) ma2color2 := color.rgb(140, 115, 115, Transp) ma3color2 := color.rgb(147, 108, 108, Transp) ma4color2 := color.rgb(153, 102, 102, Transp) ma5color2 := color.rgb(159, 96, 96, Transp) ma6color2 := color.rgb(166, 89, 89, Transp) ma7color2 := color.rgb(172, 83, 83, Transp) ma8color2 := color.rgb(179, 77, 77, Transp) ma9color2 := color.rgb(185, 70, 70, Transp) ma10color2 := color.rgb(191, 64, 64, Transp) ma11color2 := color.rgb(198, 57, 57, Transp) ma12color2 := color.rgb(204, 51, 51, Transp) ma13color2 := color.rgb(210, 45, 45, Transp) ma14color2 := color.rgb(217, 38, 38, Transp) ma15color2 := color.rgb(223, 32, 32, Transp) ma16color2 := color.rgb(230, 25, 25, Transp) ma17color2 := color.rgb(236, 19, 19, Transp) ma18color2 := color.rgb(242, 13, 13, Transp) ma19color2 := color.rgb(249, 6, 6, Transp) ma20color2 := color.rgb(255, 0, 0, Transp) if ColorStyle == "B" ma1color1 := color.rgb(202, 255, 202, Transp) ma2color1 := color.rgb(182, 255, 182, Transp) ma3color1 := color.rgb(162, 255, 162, Transp) ma4color1 := color.rgb(142, 255, 142, Transp) ma5color1 := color.rgb(122, 255, 122, Transp) ma6color1 := color.rgb(102, 255, 102, Transp) ma7color1 := color.rgb(77, 255, 77, Transp) ma8color1 := color.rgb(51, 255, 51, Transp) ma9color1 := color.rgb(26, 255, 26, Transp) ma10color1 := color.rgb(0, 255, 0, Transp) ma11color1 := color.rgb(0, 230, 0, Transp) ma12color1 := color.rgb(0, 204, 0, Transp) ma13color1 := color.rgb(0, 179, 0, Transp) ma14color1 := color.rgb(0, 153, 0, Transp) ma15color1 := color.rgb(0, 138, 0, Transp) ma16color1 := color.rgb(0, 123, 0, Transp) ma17color1 := color.rgb(0, 108, 0, Transp) ma18color1 := color.rgb(0, 93, 0, Transp) ma19color1 := color.rgb(0, 78, 0, Transp) ma20color1 := color.rgb(0, 63, 0, Transp) ma1color2 := color.rgb(255, 202, 202, Transp) ma2color2 := color.rgb(255, 182, 182, Transp) ma3color2 := color.rgb(255, 162, 162, Transp) ma4color2 := color.rgb(255, 142, 142, Transp) ma5color2 := color.rgb(255, 122, 122, Transp) ma6color2 := color.rgb(255, 102, 102, Transp) ma7color2 := color.rgb(255, 77, 77, Transp) ma8color2 := color.rgb(255, 51, 51, Transp) ma9color2 := color.rgb(255, 26, 26, Transp) ma10color2 := color.rgb(255, 0, 0, Transp) ma11color2 := color.rgb(230, 0, 0, Transp) ma12color2 := color.rgb(204, 0, 0, Transp) ma13color2 := color.rgb(179, 0, 0, Transp) ma14color2 := color.rgb(153, 0, 0, Transp) ma15color2 := color.rgb(138, 0, 0, Transp) ma16color2 := color.rgb(123, 0, 0, Transp) ma17color2 := color.rgb(108, 0, 0, Transp) ma18color2 := color.rgb(93, 0, 0, Transp) ma19color2 := color.rgb(78, 0, 0, Transp) ma20color2 := color.rgb(63, 0, 0, Transp) if ColorStyle == "C" ma1color1 := color.rgb(209, 255, 209, Transp) ma2color1 := color.rgb(198, 255, 198, Transp) ma3color1 := color.rgb(187, 255, 187, Transp) ma4color1 := color.rgb(176, 255, 176, Transp) ma5color1 := color.rgb(165, 255, 165, Transp) ma6color1 := color.rgb(154, 255, 154, Transp) ma7color1 := color.rgb(143, 255, 143, Transp) ma8color1 := color.rgb(132, 255, 132, Transp) ma9color1 := color.rgb(121, 255, 121, Transp) ma10color1 := color.rgb(110, 255, 110, Transp) ma11color1 := color.rgb(99, 255, 99, Transp) ma12color1 := color.rgb(88, 255, 88, Transp) ma13color1 := color.rgb(77, 255, 77, Transp) ma14color1 := color.rgb(66, 255, 66, Transp) ma15color1 := color.rgb(55, 255, 55, Transp) ma16color1 := color.rgb(44, 255, 44, Transp) ma17color1 := color.rgb(33, 255, 33, Transp) ma18color1 := color.rgb(22, 255, 22, Transp) ma19color1 := color.rgb(11, 255, 11, Transp) ma20color1 := color.rgb(0, 255, 0, Transp) ma1color2 := color.rgb(255, 209, 209, Transp) ma2color2 := color.rgb(255, 198, 198, Transp) ma3color2 := color.rgb(255, 187, 187, Transp) ma4color2 := color.rgb(255, 176, 176, Transp) ma5color2 := color.rgb(255, 165, 165, Transp) ma6color2 := color.rgb(255, 154, 154, Transp) ma7color2 := color.rgb(255, 143, 143, Transp) ma8color2 := color.rgb(255, 132, 132, Transp) ma9color2 := color.rgb(255, 121, 121, Transp) ma10color2 := color.rgb(255, 110, 110, Transp) ma11color2 := color.rgb(255, 99, 99, Transp) ma12color2 := color.rgb(255, 88, 88, Transp) ma13color2 := color.rgb(255, 77, 77, Transp) ma14color2 := color.rgb(255, 66, 66, Transp) ma15color2 := color.rgb(255, 55, 55, Transp) ma16color2 := color.rgb(255, 44, 44, Transp) ma17color2 := color.rgb(255, 33, 33, Transp) ma18color2 := color.rgb(255, 22, 22, Transp) ma19color2 := color.rgb(255, 11, 11, Transp) ma20color2 := color.rgb(255, 0, 0, Transp) if ColorStyle == "D" ma1color1 := color.rgb(0, 46, 0, Transp) ma2color1 := color.rgb(0, 57, 0, Transp) ma3color1 := color.rgb(0, 68, 0, Transp) ma4color1 := color.rgb(0, 79, 0, Transp) ma5color1 := color.rgb(0, 90, 0, Transp) ma6color1 := color.rgb(0, 101, 0, Transp) ma7color1 := color.rgb(0, 112, 0, Transp) ma8color1 := color.rgb(0, 123, 0, Transp) ma9color1 := color.rgb(0, 134, 0, Transp) ma10color1 := color.rgb(0, 145, 0, Transp) ma11color1 := color.rgb(0, 156, 0, Transp) ma12color1 := color.rgb(0, 167, 0, Transp) ma13color1 := color.rgb(0, 178, 0, Transp) ma14color1 := color.rgb(0, 189, 0, Transp) ma15color1 := color.rgb(0, 200, 0, Transp) ma16color1 := color.rgb(0, 211, 0, Transp) ma17color1 := color.rgb(0, 222, 0, Transp) ma18color1 := color.rgb(0, 233, 0, Transp) ma19color1 := color.rgb(0, 244, 0, Transp) ma20color1 := color.rgb(0, 255, 0, Transp) ma1color2 := color.rgb(46, 0, 0, Transp) ma2color2 := color.rgb(57, 0, 0, Transp) ma3color2 := color.rgb(68, 0, 0, Transp) ma4color2 := color.rgb(79, 0, 0, Transp) ma5color2 := color.rgb(90, 0, 0, Transp) ma6color2 := color.rgb(101, 0, 0, Transp) ma7color2 := color.rgb(112, 0, 0, Transp) ma8color2 := color.rgb(123, 0, 0, Transp) ma9color2 := color.rgb(134, 0, 0, Transp) ma10color2 := color.rgb(145, 0, 0, Transp) ma11color2 := color.rgb(156, 0, 0, Transp) ma12color2 := color.rgb(167, 0, 0, Transp) ma13color2 := color.rgb(178, 0, 0, Transp) ma14color2 := color.rgb(189, 0, 0, Transp) ma15color2 := color.rgb(200, 0, 0, Transp) ma16color2 := color.rgb(211, 0, 0, Transp) ma17color2 := color.rgb(222, 0, 0, Transp) ma18color2 := color.rgb(233, 0, 0, Transp) ma19color2 := color.rgb(244, 0, 0, Transp) ma20color2 := color.rgb(255, 0, 0, Transp) if ColorStyle == "E" ma1color1 := color.rgb(255, 0, 0, Transp) ma2color1 := color.rgb(255, 64, 0, Transp) ma3color1 := color.rgb(255, 128, 0, Transp) ma4color1 := color.rgb(255, 191, 0, Transp) ma5color1 := color.rgb(255, 255, 0, Transp) ma6color1 := color.rgb(191, 255, 0, Transp) ma7color1 := color.rgb(128, 255, 0, Transp) ma8color1 := color.rgb(64, 255, 0, Transp) ma9color1 := color.rgb(0, 255, 128, Transp) ma10color1 := color.rgb(0, 255, 191, Transp) ma11color1 := color.rgb(0, 255, 255, Transp) ma12color1 := color.rgb(0, 191, 255, Transp) ma13color1 := color.rgb(0, 128, 255, Transp) ma14color1 := color.rgb(0, 64, 255, Transp) ma15color1 := color.rgb(0, 0, 255, Transp) ma16color1 := color.rgb(64, 0, 255, Transp) ma17color1 := color.rgb(128, 0, 255, Transp) ma18color1 := color.rgb(191, 0, 255, Transp) ma19color1 := color.rgb(255, 0, 255, Transp) ma20color1 := color.rgb(255, 0, 191, Transp) ma1color2 := color.rgb(255, 0, 0, Transp) ma2color2 := color.rgb(255, 64, 0, Transp) ma3color2 := color.rgb(255, 128, 0, Transp) ma4color2 := color.rgb(255, 191, 0, Transp) ma5color2 := color.rgb(255, 255, 0, Transp) ma6color2 := color.rgb(191, 255, 0, Transp) ma7color2 := color.rgb(128, 255, 0, Transp) ma8color2 := color.rgb(64, 255, 0, Transp) ma9color2 := color.rgb(0, 255, 128, Transp) ma10color2 := color.rgb(0, 255, 191, Transp) ma11color2 := color.rgb(0, 255, 255, Transp) ma12color2 := color.rgb(0, 191, 255, Transp) ma13color2 := color.rgb(0, 128, 255, Transp) ma14color2 := color.rgb(0, 64, 255, Transp) ma15color2 := color.rgb(0, 0, 255, Transp) ma16color2 := color.rgb(64, 0, 255, Transp) ma17color2 := color.rgb(128, 0, 255, Transp) ma18color2 := color.rgb(191, 0, 255, Transp) ma19color2 := color.rgb(255, 0, 255, Transp) ma20color2 := color.rgb(255, 0, 191, Transp) if ColorStyle == "F" ma1color1 := color.rgb(243, 243, 243, Transp) ma2color1 := color.rgb(231, 231, 231, Transp) ma3color1 := color.rgb(219, 219, 219, Transp) ma4color1 := color.rgb(207, 207, 207, Transp) ma5color1 := color.rgb(195, 195, 195, Transp) ma6color1 := color.rgb(183, 183, 183, Transp) ma7color1 := color.rgb(171, 171, 171, Transp) ma8color1 := color.rgb(159, 159, 159, Transp) ma9color1 := color.rgb(147, 147, 147, Transp) ma10color1 := color.rgb(135, 135, 135, Transp) ma11color1 := color.rgb(123, 123, 123, Transp) ma12color1 := color.rgb(111, 111, 111, Transp) ma13color1 := color.rgb(99, 99, 99, Transp) ma14color1 := color.rgb(87, 87, 87, Transp) ma15color1 := color.rgb(75, 75, 75, Transp) ma16color1 := color.rgb(63, 63, 63, Transp) ma17color1 := color.rgb(51, 51, 51, Transp) ma18color1 := color.rgb(39, 39, 39, Transp) ma19color1 := color.rgb(27, 27, 27, Transp) ma20color1 := color.rgb(15, 15, 15, Transp) ma1color2 := color.rgb(243, 243, 243, Transp) ma2color2 := color.rgb(231, 231, 231, Transp) ma3color2 := color.rgb(219, 219, 219, Transp) ma4color2 := color.rgb(207, 207, 207, Transp) ma5color2 := color.rgb(195, 195, 195, Transp) ma6color2 := color.rgb(183, 183, 183, Transp) ma7color2 := color.rgb(171, 171, 171, Transp) ma8color2 := color.rgb(159, 159, 159, Transp) ma9color2 := color.rgb(147, 147, 147, Transp) ma10color2 := color.rgb(135, 135, 135, Transp) ma11color2 := color.rgb(123, 123, 123, Transp) ma12color2 := color.rgb(111, 111, 111, Transp) ma13color2 := color.rgb(99, 99, 99, Transp) ma14color2 := color.rgb(87, 87, 87, Transp) ma15color2 := color.rgb(75, 75, 75, Transp) ma16color2 := color.rgb(63, 63, 63, Transp) ma17color2 := color.rgb(51, 51, 51, Transp) ma18color2 := color.rgb(39, 39, 39, Transp) ma19color2 := color.rgb(27, 27, 27, Transp) ma20color2 := color.rgb(15, 15, 15, Transp) if ColorStyle == "G" ma1color1 := color.rgb(15, 15, 15, Transp) ma2color1 := color.rgb(27, 27, 27, Transp) ma3color1 := color.rgb(39, 39, 39, Transp) ma4color1 := color.rgb(51, 51, 51, Transp) ma5color1 := color.rgb(63, 63, 63, Transp) ma6color1 := color.rgb(75, 75, 75, Transp) ma7color1 := color.rgb(87, 87, 87, Transp) ma8color1 := color.rgb(99, 99, 99, Transp) ma9color1 := color.rgb(111, 111, 111, Transp) ma10color1 := color.rgb(123, 123, 123, Transp) ma11color1 := color.rgb(135, 135, 135, Transp) ma12color1 := color.rgb(147, 147, 147, Transp) ma13color1 := color.rgb(159, 159, 159, Transp) ma14color1 := color.rgb(171, 171, 171, Transp) ma15color1 := color.rgb(183, 183, 183, Transp) ma16color1 := color.rgb(195, 195, 195, Transp) ma17color1 := color.rgb(207, 207, 207, Transp) ma18color1 := color.rgb(219, 219, 219, Transp) ma19color1 := color.rgb(231, 231, 231, Transp) ma20color1 := color.rgb(243, 243, 243, Transp) ma1color2 := color.rgb(15, 15, 15, Transp) ma2color2 := color.rgb(27, 27, 27, Transp) ma3color2 := color.rgb(39, 39, 39, Transp) ma4color2 := color.rgb(51, 51, 51, Transp) ma5color2 := color.rgb(63, 63, 63, Transp) ma6color2 := color.rgb(75, 75, 75, Transp) ma7color2 := color.rgb(87, 87, 87, Transp) ma8color2 := color.rgb(99, 99, 99, Transp) ma9color2 := color.rgb(111, 111, 111, Transp) ma10color2 := color.rgb(123, 123, 123, Transp) ma11color2 := color.rgb(135, 135, 135, Transp) ma12color2 := color.rgb(147, 147, 147, Transp) ma13color2 := color.rgb(159, 159, 159, Transp) ma14color2 := color.rgb(171, 171, 171, Transp) ma15color2 := color.rgb(183, 183, 183, Transp) ma16color2 := color.rgb(195, 195, 195, Transp) ma17color2 := color.rgb(207, 207, 207, Transp) ma18color2 := color.rgb(219, 219, 219, Transp) ma19color2 := color.rgb(231, 231, 231, Transp) ma20color2 := color.rgb(243, 243, 243, Transp) //////////////////////////////////////////////////////////////////////////////// // MA PLOTS // //////////////////////////////////////////////////////////////////////////////// plot(MAdisplay >= 1 ? MA1 : na, title="MA1" , color = Source > MA1 ? ma1color1 : ma1color2 , linewidth = MAwidth) plot(MAdisplay >= 2 ? MA2 : na, title="MA2" , color = Source > MA2 ? ma2color1 : ma2color2 , linewidth = MAwidth) plot(MAdisplay >= 3 ? MA3 : na, title="MA3" , color = Source > MA3 ? ma3color1 : ma3color2 , linewidth = MAwidth) plot(MAdisplay >= 4 ? MA4 : na, title="MA4" , color = Source > MA4 ? ma4color1 : ma4color2 , linewidth = MAwidth) plot(MAdisplay >= 5 ? MA5 : na, title="MA5" , color = Source > MA5 ? ma5color1 : ma5color2 , linewidth = MAwidth) plot(MAdisplay >= 6 ? MA6 : na, title="MA6" , color = Source > MA6 ? ma6color1 : ma6color2 , linewidth = MAwidth) plot(MAdisplay >= 7 ? MA7 : na, title="MA7" , color = Source > MA7 ? ma7color1 : ma7color2 , linewidth = MAwidth) plot(MAdisplay >= 8 ? MA8 : na, title="MA8" , color = Source > MA8 ? ma8color1 : ma8color2 , linewidth = MAwidth) plot(MAdisplay >= 9 ? MA9 : na, title="MA9" , color = Source > MA9 ? ma9color1 : ma9color2 , linewidth = MAwidth) plot(MAdisplay >= 10 ? MA10 : na, title="MA10", color = Source > MA10 ? ma10color1 : ma10color2, linewidth = MAwidth) plot(MAdisplay >= 11 ? MA11 : na, title="MA11", color = Source > MA11 ? ma11color1 : ma11color2, linewidth = MAwidth) plot(MAdisplay >= 12 ? MA12 : na, title="MA12", color = Source > MA12 ? ma12color1 : ma12color2, linewidth = MAwidth) plot(MAdisplay >= 13 ? MA13 : na, title="MA13", color = Source > MA13 ? ma13color1 : ma13color2, linewidth = MAwidth) plot(MAdisplay >= 14 ? MA14 : na, title="MA14", color = Source > MA14 ? ma14color1 : ma14color2, linewidth = MAwidth) plot(MAdisplay >= 15 ? MA15 : na, title="MA15", color = Source > MA15 ? ma15color1 : ma15color2, linewidth = MAwidth) plot(MAdisplay >= 16 ? MA16 : na, title="MA16", color = Source > MA16 ? ma16color1 : ma16color2, linewidth = MAwidth) plot(MAdisplay >= 17 ? MA17 : na, title="MA17", color = Source > MA17 ? ma17color1 : ma17color2, linewidth = MAwidth) plot(MAdisplay >= 18 ? MA18 : na, title="MA18", color = Source > MA18 ? ma18color1 : ma18color2, linewidth = MAwidth) plot(MAdisplay >= 19 ? MA19 : na, title="MA19", color = Source > MA19 ? ma19color1 : ma19color2, linewidth = MAwidth) plot(MAdisplay >= 20 ? MA20 : na, title="MA20", color = Source > MA20 ? ma20color1 : ma20color2, linewidth = MAwidth) L1 = MAdisplay >= 1 ? label.new(bar_index, MA1 , color=color.rgb(0, 0, 0, 100), text=tostring(MAtype) + " " + tostring(ma1length) , textcolor=Source > MA1 ? ma1color1 : ma1color2 , size=size.small, style=label.style_label_left) : na L2 = MAdisplay >= 2 ? label.new(bar_index, MA2 , color=color.rgb(0, 0, 0, 100), text=tostring(MAtype) + " " + tostring(ma2length) , textcolor=Source > MA2 ? ma2color1 : ma2color2 , size=size.small, style=label.style_label_left) : na L3 = MAdisplay >= 3 ? label.new(bar_index, MA3 , color=color.rgb(0, 0, 0, 100), text=tostring(MAtype) + " " + tostring(ma3length) , textcolor=Source > MA3 ? ma3color1 : ma3color2 , size=size.small, style=label.style_label_left) : na L4 = MAdisplay >= 4 ? label.new(bar_index, MA4 , color=color.rgb(0, 0, 0, 100), text=tostring(MAtype) + " " + tostring(ma4length) , textcolor=Source > MA4 ? ma4color1 : ma4color2 , size=size.small, style=label.style_label_left) : na L5 = MAdisplay >= 5 ? label.new(bar_index, MA5 , color=color.rgb(0, 0, 0, 100), text=tostring(MAtype) + " " + tostring(ma5length) , textcolor=Source > MA5 ? ma5color1 : ma5color2 , size=size.small, style=label.style_label_left) : na L6 = MAdisplay >= 6 ? label.new(bar_index, MA6 , color=color.rgb(0, 0, 0, 100), text=tostring(MAtype) + " " + tostring(ma6length) , textcolor=Source > MA6 ? ma6color1 : ma6color2 , size=size.small, style=label.style_label_left) : na L7 = MAdisplay >= 7 ? label.new(bar_index, MA7 , color=color.rgb(0, 0, 0, 100), text=tostring(MAtype) + " " + tostring(ma7length) , textcolor=Source > MA7 ? ma7color1 : ma7color2 , size=size.small, style=label.style_label_left) : na L8 = MAdisplay >= 8 ? label.new(bar_index, MA8 , color=color.rgb(0, 0, 0, 100), text=tostring(MAtype) + " " + tostring(ma8length) , textcolor=Source > MA8 ? ma8color1 : ma8color2 , size=size.small, style=label.style_label_left) : na L9 = MAdisplay >= 9 ? label.new(bar_index, MA9 , color=color.rgb(0, 0, 0, 100), text=tostring(MAtype) + " " + tostring(ma9length) , textcolor=Source > MA9 ? ma9color1 : ma9color2 , size=size.small, style=label.style_label_left) : na L10 = MAdisplay >= 10 ? label.new(bar_index, MA10, color=color.rgb(0, 0, 0, 100), text=tostring(MAtype) + " " + tostring(ma10length), textcolor=Source > MA10 ? ma10color1 : ma10color2, size=size.small, style=label.style_label_left) : na L11 = MAdisplay >= 11 ? label.new(bar_index, MA11, color=color.rgb(0, 0, 0, 100), text=tostring(MAtype) + " " + tostring(ma11length), textcolor=Source > MA11 ? ma11color1 : ma11color2, size=size.small, style=label.style_label_left) : na L12 = MAdisplay >= 12 ? label.new(bar_index, MA12, color=color.rgb(0, 0, 0, 100), text=tostring(MAtype) + " " + tostring(ma12length), textcolor=Source > MA12 ? ma12color1 : ma12color2, size=size.small, style=label.style_label_left) : na L13 = MAdisplay >= 13 ? label.new(bar_index, MA13, color=color.rgb(0, 0, 0, 100), text=tostring(MAtype) + " " + tostring(ma13length), textcolor=Source > MA13 ? ma13color1 : ma13color2, size=size.small, style=label.style_label_left) : na L14 = MAdisplay >= 14 ? label.new(bar_index, MA14, color=color.rgb(0, 0, 0, 100), text=tostring(MAtype) + " " + tostring(ma14length), textcolor=Source > MA14 ? ma14color1 : ma14color2, size=size.small, style=label.style_label_left) : na L15 = MAdisplay >= 15 ? label.new(bar_index, MA15, color=color.rgb(0, 0, 0, 100), text=tostring(MAtype) + " " + tostring(ma15length), textcolor=Source > MA15 ? ma15color1 : ma15color2, size=size.small, style=label.style_label_left) : na L16 = MAdisplay >= 16 ? label.new(bar_index, MA16, color=color.rgb(0, 0, 0, 100), text=tostring(MAtype) + " " + tostring(ma16length), textcolor=Source > MA16 ? ma16color1 : ma16color2, size=size.small, style=label.style_label_left) : na L17 = MAdisplay >= 17 ? label.new(bar_index, MA17, color=color.rgb(0, 0, 0, 100), text=tostring(MAtype) + " " + tostring(ma17length), textcolor=Source > MA17 ? ma17color1 : ma17color2, size=size.small, style=label.style_label_left) : na L18 = MAdisplay >= 18 ? label.new(bar_index, MA18, color=color.rgb(0, 0, 0, 100), text=tostring(MAtype) + " " + tostring(ma18length), textcolor=Source > MA18 ? ma18color1 : ma18color2, size=size.small, style=label.style_label_left) : na L19 = MAdisplay >= 19 ? label.new(bar_index, MA19, color=color.rgb(0, 0, 0, 100), text=tostring(MAtype) + " " + tostring(ma19length), textcolor=Source > MA19 ? ma19color1 : ma19color2, size=size.small, style=label.style_label_left) : na L20 = MAdisplay >= 20 ? label.new(bar_index, MA20, color=color.rgb(0, 0, 0, 100), text=tostring(MAtype) + " " + tostring(ma20length), textcolor=Source > MA20 ? ma20color1 : ma20color2, size=size.small, style=label.style_label_left) : na label.delete(L1[1]) label.delete(L2[1]) label.delete(L3[1]) label.delete(L4[1]) label.delete(L5[1]) label.delete(L6[1]) label.delete(L7[1]) label.delete(L8[1]) label.delete(L9[1]) label.delete(L10[1]) label.delete(L11[1]) label.delete(L12[1]) label.delete(L13[1]) label.delete(L14[1]) label.delete(L15[1]) label.delete(L16[1]) label.delete(L17[1]) label.delete(L18[1]) label.delete(L19[1]) label.delete(L20[1]) // USE LOOPS WHEREVER POSSIBLE! // if ColorStyle == "E" // ma1color1 := color.rgb(0, 255, 255, Transp) // ma2color1 := color.rgb(0, 191, 255, Transp) // ma3color1 := color.rgb(0, 127, 255, Transp) // ma4color1 := color.rgb(0, 64, 255, Transp) // ma5color1 := color.rgb(0, 0, 255, Transp) // ma6color1 := color.rgb(64, 0, 255, Transp) // ma7color1 := color.rgb(127, 0, 255, Transp) // ma8color1 := color.rgb(191, 0, 255, Transp) // ma9color1 := color.rgb(255, 0, 127, Transp) // ma10color1 := color.rgb(255, 0, 64, Transp) // ma11color1 := color.rgb(255, 0, 0, Transp) // ma12color1 := color.rgb(255, 64, 0, Transp) // ma13color1 := color.rgb(255, 127, 0, Transp) // ma14color1 := color.rgb(255, 191, 0, Transp) // ma15color1 := color.rgb(255, 255, 0, Transp) // ma16color1 := color.rgb(191, 255, 0, Transp) // ma17color1 := color.rgb(127, 255, 0, Transp) // ma18color1 := color.rgb(64, 255, 0, Transp) // ma19color1 := color.rgb(0, 255, 0, Transp) // ma20color1 := color.rgb(0, 255, 64, Transp)
Volatility Percentile
https://www.tradingview.com/script/aqBvF37z-Volatility-Percentile/
Trendoscope
https://www.tradingview.com/u/Trendoscope/
363
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © HeWhoMustNotBeNamed // __ __ __ __ __ __ __ __ __ __ __ _______ __ __ __ // / | / | / | _ / |/ | / \ / | / | / \ / | / | / \ / \ / | / | // $$ | $$ | ______ $$ | / \ $$ |$$ |____ ______ $$ \ /$$ | __ __ _______ _$$ |_ $$ \ $$ | ______ _$$ |_ $$$$$$$ | ______ $$ \ $$ | ______ _____ ____ ______ ____$$ | // $$ |__$$ | / \ $$ |/$ \$$ |$$ \ / \ $$$ \ /$$$ |/ | / | / |/ $$ | $$$ \$$ | / \ / $$ | $$ |__$$ | / \ $$$ \$$ | / \ / \/ \ / \ / $$ | // $$ $$ |/$$$$$$ |$$ /$$$ $$ |$$$$$$$ |/$$$$$$ |$$$$ /$$$$ |$$ | $$ |/$$$$$$$/ $$$$$$/ $$$$ $$ |/$$$$$$ |$$$$$$/ $$ $$< /$$$$$$ |$$$$ $$ | $$$$$$ |$$$$$$ $$$$ |/$$$$$$ |/$$$$$$$ | // $$$$$$$$ |$$ $$ |$$ $$/$$ $$ |$$ | $$ |$$ | $$ |$$ $$ $$/$$ |$$ | $$ |$$ \ $$ | __ $$ $$ $$ |$$ | $$ | $$ | __ $$$$$$$ |$$ $$ |$$ $$ $$ | / $$ |$$ | $$ | $$ |$$ $$ |$$ | $$ | // $$ | $$ |$$$$$$$$/ $$$$/ $$$$ |$$ | $$ |$$ \__$$ |$$ |$$$/ $$ |$$ \__$$ | $$$$$$ | $$ |/ |$$ |$$$$ |$$ \__$$ | $$ |/ |$$ |__$$ |$$$$$$$$/ $$ |$$$$ |/$$$$$$$ |$$ | $$ | $$ |$$$$$$$$/ $$ \__$$ | // $$ | $$ |$$ |$$$/ $$$ |$$ | $$ |$$ $$/ $$ | $/ $$ |$$ $$/ / $$/ $$ $$/ $$ | $$$ |$$ $$/ $$ $$/ $$ $$/ $$ |$$ | $$$ |$$ $$ |$$ | $$ | $$ |$$ |$$ $$ | // $$/ $$/ $$$$$$$/ $$/ $$/ $$/ $$/ $$$$$$/ $$/ $$/ $$$$$$/ $$$$$$$/ $$$$/ $$/ $$/ $$$$$$/ $$$$/ $$$$$$$/ $$$$$$$/ $$/ $$/ $$$$$$$/ $$/ $$/ $$/ $$$$$$$/ $$$$$$$/ // // // //@version=5 indicator("Volatility Percentile", overlay=false) import HeWhoMustNotBeNamed/enhanced_ta/10 as eta amatype = input.string("sma", title="Type", group="ATR", options=["sma", "ema", "hma", "rma", "wma", "vwma", "swma", "linreg", "median"]) amalength = input.int(20, title="Length", group="ATR") roundingType = input.string("round", title="Rounding Type", group="ATR", options=["round", "floor", "ceil"]) precision = input.int(2, group="ATR", minval=0, maxval=2) displayLowerPercentile = input.bool(false, "Inverse", group="Display", inline="b") displayStatsTable = input.bool(true, "Stats", group="Display", inline="b") displayDetailedStats = input.bool(false, 'Detailed Stats', group="Display", inline="b") textSize = input.string(size.small, title='Text Size', options=[size.tiny, size.small, size.normal, size.large, size.huge], group='Table', inline='text') headerColor = input.color(color.maroon, title='Header', group='Table', inline='GC') neutralColor = input.color(#FFEEBB, title='Cell', group='Table', inline='GC') presentColor = input.color(color.aqua, title='Present', group='Table', inline='GC') useStartTime = input.bool(false, title='Start Time', group='Window', inline="start") startTime = input.time(defval=timestamp('01 Jan 2010 00:00 +0000'), title='', group='Window', inline='start') useEndTime = input.bool(false, title='End Time ', group='Window', inline="end") endTime = input.time(defval=timestamp('01 Jan 2099 00:00 +0000'), title='', group='Window', inline='end') inDateRange = (not useStartTime or time >= startTime) and (not useEndTime or time <= endTime) precisionMultiplier = int(math.pow(10, precision)) var pArray = array.new_int(100*precisionMultiplier, 0) float percentile = na color cellColor = color.blue if(inDateRange) var dateStart = str.tostring(year) + '/' + str.tostring(month) + '/' + str.tostring(dayofmonth) dateEnd = str.tostring(year) + '/' + str.tostring(month) + '/' + str.tostring(dayofmonth) atrpercent = eta.atrpercent(amatype, amalength) index = roundingType == "round"? math.round(atrpercent*precisionMultiplier) : roundingType == "floor"? math.floor(atrpercent*precisionMultiplier) : math.ceil(atrpercent*precisionMultiplier) if(index > 0) array.set(pArray, index, array.get(pArray, index)+1) upperPortion = array.slice(pArray, index+1, array.size(pArray)) lowerPortion = array.slice(pArray, 0, index) total = array.sum(pArray) upper = array.sum(upperPortion) lower = array.sum(lowerPortion) same = array.get(pArray, index) upperPercentile = (total-upper)*100/total lowerPercentile = (total-lower)*100/total cumulativeCount = 0 medianIndex = 0 maxIndex = 0 for i=0 to array.size(pArray)-1 cumulativeCount += array.get(pArray, i) if(cumulativeCount < total/2) medianIndex := i+1 if(cumulativeCount == total) maxIndex := i break medianAtrPercent = medianIndex/precisionMultiplier maxAtrPercent = maxIndex/precisionMultiplier medianAndMax = array.join(array.from(str.tostring(medianAtrPercent, format.percent), str.tostring(maxAtrPercent, format.percent)), ' / ') displayTable = table.new(position=position.bottom_right, columns=2, rows=3, border_width=1) cellColor := color.from_gradient(upperPercentile, 0, 100, displayLowerPercentile? color.red : color.green, displayLowerPercentile ? color.green : color.red) percentile := displayLowerPercentile? lowerPercentile : upperPercentile table.cell(table_id=displayTable, column=0, row=0, text='ATR Percent', bgcolor=color.teal, text_color=color.white, text_size=textSize) table.cell(table_id=displayTable, column=1, row=0, text=str.tostring(atrpercent, format.percent), bgcolor=cellColor, text_color=color.white, text_size=textSize) table.cell(table_id=displayTable, column=0, row=1, text='Median/Max', bgcolor=color.teal, text_color=color.white, text_size=textSize) table.cell(table_id=displayTable, column=1, row=1, text=medianAndMax, bgcolor=cellColor, text_color=color.white, text_size=textSize) table.cell(table_id=displayTable, column=0, row=2, text='Percentile', bgcolor=color.teal, text_color=color.white, text_size=textSize) table.cell(table_id=displayTable, column=1, row=2, text=str.tostring(percentile, format.percent), bgcolor=cellColor, text_color=color.white, text_size=textSize) if(displayDetailedStats and total!=0) detailedTable = table.new(position=position.middle_center, columns=21, rows=10, border_width=1) table.cell(table_id=detailedTable, column=0, row=0, text=dateStart + ' to ' + dateEnd, bgcolor=color.teal, text_color=color.white, text_size=textSize) table.cell(table_id=detailedTable, column=0, row=1, text=syminfo.tickerid, bgcolor=color.teal, text_color=color.white, text_size=textSize) headerArray = array.new_string() valueArray = array.new_string() cellColorArray = array.new_color() for i=0 to 99 end = math.min((i+1)*precisionMultiplier, array.size(pArray)) slice = array.slice(pArray, 0, end) count = array.sum(slice) row = math.floor(i/10) col = (i%10) * 2 + 1 if (count != 0) percent = count*100/total headerText = '0 - ' + str.tostring(end/precisionMultiplier) cColor = math.floor(index/precisionMultiplier) == i ? presentColor : neutralColor array.push(headerArray, headerText) array.push(valueArray, str.tostring(percent, format.percent)) array.push(cellColorArray, cColor) if(count == total) break rowCol = math.ceil(math.sqrt(array.size(headerArray))) counter = 0 for i=0 to rowCol-1 for j=0 to rowCol-1 row = i col = j*2 + 1 if(counter >= array.size(headerArray)) break table.cell(table_id=detailedTable, column=col, row=row, text=array.get(headerArray, counter), bgcolor=headerColor, text_color=color.white, text_size=textSize) table.cell(table_id=detailedTable, column=col + 1, row=row, text=array.get(valueArray, counter), bgcolor=array.get(cellColorArray, counter), text_color=color.black, text_size=textSize) counter += 1 plot(displayDetailedStats? na : percentile, title="Historical Volatility Percentile", color=cellColor)
DCA Bot Indicator
https://www.tradingview.com/script/YKq8DFmW-DCA-Bot-Indicator/
TheSocialCryptoClub
https://www.tradingview.com/u/TheSocialCryptoClub/
112
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © TheSocialCryptoClub //@version=5 indicator("DCA Bot Indicator", overlay=true) hour_long = input.int(defval=2, minval=0, maxval=23, title="Buy on (after) hour: ", group="Buy Daily", tooltip="Use this and as the Script runs at the close of the bar of that time, if you would like to enter at 2, put here 1") day_long_1 = input.int(defval=0, minval=0, maxval=31, title="Buy only on Day of Month: ", group="Buy Monthly", tooltip="Use 0 to buy all days or specify a day of the month") dow_filter_long_1 = input.bool(true, group="Buy Days of the Week", title="1. Sunday") dow_filter_long_2 = input.bool(true, group="Buy Days of the Week", title="2. Monday") dow_filter_long_3 = input.bool(true, group="Buy Days of the Week", title="3. Tuesday") dow_filter_long_4 = input.bool(true, group="Buy Days of the Week", title="4. Wednesday") dow_filter_long_5 = input.bool(true, group="Buy Days of the Week", title="5. Thursday") dow_filter_long_6 = input.bool(true, group="Buy Days of the Week", title="6. Friday") dow_filter_long_7 = input.bool(true, group="Buy Days of the Week", title="7. Saturday") alert = input.string(defval="Hello from TheSocialCrypto!", title="Alert Message", tooltip="Use this to customize the message") dow_filter_long_condition = (dow_filter_long_1 and dayofweek == 1) or (dow_filter_long_2 and dayofweek == 2) or (dow_filter_long_3 and dayofweek == 3) or (dow_filter_long_4 and dayofweek == 4) or (dow_filter_long_5 and dayofweek == 5) or (dow_filter_long_6 and dayofweek == 6) or (dow_filter_long_7 and dayofweek == 7) dom_filter_long_condition = (day_long_1 == 0) ? true : (day_long_1 == dayofmonth) ? true : false color color_bg = na if hour_long == hour and dow_filter_long_condition and dom_filter_long_condition alert(alert) color_bg := color.new(color.green, 25) bgcolor(color_bg)
MACD Objective Breakouts + Alerts
https://www.tradingview.com/script/44FqtEFy-MACD-Objective-Breakouts-Alerts/
JustDamion
https://www.tradingview.com/u/JustDamion/
151
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © JustDamion // Last Updated: 9/6/2022 //@version=5 indicator(title="MACD Objective Breakouts + Alerts", shorttitle="MOB Alerts", overlay=true) // MACD Settings var g_MACD = "MACD Settings" checkRDiv = input.bool(title="Regular Divergence Detection", defval=true, group=g_MACD, tooltip="When true this will check for regular bullish and bearish divergence based on the levels detected by the indicator.") checkHDiv = input.bool(title="Hidden Divergence Detection", defval=false, group=g_MACD, tooltip="When true this will check for hidden bullish and bearish divergence based on the levels detected by the indicator.") minHistBars = input.int(title="Minimum Histogram Bars", defval=1, minval=1, group=g_MACD, tooltip="The histogram will need to stay one color for this many bars to determine a new low or high.") fast = input.int(title="Fast Length", defval=12, minval=1, group=g_MACD, tooltip="Value used to calculate MACD line.") slow = input.int(title="Slow Length", defval=26, minval=1, group=g_MACD, tooltip="Value used to calculate MACD line.") signalLength = input.int(title="Signal Length", defval=9, minval=1, group=g_MACD, tooltip="This smooths the signal line, higher values = less volitility.") macdLine = input.string(title="MACD MA Type", options=['SMA', 'EMA', 'WMA', 'VWMA'], defval='EMA', group=g_MACD, tooltip="Type of moving average used to calculate MACD line.") signalLine = input.string(title="Signal MA Type", options=['SMA', 'EMA', 'WMA', 'VWMA'], defval='EMA', group=g_MACD, tooltip="Type of moving average used to calculate signal line.") source = input.source(title="Source", defval=close, group=g_MACD, tooltip="Source used to generate MACD.") // Alert Settings var g_alerts = "Alert Settings" a_closeCheck = input.bool(title="Only On Close Outside of Level", defval=true, group=g_alerts, tooltip="When checked, you will receive an alert when a bar closes outside of a key level.\n\nWhen unchecked, you will receive an alert when price touches a key level.") a_firstCheck = input.bool(title="Only First Breakout Candle", defval=true, group=g_alerts, tooltip="Wheck checked, you will only receive an alert on the first bar that activates an alert until new levels are formed.\n\nWhen unchecked, you will receive an alert everytime a bar activates an alert.") a_divCheck = input.bool(title="Only Divergence Breakouts", defval=false, group=g_alerts, tooltip="When checked, you will only receive an alert after divergence has been detected.") a_longCheck = input.bool(title="Long Breakouts", defval=false, group=g_alerts, tooltip="Will generate alert when candle closes above upper line.") a_longMsg = input.string(title="    Alert Message", defval="MOB: Long Breakout!", group=g_alerts, tooltip="Message that will be sent when long breakout occurs.") a_shortCheck = input.bool(title="Short Breakouts", defval=false, group=g_alerts, tooltip="Will generate alert when candle closes below lower line.") a_shortMsg = input.string(title="    Alert Message", defval="MOB: Short Breakout!", group=g_alerts, tooltip="Message that will be sent when short breakout occurs.") // Style Settings var g_style = "Style Settings" shapeCheck = input.bool(title="Plot Shapes On Breakouts", defval=true, group=g_style, tooltip="Plots shapes to indicate a close above or below key levels.") lineCheck = input.bool(title="Plot Lines at Key Levels", defval=true, group=g_style, tooltip="Plots horizontal lines at the current key levels.") highColor = input.color(title="Upper Line", defval=color.green, group=g_style, tooltip="Sets the color of the upper line.") lowColor = input.color(title="Lower Line", defval=color.red, group=g_style, tooltip="Sets the color of the lower line.") lineWidth = input.int(title="Line Width", minval=1, defval=1, group=g_style, tooltip="Changes the width of the lines.") // Calculate MACD line fastMA = ta.ema(source, fast) slowMA = ta.ema(source, slow) switch macdLine "WMA" => fastMA := ta.wma(source, fast) slowMA := ta.wma(source, slow) "SMA" => fastMA := ta.sma(source, fast) slowMA := ta.sma(source, slow) "EMA" => fastMA := ta.ema(source, fast) slowMA := ta.ema(source, slow) "VWMA" => fastMA := ta.vwma(source, fast) slowMA := ta.vwma(source, slow) macd = fastMA - slowMA // Calculate signal line signal = ta.ema(macd, signalLength) switch signalLine "WMA" => signal := ta.wma(macd, signalLength) "SMA" => signal := ta.sma(macd, signalLength) "EMA" => signal := ta.ema(macd, signalLength) "VWMA" => signal := ta.vwma(macd, signalLength) // Set variables for key levels var arrayHigh = array.new_float(0) var arrayLow = array.new_float(0) var histValues = array.new_float(0) array.push(arrayHigh, na) array.push(arrayLow, na) array.push(histValues, na) var line lineHigh = line.new(x1=bar_index[1], y1=na, x2=bar_index, y2=na, color=lineCheck ? highColor : na, width=lineWidth, extend=extend.both) var line lineLow = line.new(x1=bar_index[1], y1=na, x2=bar_index, y2=na, color=lineCheck ? lowColor : na, width=lineWidth, extend=extend.both) var float priceHigh = na var float lastPriceHigh = na var float priceLow = na var float lastPriceLow = na var float histHigh = na var float lastHistHigh = na var float histLow = na var float lastHistLow = na var bool bullDiv = na var bool bearDiv = na var bool hBullDiv = na var bool hBearDiv = na var barCount = 0 // Push values to arrays if macd > signal and barstate.isconfirmed array.push(arrayHigh, high) array.push(histValues, macd - signal) if macd < signal and barstate.isconfirmed array.push(arrayLow, low) array.push(histValues, macd - signal) // Detect new key levels if ta.crossunder(macd, signal) and array.size(histValues)-1 > minHistBars lastPriceHigh := priceHigh lastHistHigh := histHigh priceHigh := array.max(arrayHigh) histHigh := array.max(histValues) array.clear(arrayHigh) array.clear(histValues) line.set_y1(lineHigh, priceHigh) line.set_y2(lineHigh, priceHigh) bearDiv := priceHigh > lastPriceHigh and histHigh < lastHistHigh and checkRDiv hBearDiv := priceHigh < lastPriceHigh and histHigh > lastHistHigh and checkHDiv barCount := 0 if ta.crossover(macd, signal) and array.size(histValues)-1 > minHistBars lastPriceLow := priceLow lastHistLow := histLow priceLow := array.min(arrayLow) histLow := array.min(histValues) array.clear(arrayLow) array.clear(histValues) line.set_y1(lineLow, priceLow) line.set_y2(lineLow, priceLow) bullDiv := priceLow < lastPriceLow and histLow > lastHistLow and checkRDiv hBullDiv := priceLow > lastPriceLow and histLow < lastHistLow and checkHDiv barCount := 0 // Count breakout bars if (close >= priceHigh or close <= priceLow) and barstate.isconfirmed barCount += 1 // Plot shapes to indicate breakouts plotshape(close >= priceHigh and barstate.isconfirmed and shapeCheck and barCount==1, title="First Long Breakout", style=shape.diamond, location=location.belowbar, color=bullDiv or hBullDiv ? color.white : color.green) plotshape(close <= priceLow and barstate.isconfirmed and shapeCheck and barCount==1, title="First Short Breakout", style=shape.diamond, location=location.abovebar, color=bearDiv or hBearDiv ? color.white : color.red) plotshape(close >= priceHigh and barstate.isconfirmed and shapeCheck and barCount>1, title="Long Breakout", style=shape.triangleup, location=location.belowbar, color=color.green) plotshape(close <= priceLow and barstate.isconfirmed and shapeCheck and barCount>1, title="Short Breakout", style=shape.triangledown, location=location.abovebar, color=color.red) // Generate long alerts if close >= priceHigh and (a_closeCheck and barstate.isconfirmed) and a_longCheck and (barCount == 1 or a_firstCheck==false) and (bullDiv or a_divCheck==false) and (hBullDiv or a_divCheck==false) alert(a_longMsg, alert.freq_once_per_bar_close) // Generate short alerts if close <= priceLow and (a_closeCheck and barstate.isconfirmed) and a_shortCheck and (barCount == 1 or a_firstCheck==false) and (bearDiv or a_divCheck==false) and (hBearDiv or a_divCheck==false) alert(a_shortMsg, alert.freq_once_per_bar_close)
ADX and DI+ v4.5 Optimized
https://www.tradingview.com/script/MjEMMgWa-ADX-and-DI-v4-5-Optimized/
bharatc99
https://www.tradingview.com/u/bharatc99/
71
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // @imbharat- This formula plots VWMA(ADX) vs EMA(DI+) under given timeframe. // Strategy is to look for potential BUY opportunity when EMA(DI+) colored blue, entering upward into green zone where ADX counterpart (Default: Yellow) is also present. // Originally developed by © BeikabuOyaji and further optimized by Bharat @imbharat //@version=4 study("ADX and DI+ v4.5 Optimized") len = input(7) th = input(20) TrueRange = max(max(high-low, abs(high-nz(close[1]))), abs(low-nz(close[1]))) DirectionalMovementPlus = high-nz(high[1]) > nz(low[1])-low ? max(high-nz(high[1]), 0): 0 DirectionalMovementMinus = nz(low[1])-low > high-nz(high[1]) ? max(nz(low[1])-low, 0): 0 SmoothedTrueRange = 0.0 SmoothedTrueRange := nz(SmoothedTrueRange[1]) - (nz(SmoothedTrueRange[1])/len) + TrueRange SmoothedDirectionalMovementPlus = 0.0 SmoothedDirectionalMovementPlus := nz(SmoothedDirectionalMovementPlus[1]) - (nz(SmoothedDirectionalMovementPlus[1])/len) + DirectionalMovementPlus SmoothedDirectionalMovementMinus = 0.0 SmoothedDirectionalMovementMinus := nz(SmoothedDirectionalMovementMinus[1]) - (nz(SmoothedDirectionalMovementMinus[1])/len) + DirectionalMovementMinus DIPlus = SmoothedDirectionalMovementPlus / SmoothedTrueRange * 100 DIMinus = SmoothedDirectionalMovementMinus / SmoothedTrueRange * 100 DX = abs(DIPlus-DIMinus) / (DIPlus+DIMinus)*100 ADX = sma(DX, len) //plot(DIPlus, color=color.green, title="DI+") //plot(DIMinus, color=color.red, title="DI-") //plot(ADX, color=color.navy, title="ADX") hline(th, color=color.black) //indicator(title="Moving Average Exponential", shorttitle="EMA", overlay=true, timeframe="", timeframe_gaps=true) len2 = input(35, minval=1, title="EMA Length") offset2 = 0 //input(title="EMA Offset", defval=0, minval=-500, maxval=500) out2 = ema(DIPlus, len2) plot(out2, title="EMA of ADX_DIPlus", color=color.blue, offset=offset2) out3 = vwma(ADX, len2) plot(out3, title="VWMA of ADX", color=color.yellow, offset=offset2) upperAdx = 80 medianAdx = 65 lowerAdx = 25 upperx = hline( upperAdx, "Extreme ADX", color.new( color.silver, 60 ) ) upper = hline( medianAdx, "High ADX", color.new( color.silver, 80 ) ) lower = hline( lowerAdx, "Normal ADX", color.new( color.silver, 80 ) ) lowerx = hline( 5, "Low ADX", color.new( color.silver, 60 ) ) // channel fill fill( upperx, upper, color.new( color.red, 85 ), title = "Avoid" ) fill( upper, lower, color.new( color.green, 85 ), title = "TREND UNDERWAY" ) fill( lower, lowerx, color.new( color.red, 85 ), title = "Avoid" )
Velocity, Acceleration, Jerk
https://www.tradingview.com/script/cxNsplIM-Velocity-Acceleration-Jerk/
dwoodbrey15
https://www.tradingview.com/u/dwoodbrey15/
95
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © dwoodbrey15 //@version=5 indicator("Velocity, Acceleration, Jerk") Length = input(50) v = ta.change(close, Length) a = ta.change(v, Length) j = ta.change(a, Length) plot(j, "Jerk", color=#7e57c2, style=plot.style_columns, transp=25) plot(a, "Acceleration", color=#26c6da, style=plot.style_columns, transp=25) plot(v, "Velocity", color=#f7525f, style=plot.style_columns, transp=25) hline(0, color=color.white)
Z Score (Close + High and Low bands)
https://www.tradingview.com/script/sjJl1Yy6-Z-Score-Close-High-and-Low-bands/
sp3ed
https://www.tradingview.com/u/sp3ed/
58
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © sp3ed //@version=5 indicator('Z Score (Close + High and Low)', 'Z Score') length = input(34) src = input(hlcc4) z = (src - ta.ema(src, length)) / ta.stdev(src, length) z_low = (low - ta.ema(src, length)) / ta.stdev(src, length) z_high = (high - ta.ema(src, length)) / ta.stdev(src, length) stdev = input(2) gradient = color.from_gradient(z, -1, 1, color.new(#e91e63, 0), color.new(#4caf50, 0)) c = plot(z, color=gradient, linewidth=2) l = plot(z_low, color=na) h = plot(z_high, color=na) fill(l, h, color.new(gradient, 70)) h0 = hline(0, linestyle=hline.style_dotted, color=color.new(color.gray, 0)) h_upper = hline(stdev, linestyle=hline.style_dotted, color=color.new(color.gray, 0)) h_lower = hline(-stdev, linestyle=hline.style_dotted, color=color.new(color.gray, 0))
Consensio V2 - Directionality Indicator
https://www.tradingview.com/script/JfmYV1I0-Consensio-V2-Directionality-Indicator/
Ben_Neumann
https://www.tradingview.com/u/Ben_Neumann/
54
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © bneumann //@version=5 indicator("Consensio Directionality Indicator") //Inputs p = input(1, "Price") s = input(7, "STMA") l = input(30, "LTMA") //Create SMA's price = ta.sma(close, p) stma = ta.sma(close, s) ltma = ta.sma(close, l) //Get Moving Average Direction get_direction(ma, length) => highest = ma[1] lowest = ma[1] for i = 1 to length if highest < ma[i] highest := ma[i] if lowest > ma[i] lowest := ma[i] if ma > highest 2 else if ma < lowest 0 else 1 //Calculate directionality directionality = (get_direction(ltma, l)*9)+(get_direction(stma, s)*3)+(get_direction(price, p))-13 //Plot Directionality plot(directionality, "Dirctionality") //Background greenTop = hline(13, "Upper Band") greenBottom = hline(5, "Lower Band") fill(greenTop, greenBottom, color.new(color.green, 70), "Background") yellowTop = hline(5, "Upper Band") yellowBottom = hline(0, "Lower Band") fill(yellowTop, yellowBottom, color.new(color.yellow, 70), "Background") orangeTop = hline(0, "Upper Band") orangeBottom = hline(-5, "Lower Band") fill(orangeTop, orangeBottom, color.new(color.orange, 70), "Background") redTop = hline(-5, "Upper Band") redBottom = hline(-13, "Lower Band") fill(redTop, redBottom, color.new(color.red, 70), "Background")
Stablecoin Dominance
https://www.tradingview.com/script/Lxh1wQsN-Stablecoin-Dominance/
lysergik
https://www.tradingview.com/u/lysergik/
562
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © lysergik //@version=5 // ______ __ __ __ __ _______ __ // / \ / | / | / | / | / \ / | // /$$$$$$ _$$ |_ ______ $$ |____ $$ | ______ _______ ______ $$/ _______ $$$$$$$ | ______ _____ ____ $$/ _______ ______ _______ _______ ______ // $$ \__$$/ $$ | / \$$ \$$ |/ \ / |/ \/ / \ $$ | $$ |/ \/ \/ \/ / \ / \/ \ / |/ \ // $$ $$$$$$/ $$$$$$ $$$$$$$ $$ /$$$$$$ /$$$$$$$//$$$$$$ $$ $$$$$$$ | $$ | $$ /$$$$$$ $$$$$$ $$$$ $$ $$$$$$$ |$$$$$$ $$$$$$$ /$$$$$$$//$$$$$$ | // $$$$$$ |$$ | __ / $$ $$ | $$ $$ $$ $$ $$ | $$ | $$ $$ $$ | $$ | $$ | $$ $$ | $$ $$ | $$ | $$ $$ $$ | $$ |/ $$ $$ | $$ $$ | $$ $$ | // / \__$$ |$$ |/ /$$$$$$$ $$ |__$$ $$ $$$$$$$$/$$ \_____$$ \__$$ $$ $$ | $$ | $$ |__$$ $$ \__$$ $$ | $$ | $$ $$ $$ | $$ /$$$$$$$ $$ | $$ $$ \_____$$$$$$$$/ // $$ $$/ $$ $$/$$ $$ $$ $$/$$ $$ $$ $$ $$/$$ $$ | $$ | $$ $$/$$ $$/$$ | $$ | $$ $$ $$ | $$ $$ $$ $$ | $$ $$ $$ | // $$$$$$/ $$$$/ $$$$$$$/$$$$$$$/ $$/ $$$$$$$/ $$$$$$$/ $$$$$$/ $$/$$/ $$/ $$$$$$$/ $$$$$$/ $$/ $$/ $$/$$/$$/ $$/ $$$$$$$/$$/ $$/ $$$$$$$/ $$$$$$$/ // version=1.5 indicator(title="Aggregated Stablecoin Dominance", shorttitle="AggrStableDom", format=format.percent, precision=3) //-- Data Sources --\\ usdt = request.security('USDT.D', timeframe.period, close) usdc = request.security('USDC.D', timeframe.period, close) busd = request.security('(BUSD_MARKETCAP*100)/CRYPTOCAP:TOTAL', timeframe.period, close) dai = request.security('DAI.D', timeframe.period, close) usdt_o = request.security('USDT.D', timeframe.period, open) usdc_o = request.security('USDC.D', timeframe.period, open) busd_o = request.security('(BUSD_MARKETCAP*100)/CRYPTOCAP:TOTAL', timeframe.period, open) dai_o = request.security('DAI.D', timeframe.period, open) usdt_h = request.security('USDT.D', timeframe.period, high) usdc_h = request.security('USDC.D', timeframe.period, high) busd_h = request.security('(BUSD_MARKETCAP*100)/CRYPTOCAP:TOTAL', timeframe.period, high) dai_h = request.security('DAI.D', timeframe.period, high) usdt_l = request.security('USDT.D', timeframe.period, low) usdc_l = request.security('USDC.D', timeframe.period, low) busd_l = request.security('(BUSD_MARKETCAP*100)/CRYPTOCAP:TOTAL', timeframe.period, low) dai_l = request.security('DAI.D', timeframe.period, low) //-- User Inputs --\\ include_usdt = input.bool(true, 'Include USDT', group='Total Dominance') include_usdc = input.bool(true, 'Include USDC', group='Total Dominance') include_busd = input.bool(true, 'Include BUSD', group='Total Dominance') include_dai = input.bool(true, 'Include DAI', group='Total Dominance') darkMode = input.bool(true, 'Dark Mode', group='Swag') miniTable = input.bool(false, 'Mini-Table', group='Swag') col = input.bool(true, 'MA Color Fill', group='Swag') colInvert = input.bool(false, 'Invert MA Coloring', group='Swag') use_candles = input.bool(false, 'Show Candles', group='Swag') heikin = input.bool(true, 'Heikin Candles', group='Swag') use_fma = input.bool(true, 'Show Fast Moving Average', group='Moving Averages') use_sma = input.bool(true, 'Show Slow Moving Average', group='Moving Averages') predict_ema = input.bool(true, 'Show MA Prediction', group='Moving Averages') f_length = input.int(21, 'Fast MA Length', minval=2, group='Moving Averages') s_length = input.int(50, 'Slow MA Length', minval=2, group='Moving Averages') ema = input.bool(true, 'Use EMA instead of SMA', group='Moving Averages') bb = input.bool(false, 'Use Bollinger Bands', group='Bollinger Bands') length = input.int(21, minval=1, group='Bollinger Bands') mult = input.float(2.618, minval=0.001, maxval=50, group='Bollinger Bands') // Base Colors text_col = darkMode ? color.white : color.black back_col = darkMode ? color.black : color.white faded_col = darkMode ? color.gray : color.rgb(73, 75, 82) //-- Pure Functions --\\ allFalse(_array) => out = true for _bool in _array if _bool out := false isBelow(_v1, _v2) => out =_v1 < _v2 ma(_type, _src, _len) => if _type == "SMA" ta.sma(_src, _len) else if _type == "EMA" ta.ema(_src, _len) ma_prediction(_type, _src, _period, _offset) => (ma(_type, _src, _period - _offset) * (_period - _offset) + _src * _offset) / _period //-- Math --\\ include = array.new_bool(4,na) array.insert(include, 0, include_usdt) array.insert(include, 1, include_usdc) array.insert(include, 2, include_busd) array.insert(include, 3, include_dai) totalDom = 0.00 totalDom_o = 0.00 totalDom_h = 0.00 totalDom_l = 0.00 i=0 for boolean in include if boolean switch i 0 => totalDom += usdt totalDom_o += usdt_o totalDom_h += usdt_h totalDom_l += usdt_l 1 => totalDom += usdc totalDom_o += usdc_o totalDom_h += usdc_h totalDom_l += usdc_l 2 => totalDom += busd totalDom_o += busd_o totalDom_h += busd_h totalDom_l += busd_l 3 => totalDom += dai totalDom_o += dai_o totalDom_h += dai_h totalDom_l += dai_l i += 1 // Candles src(_src) => Close = not heikin ? totalDom : math.avg(totalDom_o, totalDom_h, totalDom_l, totalDom) Open = float(na) Open := not heikin ? totalDom_o : na(Open[1]) ? (totalDom_o + totalDom) / 2 : (nz(Open[1]) + nz(Close[1])) / 2 High = not heikin ? totalDom_h : math.max(totalDom_h, math.max(Open, Close)) Low = not heikin ? totalDom_l : math.min(totalDom_l, math.min(Open, Close)) HL2 = not heikin ? math.avg(totalDom_l, totalDom_h) : math.avg(High, Low) HLC3 = not heikin ? math.avg(totalDom_l, totalDom_h, totalDom) : math.avg(High, Low, Close) OHLC4 = not heikin ? math.avg(totalDom_o, totalDom_h, totalDom_l, totalDom) : math.avg(Open, High, Low, Close) Price = _src == 'close' ? Close : _src == 'open' ? Open : _src == 'high' ? High : _src == 'low' ? Low : _src == 'hl2' ? HL2 : _src == 'hlc3' ? HLC3 : OHLC4 Source = math.round(Price / syminfo.mintick) * syminfo.mintick // PineCoders method for aligning Pine prices with chart instrument prices // Bollinger-Bands src = math.avg(totalDom_h,totalDom_l,totalDom) basis = ta.vwma(src, length) dev = mult * ta.stdev(src, length) upper_1= basis + (0.236*dev) upper_2= basis + (0.382*dev) upper_3= basis + (0.5*dev) upper_4= basis + (0.618*dev) upper_5= basis + (0.768*dev) upper_6= basis + (1*dev) lower_1= basis - (0.236*dev) lower_2= basis - (0.382*dev) lower_3= basis - (0.5*dev) lower_4= basis - (0.618*dev) lower_5= basis - (0.768*dev) lower_6= basis - (1*dev) fMA = 0.00 sMA = 0.00 string predict_type = "EMA" if ema fMA := ta.ema(totalDom, f_length) sMA := ta.ema(totalDom, s_length) predict_type := "EMA" else fMA := ta.sma(totalDom, f_length) sMA := ta.sma(totalDom, s_length) predict_type := "SMA" longemapredictor_1 = ma_prediction(predict_type, totalDom, s_length, 1) longemapredictor_2 = ma_prediction(predict_type, totalDom, s_length, 2) longemapredictor_3 = ma_prediction(predict_type, totalDom, s_length, 3) longemapredictor_4 = ma_prediction(predict_type, totalDom, s_length, 4) longemapredictor_5 = ma_prediction(predict_type, totalDom, s_length, 5) shortemapredictor_1 = ma_prediction(predict_type, totalDom, f_length, 1) shortemapredictor_2 = ma_prediction(predict_type, totalDom, f_length, 2) shortemapredictor_3 = ma_prediction(predict_type, totalDom, f_length, 3) shortemapredictor_4 = ma_prediction(predict_type, totalDom, f_length, 4) shortemapredictor_5 = ma_prediction(predict_type, totalDom, f_length, 5) //-- Logic & Color-- \\ bool totalBull = ta.change(totalDom) > 0 bool usdtBull = ta.change(usdt) > 0 bool usdcBull = ta.change(usdc) > 0 bool busdBull = ta.change(busd) > 0 bool daiBull = ta.change(dai) > 0 bool slowIsBelow = sMA < fMA bool isBullish = totalDom <= fMA bool allDisabled = allFalse(include) bool isProbCrypto = syminfo.basecurrency != '' string total_disp = not allDisabled ? str.format('{0}%', totalDom) : '-' string usdt_disp = include_usdt ? str.format('{0}%', usdt) : '-' string usdc_disp = include_usdc ? str.format('{0}%', usdc) : '-' string busd_disp = include_busd ? str.format('{0}%', busd) : '-' string dai_disp = include_dai ? str.format('{0}%', dai) : '-' color fastFill_col = not colInvert ? (isBullish and col ? color.rgb(0,255,0,70) : not isBullish and col ? color.rgb(255,0,0,70) : na) : (isBullish and col ? color.rgb(255,0,0,70) : not isBullish and col ? color.rgb(0,255,0,70) : na) color slowFill_col = not colInvert ? (slowIsBelow and col ? color.new(color.purple,75) : not slowIsBelow and col ? color.new(color.aqua,75) : na) : (slowIsBelow and col ? color.new(color.aqua,75) : not slowIsBelow and col ? color.new(color.purple,75) : na) if not isProbCrypto fastFill_col := color.gray slowFill_col := color.gray //-- Front-End --\\ f_plot = plot(use_fma ? fMA : na, 'Fast Moving Average', color=col ? color.black : color.blue, linewidth=2) s_plot = plot(use_sma ? sMA : na, 'Slow Moving Average', color=text_col, linewidth=2) dom_plot = plot(totalDom, 'Combined Dominance', color=use_candles ? na : text_col, trackprice=true) barColor = not use_candles ? na : src('close') >= src('open') ? color.purple : color.teal plotcandle(src('open'), src('high'), src('low'), src('close'), 'Candles', color=barColor, wickcolor=not use_candles ? na : color.new(text_col, 50), bordercolor=na) fill(dom_plot, f_plot, color=fastFill_col) fill(f_plot, s_plot, color=slowFill_col) plot(bb ? basis : na, color=text_col, linewidth=2, style=plot.style_stepline) p1 = plot(bb ? upper_1 : na, color=text_col, linewidth=1, title="0.236", display=display.none) p2 = plot(bb ? upper_2 : na, color=color.aqua, linewidth=1, title="0.382", display=display.none) p3 = plot(bb ? upper_3 : na, color=text_col, linewidth=1, title="0.5", display=display.none) p4 = plot(bb ? upper_4 : na, color=color.orange, linewidth=1, title="0.618") p5 = plot(bb ? upper_5 : na, color=text_col, linewidth=1, title="0.768", display=display.none) p6 = plot(bb ? upper_6 : na, color=faded_col, linewidth=2, title="1") p13 = plot(bb ? lower_1 : na, color=text_col, linewidth=1, title="0.236", display=display.none) p14 = plot(bb ? lower_2 : na, color=color.aqua, linewidth=1, title="0.382", display=display.none) p15 = plot(bb ? lower_3 : na, color=text_col, linewidth=1, title="0.5", display=display.none) p16 = plot(bb ? lower_4 : na, color=color.orange, linewidth=1, title="0.618") p17 = plot(bb ? lower_5 : na, color=text_col, linewidth=1, title="0.768", display=display.none) p18 = plot(bb ? lower_6 : na, color=faded_col, linewidth=2, title="1") plot(predict_ema and use_sma ? longemapredictor_1 : na, color=isBelow(shortemapredictor_1, longemapredictor_1) ? text_col : faded_col, linewidth=2, style=plot.style_cross, offset=1, show_last=1, editable=false) plot(predict_ema and use_sma ? longemapredictor_2 : na, color=isBelow(shortemapredictor_2, longemapredictor_2) ? text_col : faded_col, linewidth=2, style=plot.style_cross, offset=2, show_last=1, editable=false) plot(predict_ema and use_sma ? longemapredictor_3 : na, color=isBelow(shortemapredictor_3, longemapredictor_3) ? text_col : faded_col, linewidth=2, style=plot.style_cross, offset=3, show_last=1, editable=false) plot(predict_ema and use_sma ? longemapredictor_4 : na, color=isBelow(shortemapredictor_4, longemapredictor_4) ? text_col : faded_col, linewidth=2, style=plot.style_cross, offset=4, show_last=1, editable=false) plot(predict_ema and use_sma ? longemapredictor_5 : na, color=isBelow(shortemapredictor_5, longemapredictor_5) ? text_col : faded_col, linewidth=2, style=plot.style_cross, offset=5, show_last=1, editable=false) plot(predict_ema and use_fma ? shortemapredictor_1 : na, color=isBelow(shortemapredictor_1, longemapredictor_1) ? color.aqua : color.purple, linewidth=2, style=plot.style_cross, offset=1, show_last=1, editable=false) plot(predict_ema and use_fma ? shortemapredictor_2 : na, color=isBelow(shortemapredictor_2, longemapredictor_2) ? color.aqua : color.purple, linewidth=2, style=plot.style_cross, offset=2, show_last=1, editable=false) plot(predict_ema and use_fma ? shortemapredictor_3 : na, color=isBelow(shortemapredictor_3, longemapredictor_3) ? color.aqua : color.purple, linewidth=2, style=plot.style_cross, offset=3, show_last=1, editable=false) plot(predict_ema and use_fma ? shortemapredictor_4 : na, color=isBelow(shortemapredictor_4, longemapredictor_4) ? color.aqua : color.purple, linewidth=2, style=plot.style_cross, offset=4, show_last=1, editable=false) plot(predict_ema and use_fma ? shortemapredictor_5 : na, color=isBelow(shortemapredictor_5, longemapredictor_5) ? color.aqua : color.purple, linewidth=2, style=plot.style_cross, offset=5, show_last=1, editable=false) // Barstate-Triggered Tasks var line realLine = na varip lineVis = false if use_candles and ((lineVis == false and not barstate.isconfirmed) or (barstate.isrealtime and barstate.islast and not barstate.isconfirmed)) line.delete(id=realLine) realLine := line.new(x1=bar_index[1], y1=totalDom, x2=bar_index, y2=totalDom, width=1, extend=extend.both) line.set_color(id=realLine, color=totalDom > totalDom_o ? color.purple : totalDom < totalDom_o ? color.teal : text_col) line.set_style(id=realLine, style=line.style_dashed) if barstate.isconfirmed line.delete(id=realLine) lineVis := false // Table & Warning Label var label L1 = na var table TA_Display = table.new(position.bottom_right, 14, 5) if barstate.islast label.delete(L1) if not isProbCrypto L1 := label.new(bar_index, totalDom, '', color=color.yellow, style=label.style_label_lower_left, textcolor=color.black) label.set_text(L1, 'Accuracy Warning') label.set_tooltip(L1, 'On markets that do not have 24h continuous data, historical data displayed on this indicator is likely inaccurate.') if allDisabled or miniTable table.cell(TA_Display, 0, 0, 'TOTAL', text_color=text_col, text_size=size.auto, bgcolor=back_col) table.cell(TA_Display, 1, 0, total_disp, text_color=totalBull ? color.red : color.green, text_size=size.auto, bgcolor=back_col) else table.cell(TA_Display, 0, 0, 'TOTAL', text_color=text_col, text_size=size.auto, bgcolor=back_col) table.cell(TA_Display, 1, 0, total_disp, text_color=totalBull ? color.red : color.green, text_size=size.auto, bgcolor=back_col) table.cell(TA_Display, 0, 1, 'USDT', text_color=text_col, text_size=size.auto, bgcolor=back_col) table.cell(TA_Display, 1, 1, usdt_disp, text_color=usdtBull ? color.red : color.green, text_size=size.auto, bgcolor=back_col) table.cell(TA_Display, 0, 2, 'USDC', text_color=text_col, text_size=size.auto, bgcolor=back_col) table.cell(TA_Display, 1, 2, usdc_disp, text_color=usdcBull ? color.red : color.green, text_size=size.auto, bgcolor=back_col) table.cell(TA_Display, 0, 3, 'BUSD', text_color=text_col, text_size=size.auto, bgcolor=back_col) table.cell(TA_Display, 1, 3, busd_disp, text_color=busdBull ? color.red : color.green, text_size=size.auto, bgcolor=back_col) table.cell(TA_Display, 0, 4, 'DAI', text_color=text_col, text_size=size.auto, bgcolor=back_col) table.cell(TA_Display, 1, 4, dai_disp, text_color=daiBull ? color.red : color.green, text_size=size.auto, bgcolor=back_col)
Fusion: Forex sessions with daylight savings
https://www.tradingview.com/script/AJ3H9l93-Fusion-Forex-sessions-with-daylight-savings/
Koalems
https://www.tradingview.com/u/Koalems/
164
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Koalems // @version=5 // *************************************************************************************************** // // // CREDITS // // // *************************************************************************************************** // Blended my own sessions indicator and "FX Market Sessions" by boidoki // *************************************************************************************************** // // // CONSTANTS // // // *************************************************************************************************** var colorTransparent = color.new(color.white, 100) var maxBoxes = 500 var maxLabels = 500 // *************************************************************************************************** // // // TYPE // // // *************************************************************************************************** indicator( title = 'Fusion: Forex sessions with daylight savings', shorttitle = 'Fusion: Fx Sessions', max_boxes_count = maxBoxes, max_labels_count = maxLabels, overlay = true) // *************************************************************************************************** // // // INPUTS // // // *************************************************************************************************** TooltipTimezones = 'https://en.wikipedia.org/wiki/List_of_tz_database_time_zones' // *************************************************************************************************** // 7000 Inputs - Indicator: Session // *************************************************************************************************** Group7000 = '7000 Show' sessionsShow = input.bool(true, group=Group7000, title='Sessions') sessionsShowOnMainChart = input.bool(true, group=Group7000, title='  On main chart', tooltip="If you are on the main chart then make sure this is checked.\n\nWhen you want to use this separate from your main chart ucheck it.\n\nOn the main chart we can show:\n* The legend\n* Boxes\n* Labels\n* Breakout check area\n* Start & end labels\n\nOn any other chart we can show:\n* The legend\n* Horizontal bars representing the sessions.\n\nAll objects are color coded and the legend shows the color codes.") sessShow = sessionsShow and timeframe.isintraday and timeframe.multiplier <= 60 and timeframe.multiplier >= 3 sessShowBox = input.bool(true, group=Group7000, title='  Boxes') and sessShow and sessionsShowOnMainChart sessShowLabel = input.bool(true, group=Group7000, title='  Labels') and sessShow and sessionsShowOnMainChart sessShowOpeningRange = input.bool(false, group=Group7000, title='  Breakout check area') and sessShow and sessionsShowOnMainChart sessShowSessionEnds = input.bool(false, group=Group7000, title='  Start/end labels') and sessShow and sessionsShowOnMainChart sessLedgendShow = input.bool(false, group=Group7000, title="  Show legend") and sessShow sessLedgendTransparency = input.bool(true, group=Group7000, title="    Legend match translucency") sessFrankfurtColor = input.color(#7e57c2, group=Group7000, inline="SRS1", title="Color") sessFrankfurtShow = input.bool(true, group=Group7000, inline="SRS1", title="Frankfurt") sessLondonColor = input.color(#4caf50, group=Group7000, inline="SRS2", title='Color') sessLondonShow = input.bool(true, group=Group7000, inline="SRS2", title="London") sessNewYorkColor = input.color(#f44336, group=Group7000, inline="SRS3", title="Color") sessNewYorkShow = input.bool(true, group=Group7000, inline="SRS3", title="New York") sessSydneyColor = input.color(#00bcd4, group=Group7000, inline="SRS4", title="Color") sessSydneyShow = input.bool(true, group=Group7000, inline="SRS4", title="Sydney") sessTokyoColor = input.color(#f57f17, group=Group7000, inline="SRS5", title="Color") sessTokyoShow = input.bool(true, group=Group7000, inline="SRS5", title="Tokyo") sessTransparency = input.int(45, group=Group7000, title="Transparency") sessLineWidth = input.int(20, group=Group7000, title="Line width") sessLedgendLocation = input.string("Bottom Left", group=Group7000, title="Legend location", options=["Top Left", "Top Center", "Top Right", "Middle Left", "Middle Center", "Middle Right", "Bottom Left", "Bottom Center", "Bottom Right"]) // *************************************************************************************************** // Inputs - Indicator: Session - DETAILS // *************************************************************************************************** // When using Timezones the form GMT+n does not take daylight savings into account however the form // "America/Phoenix" does. This is why our input for the timezone variables like "sessSydneyTz" are // strings like "Australia/Sydney", i.e., we don't have to worry about daylight savings ourselves. Group7020 = '7020 Session: Frankfurt' sessFrankfurtLabel = input.string('Frankfurt', group=Group7020, title='Label') sessFrankfurtTz = input.string('Europe/Berlin', group=Group7020, title='Timezone', tooltip=TooltipTimezones) sessFrankfurtPeriod = input.session('0800-1601', group=Group7020, title='Period') Group7030 = '7030 Session: London' sessLondonLabel = input.string('London', group=Group7030, title='Label') sessLondonTz = input.string('Europe/London', group=Group7030, title='Timezone', tooltip=TooltipTimezones) sessLondonPeriod = input.session('0800-1601', group=Group7030, title='Period') Group7040 = '7040 Session: New York' sessNewYorkLabel = input.string('New York', group=Group7040, title='Label') sessNewYorkTz = input.string('America/New_York', group=Group7040, title='Timezone', tooltip=TooltipTimezones) sessNewYorkPeriod = input.session('0800-1601', group=Group7040, title='Period') Group7050 = '7050 Session: Sydney' sessSydneyLabel = input.string('Sydney', group=Group7050, title='Label') sessSydneyTz = input.string('Australia/Sydney', group=Group7050, title='Timezone', tooltip=TooltipTimezones) sessSydneyPeriod = input.session('0800-1601', group=Group7050, title='Period') Group7060 = '7060 Session: Tokyo' sessTokyoLabel = input.string('Tokyo', group=Group7060, title='Label') sessTokyoTz = input.string('Asia/Tokyo', group=Group7060, title='Timezone', tooltip=TooltipTimezones) sessTokyoPeriod = input.session('0800-1601', group=Group7060, title='Period') Group7070 = '7070 Session: Show & Styles' sessRectLineStyle = input.string(line.style_dashed, group=Group7070, title='Line style', options=[line.style_solid, line.style_dotted, line.style_dashed]) sessRectLineWidth = input.int(1, group=Group7070, minval=1, title='Line width') sessLabelSize = input.string(size.normal, group=Group7070, title='Label size', options=[size.auto, size.tiny, size.small, size.normal, size.large, size.huge]) sessShowBgColor = input.bool(true, group=Group7070, title='Background colors') sessRectBgOpacity = input.int(94, group=Group7070, minval=0, maxval=100, step=1, title='Background opacity') Group7080 = '7080 Session: Opening Range' sessLookBackOrMins = input.int(30, group=Group7080, minval=1, step=1, title='Breakout - start gap', tooltip='Minutes') // *************************************************************************************************** // // // INDICATOR // // // *************************************************************************************************** // Constants var sessLookbackMins = 12 * 60 var sessLookbackOrBars = math.floor(sessLookBackOrMins / timeframe.multiplier) // Functions IsInSession(session) => IsInSession = not na(session) IsInSession TableLocation(loc) => loc == 'Top Left' ? position.top_left : loc == 'Top Center' ? position.top_center : loc == 'Top Right' ? position.top_right : loc == 'Middle Left' ? position.middle_left : loc == 'Middle Center' ? position.middle_center : loc == 'Middle Right' ? position.middle_right : loc == 'Bottom Left' ? position.bottom_left : loc == 'Bottom Center' ? position.bottom_center : loc == 'Bottom Right' ? position.bottom_right : na CreateSessionRect(sessionTime, sessionDuration, labelText, col, sessShow) => bool result = false bool shouldBeDelete = false bool is_inSession = IsInSession(sessionTime) if is_inSession result := true int minsLen = math.round(sessionDuration / timeframe.multiplier) int begin_index = 0 for i = 1 to minsLen by 1 if not na(sessionTime[i]) begin_index += 1 begin_index int pR = bar_index int pL = bar_index - begin_index float pT = 0 float pB = high for i = 1 to begin_index by 1 pT := math.max(high[i], pT) pB := math.min(low[i], pB) pB float range_1 = pT - pB var label line_label = na var box my_box = na if sessShowBox if not is_inSession[1] my_box := switch col sessFrankfurtColor => box.new(pR, pT, pL, pB, border_color=col, border_width=sessRectLineWidth, border_style=sessRectLineStyle, bgcolor=color.new(sessFrankfurtColor, 99)) sessLondonColor => box.new(pR, pT, pL, pB, border_color=col, border_width=sessRectLineWidth, border_style=sessRectLineStyle, bgcolor=color.new(sessLondonColor, 99)) sessNewYorkColor => box.new(pR, pT, pL, pB, border_color=col, border_width=sessRectLineWidth, border_style=sessRectLineStyle, bgcolor=color.new(sessNewYorkColor, 99)) sessSydneyColor => box.new(pR, pT, pL, pB, border_color=col, border_width=sessRectLineWidth, border_style=sessRectLineStyle, bgcolor=color.new(sessSydneyColor, 99)) sessTokyoColor => box.new(pR, pT, pL, pB, border_color=col, border_width=sessRectLineWidth, border_style=sessRectLineStyle, bgcolor=color.new(sessTokyoColor, 99)) => na if sessShow and is_inSession box.set_left(my_box, pL) box.set_right(my_box, pR) box.set_top(my_box, pT) box.set_bottom(my_box, pB) if shouldBeDelete box.delete(my_box[1]) if sessShow and sessShowLabel if not is_inSession[1] line_label := label.new(pL, pT, labelText, textcolor=col, color=colorTransparent, style=label.style_none, size=sessLabelSize, textalign=text.align_left) line_label if is_inSession label.set_xy(line_label, pL, pT) if shouldBeDelete label.delete(line_label[1]) result SetSessionHL(times, timesOrCalc) => float h = na float l = na h := times ? h[1] : na l := times ? l[1] : na if timesOrCalc for i = 0 to sessLookbackOrBars by 1 h := i == 0 ? high : math.max(high[i], h) l := i == 0 ? low : math.min(low[i], l) [h, l] MakeBreakoutCheckAreaBox(h, l, condition) => box b = na if condition b := box.new( bar_index, h, bar_index, l, border_color = color.new(color.silver, 50), border_width = 1, border_style = line.style_solid, bgcolor = color.new(color.silver, 94)) b AdjustBreakoutCheckAreaBox(B, h) => if not na(h) box.set_right(B, bar_index) // ********************************************************************** // MAIN // ********************************************************************** sessFrankfurtTimes = time(timeframe.period, sessFrankfurtPeriod, sessFrankfurtTz) sessLondonTimes = time(timeframe.period, sessLondonPeriod, sessLondonTz) sessNewYorkTimes = time(timeframe.period, sessNewYorkPeriod, sessNewYorkTz) sessSydneyTimes = time(timeframe.period, sessSydneyPeriod, sessSydneyTz) sessTokyoTimes = time(timeframe.period, sessTokyoPeriod, sessTokyoTz) sessFrankfurtTimesOrCalc = sessFrankfurtTimes[sessLookbackOrBars] and na(sessFrankfurtTimes[sessLookbackOrBars + 1]) sessLondonTimesOrCalc = sessLondonTimes[sessLookbackOrBars] and na(sessLondonTimes[sessLookbackOrBars + 1]) sessNewYorkTimesOrCalc = sessNewYorkTimes[sessLookbackOrBars] and na(sessNewYorkTimes[sessLookbackOrBars + 1]) sessSydneyTimesOrCalc = sessSydneyTimes[sessLookbackOrBars] and na(sessSydneyTimes[sessLookbackOrBars + 1]) sessTokyoTimesOrCalc = sessTokyoTimes[sessLookbackOrBars] and na(sessTokyoTimes[sessLookbackOrBars + 1]) [sessFrankfurt_h, sessFrankfurt_l] = SetSessionHL(sessFrankfurtTimes, sessFrankfurtTimesOrCalc) [sessLondon_h, sessLondon_l] = SetSessionHL(sessLondonTimes, sessLondonTimesOrCalc) [sessNewYork_h, sessNewYork_l] = SetSessionHL(sessNewYorkTimes, sessNewYorkTimesOrCalc) [sessSydney_h, sessSydney_l] = SetSessionHL(sessSydneyTimes, sessSydneyTimesOrCalc) [sessTokyo_h, sessTokyo_l] = SetSessionHL(sessTokyoTimes, sessTokyoTimesOrCalc) sessFrankfurtStarted = sessFrankfurtTimes and na(sessFrankfurtTimes[1]) sessLondonStarted = sessLondonTimes and na(sessLondonTimes[1]) sessNewYorkStarted = sessNewYorkTimes and na(sessNewYorkTimes[1]) sessSydneyStarted = sessSydneyTimes and na(sessSydneyTimes[1]) sessTokyoStarted = sessTokyoTimes and na(sessTokyoTimes[1]) sessFrankfurtEnded = na(sessFrankfurtTimes) and sessFrankfurtTimes[1] sessLondonEnded = na(sessLondonTimes) and sessLondonTimes[1] sessNewYorkEnded = na(sessNewYorkTimes) and sessNewYorkTimes[1] sessSydneyEnded = na(sessSydneyTimes) and sessSydneyTimes[1] sessTokyoEnded = na(sessTokyoTimes) and sessTokyoTimes[1] // Session end sessASessionEnded = sessFrankfurtEnded or sessLondonEnded or sessNewYorkEnded or sessSydneyEnded or sessTokyoEnded // We are in a session sessInSession = not na(sessFrankfurtTimes) or not na(sessLondonTimes) or not na(sessNewYorkTimes) or not na(sessSydneyTimes) or not na(sessTokyoTimes) // *************************************************************************************************** // // // SHOW // // // *************************************************************************************************** if sessLedgendShow var infoPos = TableLocation(sessLedgendLocation) var info = table.new( infoPos, 5, 1, frame_color = color.gray, frame_width = 1, border_color = color.black, border_width = 1) var transl = sessLedgendTransparency ? sessTransparency : 0 table.cell(info, 0, 0, 'Frankfurt', text_color=color.white, text_size=size.small, text_halign=text.align_left, bgcolor=color.new(sessFrankfurtColor , transl)) table.cell(info, 1, 0, 'London' , text_color=color.white, text_size=size.small, text_halign=text.align_left, bgcolor=color.new(sessLondonColor , transl)) table.cell(info, 2, 0, 'New York' , text_color=color.white, text_size=size.small, text_halign=text.align_left, bgcolor=color.new(sessNewYorkColor , transl)) table.cell(info, 3, 0, 'Sydney' , text_color=color.white, text_size=size.small, text_halign=text.align_left, bgcolor=color.new(sessSydneyColor , transl)) table.cell(info, 4, 0, 'Tokyo' , text_color=color.white, text_size=size.small, text_halign=text.align_left, bgcolor=color.new(sessTokyoColor , transl)) // *************************************************************************************************** // SHOW - On main chart // *************************************************************************************************** CreateSessionRect(sessFrankfurtTimes, sessLookbackMins, sessFrankfurtLabel, sessFrankfurtColor, sessShow and sessFrankfurtShow) CreateSessionRect(sessLondonTimes, sessLookbackMins, sessLondonLabel, sessLondonColor, sessShow and sessLondonShow) CreateSessionRect(sessNewYorkTimes, sessLookbackMins, sessNewYorkLabel, sessNewYorkColor, sessShow and sessNewYorkShow) CreateSessionRect(sessSydneyTimes, sessLookbackMins, sessSydneyLabel, sessSydneyColor, sessShow and sessSydneyShow) CreateSessionRect(sessTokyoTimes, sessLookbackMins, sessTokyoLabel, sessTokyoColor, sessShow and sessTokyoShow) if sessShowOpeningRange sessFrankfurtBox = MakeBreakoutCheckAreaBox(sessFrankfurt_h, sessFrankfurt_l, sessFrankfurtShow and sessFrankfurtTimes and sessFrankfurtTimesOrCalc) sessLondonBox = MakeBreakoutCheckAreaBox(sessLondon_h, sessLondon_l, sessLondonShow and sessLondonTimes and sessLondonTimesOrCalc) sessNewYorkBox = MakeBreakoutCheckAreaBox(sessNewYork_h, sessNewYork_l, sessNewYorkShow and sessNewYorkTimes and sessNewYorkTimesOrCalc) sessSydneyBox = MakeBreakoutCheckAreaBox(sessSydney_h, sessSydney_l, sessSydneyShow and sessSydneyTimes and sessSydneyTimesOrCalc) sessTokyoBox = MakeBreakoutCheckAreaBox(sessTokyo_h, sessTokyo_l, sessTokyoShow and sessTokyoTimes and sessTokyoTimesOrCalc) AdjustBreakoutCheckAreaBox(sessFrankfurtBox, sessFrankfurt_h) AdjustBreakoutCheckAreaBox(sessLondonBox, sessLondon_h) AdjustBreakoutCheckAreaBox(sessNewYorkBox, sessNewYork_h) AdjustBreakoutCheckAreaBox(sessSydneyBox, sessSydney_h) AdjustBreakoutCheckAreaBox(sessTokyoBox, sessTokyo_h) plotshape(sessShowSessionEnds and sessFrankfurtStarted and sessFrankfurtShow, color=color.new(sessFrankfurtColor, 45), text='Start', style=shape.labeldown, location=location.bottom, size=size.small, textcolor=color.white, title='Session start: Frankfurt') plotshape(sessShowSessionEnds and sessLondonStarted and sessLondonShow, color=color.new(sessLondonColor, 45), text='Start', style=shape.labeldown, location=location.bottom, size=size.small, textcolor=color.white, title='Session start: London') plotshape(sessShowSessionEnds and sessNewYorkStarted and sessNewYorkShow, color=color.new(sessNewYorkColor, 45), text='Start', style=shape.labeldown, location=location.bottom, size=size.small, textcolor=color.white, title='Session start: New York') plotshape(sessShowSessionEnds and sessSydneyStarted and sessSydneyShow, color=color.new(sessSydneyColor, 45), text='Start', style=shape.labeldown, location=location.bottom, size=size.small, textcolor=color.white, title='Session start: Sydney') plotshape(sessShowSessionEnds and sessTokyoStarted and sessTokyoShow, color=color.new(sessTokyoColor, 45), text='Start', style=shape.labeldown, location=location.bottom, size=size.small, textcolor=color.white, title='Session start: Tokyo') plotshape(sessShowSessionEnds and sessFrankfurtEnded and sessFrankfurtShow, color=color.new(sessFrankfurtColor, 45), text='End', style=shape.labeldown, location=location.bottom, size=size.small, textcolor=color.white, title='Session end: Frankfurt') plotshape(sessShowSessionEnds and sessLondonEnded and sessLondonShow, color=color.new(sessLondonColor, 45), text='End', style=shape.labeldown, location=location.bottom, size=size.small, textcolor=color.white, title='Session end: London') plotshape(sessShowSessionEnds and sessNewYorkEnded and sessNewYorkShow, color=color.new(sessNewYorkColor, 45), text='End', style=shape.labeldown, location=location.bottom, size=size.small, textcolor=color.white, title='Session end: New York') plotshape(sessShowSessionEnds and sessSydneyEnded and sessSydneyShow, color=color.new(sessSydneyColor, 45), text='End', style=shape.labeldown, location=location.bottom, size=size.small, textcolor=color.white, title='Session end: Sydney') plotshape(sessShowSessionEnds and sessTokyoEnded and sessTokyoShow, color=color.new(sessTokyoColor, 45), text='End', style=shape.labeldown, location=location.bottom, size=size.small, textcolor=color.white, title='Session end: Tokyo') // *************************************************************************************************** // SHOW - Off main chart // *************************************************************************************************** offMainChart = not sessionsShowOnMainChart and sessShow plot(sessFrankfurtShow and offMainChart ? (sessFrankfurtTimes ? 10 : na) : na, style=plot.style_linebr, linewidth=sessLineWidth, color=color.new(sessFrankfurtColor, sessTransparency), title="Frankfurt") plot(sessLondonShow and offMainChart ? (sessLondonTimes ? 8 : na) : na, style=plot.style_linebr, linewidth=sessLineWidth, color=color.new(sessLondonColor , sessTransparency), title="London") plot(sessNewYorkShow and offMainChart ? (sessNewYorkTimes ? 6 : na) : na, style=plot.style_linebr, linewidth=sessLineWidth, color=color.new(sessNewYorkColor, sessTransparency), title="New York") plot(sessSydneyShow and offMainChart ? (sessSydneyTimes ? 4 : na) : na, style=plot.style_linebr, linewidth=sessLineWidth, color=color.new(sessSydneyColor , sessTransparency), title="Sydney") plot(sessTokyoShow and offMainChart ? (sessTokyoTimes ? 2 : na) : na, style=plot.style_linebr, linewidth=sessLineWidth, color=color.new(sessTokyoColor , sessTransparency), title="Tokyo")
OBV+
https://www.tradingview.com/script/vb3tSX59-OBV/
DoctaBot
https://www.tradingview.com/u/DoctaBot/
334
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © DoctaBot //@version=5 indicator('OBV+ [DoctaBot]', overlay = false, format=format.volume, max_bars_back = 500) //----------//OBV//----------// OBV = ta.obv //----------//OBV MAs----------//{ ma_type = input.string(defval = 'EMA', title = 'MA Type ', options=['SMA', 'EMA', 'WMA', 'VWMA', 'SMMA', 'Hull MA', 'Triangular MA', 'SuperSmooth MA'], inline = 'MAs', group = 'MA Settings') ma_source = OBV // MA Lengths{ show_ma1 = input.bool(true, 'MA №1', inline = 'MA #1', group = 'MA Settings') ma1_length = input.int(21, '', inline = 'MA #1', minval=1, group = 'MA Settings') ma1_color = input.color(#f6c309, '', inline = 'MA #1', group = 'MA Settings') show_ma2 = input.bool(false, 'MA №2', inline = 'MA #2', group = 'MA Settings') ma2_length = input.int(50, '', inline = 'MA #2', minval=1, group = 'MA Settings') ma2_color = input.color(#fb9800, '', inline = 'MA #2', group = 'MA Settings') show_ma3 = input.bool(false, 'MA №3', inline = 'MA #1', group = 'MA Settings') ma3_length = input.int(99, '', inline = 'MA #1', minval=1, group = 'MA Settings') ma3_color = input.color(#fb6500, '', inline = 'MA #1', group = 'MA Settings') show_ma4 = input.bool(true, 'MA №4', inline = 'MA #2', group = 'MA Settings') ma4_length = input.int(200, '', inline = 'MA #2', minval=1, group = 'MA Settings') ma4_color = input.color(#f60c0c, '', inline = 'MA #2', group = 'MA Settings') //}} // SuperSmoother filter{ variant_supersmoother(source, length) => a1 = math.exp(-1.414 * 3.14159 / length) b1 = 2 * a1 * math.cos(1.414 * 3.14159 / length) c2 = b1 c3 = -a1 * a1 c1 = 1 - c2 - c3 v9 = 0.0 v9 := c1 * (source + nz(source[1])) / 2 + c2 * nz(v9[1]) + c3 * nz(v9[2]) v9 variant_smoothed(source, length) => v5 = 0.0 sma_1 = ta.sma(source, length) v5 := na(v5[1]) ? sma_1 : (v5[1] * (length - 1) + source) / length v5 // return variant, defaults to SMA variant(type, source, length) => ema_1 = ta.ema(source, length) wma_1 = ta.wma(source, length) vwma_1 = ta.vwma(source, length) variant_smoothed__1 = variant_smoothed(source, length) wma_2 = ta.wma(source, length / 2) wma_3 = ta.wma(source, length) wma_4 = ta.wma(2 * wma_2 - wma_3, math.round(math.sqrt(length))) variant_supersmoother__1 = variant_supersmoother(source, length) sma_1 = ta.sma(source, length) sma_2 = ta.sma(sma_1, length) sma_3 = ta.sma(source, length) type == 'EMA' ? ema_1 : type == 'WMA' ? wma_1 : type == 'VWMA' ? vwma_1 : type == 'SMMA' ? variant_smoothed__1 : type == 'Hull MA' ? wma_4 : type == 'SuperSmooth MA' ? variant_supersmoother__1 : type == 'Triangular MA' ? sma_2 : sma_3 ma1 = variant(ma_type, ma_source, ma1_length) ma2 = variant(ma_type, ma_source, ma2_length) ma3 = variant(ma_type, ma_source, ma3_length) ma4 = variant(ma_type, ma_source, ma4_length) //} //----------//Plots//----------// //{ OBVplot = plot(OBV, title = 'OBV', color=color.new(color.white, 0)) ma1plot = plot(show_ma1 ? ma1 : na, color=ma1_color, title = 'OBV MA1') ma2plot = plot(show_ma2 ? ma2 : na, color=ma2_color, title = 'OBV MA2') ma3plot = plot(show_ma3 ? ma3 : na, color=ma3_color, title = 'OBV MA3') ma4plot = plot(show_ma4 ? ma4 : na, color=ma4_color, title = 'OBV MA4') //} // Trend Fill //{ trendFill = input.bool(defval=true, title = '', inline = 'MA Trend1', group = 'Trend Settings') BullFill = input.color(color.green, 'Bull/Bear Fill', inline = 'MA Trend1', group = 'Trend Settings') BearFill = input.color(color.red, '', inline = 'MA Trend1', group = 'Trend Settings') OBVarraysize = input.int(defval = 20, title = 'Trend Strength Lookback', inline = 'MA Trend2', group = 'Trend Settings') var OBVSpreadArray = array.new_float() bool newbar = ta.change(time('')) != 0 OBVSpread = ma1 - ma4 //Shift (remove) last value from and add current value to array if newbar array.push(OBVSpreadArray, OBVSpread) if array.size(OBVSpreadArray) > OBVarraysize array.shift(OBVSpreadArray) OBVSpreadMax = array.max(OBVSpreadArray) OBVSpreadMin = array.min(OBVSpreadArray) OBVBullFill1 = color.new(BullFill, 60) OBVBullFill2 = color.new(BullFill, 80) OBVBearFill1 = color.new(BearFill, 60) OBVBearFill2 = color.new(BearFill, 80) OBVBullGrad = color.from_gradient(OBVSpread, OBVSpreadMin, OBVSpreadMax, OBVBullFill2, OBVBullFill1) OBVBearGrad = color.from_gradient(OBVSpread, OBVSpreadMin, OBVSpreadMax, OBVBearFill1, OBVBearFill2) OBVFillCol = OBV > ma4 ? OBVBullGrad : OBVBearGrad fill(OBVplot, ma4plot, color=trendFill ? OBVFillCol : na) //} //Divergences plotBull = input.bool(defval = true, title = 'Regular Bullish   ', group = 'Alert Options', inline = 'Divs1') plotBear = input.bool(defval = true, title = 'Regular Bearish', group = 'Alert Options', inline = 'Divs1') plotHiddenBull = input.bool(defval = true, title = 'Hidden Bullish   ', group = 'Alert Options', inline = 'Divs2') plotHiddenBear = input.bool(defval = true, title = 'Hidden Bearish', group = 'Alert Options', inline = 'Divs2') PotAlerts = input.bool(defval = true, title = 'Potential Divergences', group = 'Alert Options', inline = 'Divs3') plotDivLines = input.bool(defval = true, title = 'Plot Divergence Lines    ', group = 'Plot Options', inline = 'Plot1') plotDivLabels = input.bool(defval = true, title = 'Plot Divergence Labels', group = 'Plot Options', inline = 'Plot1') plotPotentials = input.bool(defval = true, title = 'Plot Potential Divergences', group = 'Plot Options', inline = 'Plot2') overlay_main = input(false, title = 'Plot on price', group = 'Plot Options', inline = 'Plot2', tooltip = 'rather than on indicator') osc = OBV rangeUpper = input.int(defval = 20, title = 'Max of Lookback Range', group = 'Divergence Settings') rangeLower = input.int(defval = 2, title = 'Min of Lookback Range', group = 'Divergence Settings', minval = 2) maxdivs = input.int(defval = 25, title = 'Max Divs to Show', group = 'Divergence Settings', minval = 1) lbR = 1 lbL = 1 bullColor = input.color(defval = color.new(color.green, 0), title = 'Reg Bull Color', group = 'Colors', inline = 'Colors1') bearColor = input.color(defval = color.new(color.red, 0), title = 'Reg Bear Color', group = 'Colors', inline = 'Colors1') hiddenBullColor = input.color(defval = color.new(color.green, 70), title = 'Hid Bull Color', group = 'Colors', inline = 'Colors2') hiddenBearColor = input.color(defval = color.new(color.red, 70), title = 'Hid Bear Color', group = 'Colors', inline = 'Colors2') textColor = color.new(color.white, 0) noneColor = color.new(color.white, 100) //} //Arrays{ //Line Arrays var URegBullDivLines = array.new_line() var UHidBullDivLines = array.new_line() var URegBearDivLines = array.new_line() var UHidBearDivLines = array.new_line() var RegBullDivLines = array.new_line() var HidBullDivLines = array.new_line() var RegBearDivLines = array.new_line() var HidBearDivLines = array.new_line() //Label Arrays var URegBullDivLabels = array.new_label() var UHidBullDivLabels = array.new_label() var URegBearDivLabels = array.new_label() var UHidBearDivLabels = array.new_label() var RegBullDivLabels = array.new_label() var HidBullDivLabels = array.new_label() var RegBearDivLabels = array.new_label() var HidBearDivLabels = array.new_label() //} //Load Pivots{ //Check Arrays are even to ensure Price and Bar values have been added properly f_checkPivArrays(float[] PriceArr, float[] OscArr, int[] BarsArr) => if array.size(PriceArr) != array.size(OscArr) or array.size(PriceArr) != array.size(BarsArr) or array.size(OscArr) != array.size(BarsArr) runtime.error('Array sizes are not equal!') //Load new Price, Osc, and Bar values into their respective arrays f_loadNewPivValues(float[] PriceArr, Price, float[] OscArr, Osc, int[] BarsArr, Bars) => f_checkPivArrays(PriceArr, OscArr, BarsArr) array.unshift(PriceArr, Price) array.unshift(OscArr, Osc) array.unshift(BarsArr, Bars) f_loadPivArrays() => phFound = na(ta.pivothigh(osc, lbL, lbR)) ? false : true plFound = na(ta.pivotlow(osc, lbL, lbR)) ? false : true //Declare Pivot High Arrays var PricePHArr = array.new_float() var OscPHArr = array.new_float() var BarPHArr = array.new_int() //Declare Pivot Low Arrays var PricePLArr = array.new_float() var OscPLArr = array.new_float() var BarPLArr = array.new_int() //Declare Pivot Values PricePH = math.max(open[lbR], close[lbR]) //ta.highest(close, lbR + 2) PricePL = math.min(open[lbR], close[lbR]) //ta.lowest(close, lbR + 2) //Load Pivot High Values into Arrays and remove pivots outside range lookback if phFound f_loadNewPivValues(PricePHArr, PricePH, OscPHArr, osc[lbR], BarPHArr, bar_index - lbR) if bar_index - array.min(BarPHArr) > rangeUpper array.pop(PricePHArr) array.pop(OscPHArr) array.pop(BarPHArr) //Load Pivot Low Values into Arrays and remove pivots outside range lookback if plFound f_loadNewPivValues(PricePLArr, PricePL, OscPLArr, osc[lbR], BarPLArr, bar_index - lbR) if bar_index - array.min(BarPLArr) > rangeUpper array.pop(PricePLArr) array.pop(OscPLArr) array.pop(BarPLArr) [PricePH, PricePL, phFound, plFound, PricePHArr, OscPHArr, BarPHArr, PricePLArr, OscPLArr, BarPLArr] //} //Get Divergences{ f_getDivergence(_plotOn, _divType, _divDir, _conf, line[]_DivLineArr, label[]_DivLabelArr)=> [PricePH, PricePL, phFound, plFound, PricePHArr, OscPHArr, BarPHArr, PricePLArr, OscPLArr, BarPLArr] = f_loadPivArrays() _OscArr = _divDir == 'Bull' ? OscPLArr : OscPHArr _PriceArr = _divDir == 'Bull' ? PricePLArr : PricePHArr _BarArr = _divDir == 'Bull' ? BarPLArr : BarPHArr ConfLineCol = _divDir == 'Bull' ? _divType == 'Regular' ? bullColor : hiddenBullColor : _divType == 'Regular' ? bearColor : hiddenBearColor PotLineCol = plotPotentials ? _divDir == 'Bull' ? _divType == 'Regular' ? bullColor : hiddenBullColor : _divType == 'Regular' ? bearColor : hiddenBearColor : noneColor LineColor = plotDivLines ? _conf ? ConfLineCol : PotLineCol : noneColor LineStyle = _conf ? line.style_solid : line.style_dashed LabColor = plotDivLabels ? _conf ? _divDir == 'Bull' ? bullColor : bearColor : plotPotentials ? _divDir == 'Bull' ? hiddenBullColor : hiddenBearColor : noneColor : noneColor LabStyle = _divDir == 'Bull' ? label.style_label_up : label.style_label_down LabTextCol = plotDivLabels ? _conf ? textColor : plotPotentials ? textColor : noneColor : noneColor IntLBStart = _conf ? lbR + 1 : 1 var line newDivLine = na var label newDivLabel = na DivCount = 0 OscEnd = _conf ? osc[1] : osc PriceEnd = _divDir == 'Bull' ? PricePL : PricePH BarEnd = _conf ? bar_index - 1 : bar_index LineEnd = overlay_main ? PriceEnd : OscEnd if array.size(_OscArr) > 0 for i = array.size(_OscArr) - 1 to 0 OscStart = array.get(_OscArr, i) PriceStart = array.get(_PriceArr, i) BarStart = array.get(_BarArr, i) LineStart = overlay_main ? PriceStart : OscStart oscH = OscEnd > OscStart oscL = OscEnd < OscStart PriceH = PriceEnd > PriceStart PriceL = PriceEnd < PriceStart DivLen = BarEnd - BarStart Divergence = (_conf ? _divDir == 'Bull' ? plFound : phFound : true) and (((_divType == 'Regular' and _divDir == 'Bull') or (_divType == 'Hidden' and _divDir == 'Bear')) ? (oscH and PriceL) : (oscL and PriceH)) if DivLen >= rangeLower and Divergence and _plotOn NoIntersect = true OscSlope = (OscEnd - OscStart)/(BarEnd - BarStart) PriceSlope = (PriceEnd - PriceStart)/(BarEnd - BarStart) OscLine = OscEnd - OscSlope PriceLine = PriceEnd - PriceSlope for x = IntLBStart to DivLen - 1 if (_divDir == 'Bull' and (osc[x] < OscLine or nz(close[x]) < PriceLine)) or (_divDir == 'Bear' and (osc[x] > OscLine or nz(close[x]) > PriceLine)) NoIntersect := false break OscLine -= OscSlope PriceLine -= PriceSlope NoIntersect if NoIntersect newDivLine := line.new(BarStart, LineStart, BarEnd, LineEnd, xloc.bar_index, extend.none, LineColor, LineStyle, 1) array.push(_DivLineArr, newDivLine) //Add new osc line to end of array DivCount := DivCount + 1 DivCount if DivCount > 0 if array.size(_DivLabelArr) > 0 if BarEnd != label.get_x(array.get(_DivLabelArr, array.size(_DivLabelArr) - 1)) newDivLabel := label.new(BarEnd, LineEnd, _divType == 'Regular' ? 'R' : 'H', xloc.bar_index, yloc.price, LabColor, LabStyle, LabTextCol, size.small) array.push(_DivLabelArr, newDivLabel) else newDivLabel := label.new(BarEnd, LineEnd, _divType == 'Regular' ? 'R' : 'H', xloc.bar_index, yloc.price, LabColor, LabStyle, LabTextCol, size.small) array.push(_DivLabelArr, newDivLabel) DivCount PotRegBullDivCount = f_getDivergence(PotAlerts and plotBull, 'Regular', 'Bull', false, URegBullDivLines, URegBullDivLabels) PotRegBearDivCount = f_getDivergence(PotAlerts and plotBear, 'Regular', 'Bear', false, URegBearDivLines, URegBearDivLabels) PotHidBullDivCount = f_getDivergence(PotAlerts and plotHiddenBull, 'Hidden', 'Bull', false, UHidBullDivLines, UHidBullDivLabels) PotHidBearDivCount = f_getDivergence(PotAlerts and plotHiddenBear, 'Hidden', 'Bear', false, UHidBearDivLines, UHidBearDivLabels) RegBullDivCount = f_getDivergence(plotBull, 'Regular', 'Bull', true, RegBullDivLines, RegBullDivLabels) RegBearDivCount = f_getDivergence(plotBear, 'Regular', 'Bear', true, RegBearDivLines, RegBearDivLabels) HidBullDivCount = f_getDivergence(plotHiddenBull, 'Hidden', 'Bull', true, HidBullDivLines, HidBullDivLabels) HidBearDivCount = f_getDivergence(plotHiddenBear, 'Hidden', 'Bear', true, HidBearDivLines, HidBearDivLabels) NewPotRegBullDiv = PotRegBullDivCount > 0 NewPotRegBearDiv = PotRegBearDivCount > 0 NewPotHidBullDiv = PotHidBullDivCount > 0 NewPotHidBearDiv = PotHidBearDivCount > 0 NewRegBullDiv = RegBullDivCount > 0 NewRegBearDiv = RegBearDivCount > 0 NewHidBullDiv = HidBullDivCount > 0 NewHidBearDiv = HidBearDivCount > 0 //} //Purge Old Divergences{ //Old Potential Divs f_purgeOldUnconDivs(line[]_DivLineArr, label[]_DivLabelArr)=> if array.size(_DivLineArr) > 0 if line.get_x2(array.get(_DivLineArr, 0)) <= bar_index - lbR for i = array.size(_DivLineArr) - 1 to 0 line.delete(array.get(_DivLineArr, i)) array.clear(_DivLineArr) if array.size(_DivLabelArr) > 0 if label.get_x(array.get(_DivLabelArr, 0)) <= bar_index - lbR for i = array.size(_DivLabelArr) - 1 to 0 label.delete(array.get(_DivLabelArr, i)) array.clear(_DivLabelArr) var int LastBar = 0 RegBullDivDisp = plotBull ? array.size(RegBullDivLabels) : 0 RegBearDivDisp = plotBear ? array.size(RegBearDivLabels) : 0 HidBullDivDisp = plotHiddenBull ? array.size(HidBullDivLabels) : 0 HidBearDivDisp = plotHiddenBear ? array.size(HidBearDivLabels) : 0 ConfDivCount = RegBullDivDisp + RegBearDivDisp + HidBullDivDisp + HidBearDivDisp if ConfDivCount > maxdivs and array.size(label.all) > 0 LastBar := label.get_x(array.get(label.all, array.size(label.all) - maxdivs)) f_purgeOldConDivs(_LineArr, _LabelArr)=> if array.size(_LabelArr) > 0 if label.get_x(array.get(_LabelArr, 0)) < LastBar label.delete(array.shift(_LabelArr)) if array.size(_LineArr) > 0 if line.get_x2(array.get(_LineArr, 0)) < LastBar line.delete(array.shift(_LineArr)) f_purgeOldUnconDivs(URegBullDivLines, URegBullDivLabels) f_purgeOldUnconDivs(URegBearDivLines, URegBearDivLabels) f_purgeOldUnconDivs(UHidBullDivLines, UHidBullDivLabels) f_purgeOldUnconDivs(UHidBearDivLines, UHidBearDivLabels) f_purgeOldConDivs(RegBullDivLines, RegBullDivLabels) f_purgeOldConDivs(RegBearDivLines, RegBearDivLabels) f_purgeOldConDivs(HidBullDivLines, HidBullDivLabels) f_purgeOldConDivs(HidBearDivLines, HidBearDivLabels) //} //Alerts{ if NewRegBullDiv alert('Regular Bull Divergence x' + str.tostring(RegBullDivCount), alert.freq_once_per_bar_close ) if NewHidBullDiv alert('Hidden Bull Divergence x' + str.tostring(HidBullDivCount), alert.freq_once_per_bar_close ) if NewRegBearDiv alert('Regular Bear Divergence x' + str.tostring(RegBearDivCount), alert.freq_once_per_bar_close ) if NewHidBearDiv alert('Hidden Bear Divergence x' + str.tostring(HidBearDivCount), alert.freq_once_per_bar_close ) if NewPotRegBullDiv alert('Potential Regular Bull Divergence x' + str.tostring(PotRegBullDivCount), alert.freq_once_per_bar_close ) if NewPotHidBullDiv alert('Potential Hidden Bull Divergence x' + str.tostring(PotHidBullDivCount), alert.freq_once_per_bar_close ) if NewPotRegBearDiv alert('Potential Regular Bear Divergence x' + str.tostring(PotRegBearDivCount), alert.freq_once_per_bar_close ) if NewPotHidBearDiv alert('Potential Hidden Bear Divergence x' + str.tostring(PotHidBearDivCount), alert.freq_once_per_bar_close )
Breakeven rectangle overlay for move contract
https://www.tradingview.com/script/3ignJANI-Breakeven-rectangle-overlay-for-move-contract/
JuicY-trading
https://www.tradingview.com/u/JuicY-trading/
56
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © JuicyWolf //@version=5 indicator("Breakeven rectangle overlay for move contract", overlay=true) //inputs LeftInput = input.time(timestamp("19 Jan 2022 01:00 +0300"),title="Opening contract date") rightInput = input.time(timestamp("20 Jan 2022 01:00 +0300"),title="Ending contract date") PrixDuContrat = input.int(defval=800, title="Enter the contract price") StrikePrice = input.int(defval=42310, title="Enter the strike price of the contract") LineInput = input.bool(defval=true, title="Activate/unactivate strike-price line") if LineInput == true line.new(x1=LeftInput, y1=StrikePrice, x2=rightInput, y2=StrikePrice, xloc=xloc.bar_time, color=color.red, style=line.style_solid, width=1) else if LineInput == false line.new(x1=LeftInput, y1=StrikePrice, x2=rightInput, y2=StrikePrice, xloc=xloc.bar_time, color=color.new(color.red, 100), style=line.style_solid, width=1) couleurInput = input.color(defval=color.new(color.green, 95), title="Interior color") couleur_bordureInput = input.color(defval=color.gray, title="Borders color") borderWidthInput = input.int(defval=2, title="Change border width") BorderStyleInput = input.string(defval="solid", title="Change border style", options=["solid","dotted","dashed"]) TextInput = input.string(defval="",title="Add a title to the rectangle") var string Border = na Border := if BorderStyleInput == 'solid' line.style_solid else if BorderStyleInput == 'dotted' line.style_dotted else if BorderStyleInput == 'dashed' line.style_dashed //calcul topInput = StrikePrice + PrixDuContrat bottomInput = StrikePrice - PrixDuContrat //Rectangle var a = box.new(left=LeftInput, top=topInput, right=rightInput, bottom=bottomInput, xloc=xloc.bar_time, border_color=couleur_bordureInput, border_width=borderWidthInput, border_style=Border, bgcolor=couleurInput, text=TextInput)
Fusion: Monster Breakout Index
https://www.tradingview.com/script/fiou9wgZ-Fusion-Monster-Breakout-Index/
Koalems
https://www.tradingview.com/u/Koalems/
29
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Koalems // *************************************************************************************************** // CREDITS // *************************************************************************************************** // Modified from the Monster Breakout Index by racer8 under the licence of // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // *************************************************************************************************** // TYPE // *************************************************************************************************** // @version=5 indicator( shorttitle = 'Fusion: MBI', title = 'Fusion: Monster Breakout Index', overlay=false) // *************************************************************************************************** // INPUT // *************************************************************************************************** Group6500 = '6500 Monster breakout index (MBI) - SHOW' mbiShowBars = input.bool(true, group=Group6500, title='Bars') mbiShowBarsContinuation = input.bool(true, group=Group6500, title='  Continuation bars') mbiShowChannel = input.bool(false, group=Group6500, title='Channel') mbiShowBarBackMarker = input.bool(false, group=Group6500, title='Bar back marker') Group6520 = '6520 MBI - RULES' mbiRuleNewTrumpsOld = input.bool(false, group=Group6520, title='New direction overrides old', tooltip="If both an up and down signal occur on the same bar than then one that's a new direction wins and the old direction demoted.\n\nA domoted signal will be colored purple.") mbiRuleExcludeDual = input.bool(false, group=Group6520, title='Exclude dual directions', tooltip="If both an up and down signal occur on the same bar then both signals are demoted. If 'New direction overrides old' is also set then this rule override it.\n\nA domoted signal will be colored purple.") Group6530 = '6530 MBI - SETTINGS' tooltipLength="The brighter colors represent when the current candle's high is higher (or low is lower) than the highest/lowest found for the length number of candles.\n\nThe softer colors represent a candle that does not meet the above criterion but is just \'following on\' from a prior found higher/lower candle. This distinguishing may be useful for rules of entries and exits." mbiHighestLength = input.int(18, group=Group6530, minval=2, title='Highest length', tooltip=tooltipLength) mbiLowestLength = input.int(18, group=Group6530, minval=2, title='Lowest length', tooltip=tooltipLength) mbiSourceHighest = input.source(hl2, group=Group6530, title='Source Highest') mbiSourceLowest = input.source(hl2, group=Group6530, title='Source Lowest') // *************************************************************************************************** // Indicator // *************************************************************************************************** mbiH = ta.highest(mbiSourceHighest, mbiHighestLength) mbiL = ta.lowest (mbiSourceLowest, mbiLowestLength) mbiHigh = mbiH[1] mbiLow = mbiL[1] mbiUp = high > mbiHigh ? 1 : na mbiDn = low < mbiLow ? -1 : na var mbiSoftLevel = 1 mbiSoftUp = na(mbiUp) and not na(mbiUp[1]) and not mbiDn ? mbiSoftLevel : na mbiSoftDn = na(mbiDn) and not na(mbiDn[1]) and not mbiUp ? -mbiSoftLevel : na if na(mbiSoftUp) and not na(mbiSoftUp[1]) and not mbiDn mbiSoftUp := mbiSoftLevel if na(mbiSoftDn) and not na(mbiSoftDn[1]) and not mbiUp mbiSoftDn := -mbiSoftLevel float mbiConflictUp = na float mbiConflictDn = na if mbiUp and mbiDn if mbiRuleExcludeDual mbiUp := na mbiDn := na mbiConflictUp := mbiSoftLevel mbiConflictDn := -mbiSoftLevel else if mbiRuleNewTrumpsOld if mbiUp[1] mbiUp := na mbiConflictUp := mbiSoftLevel if mbiDn[1] mbiDn := na mbiConflictDn := -mbiSoftLevel // *************************************************************************************************** // SHOW // *************************************************************************************************** plot(mbiShowBars ? mbiUp : na, color=color.new(color.lime, 30), style=plot.style_columns, title='MBI up') plot(mbiShowBars ? mbiDn : na, color=color.new(color.red, 30), style=plot.style_columns, title='MBI down') plot(mbiShowBars and mbiShowBarsContinuation ? mbiSoftUp : na , color=color.new(color.lime, 80), style=plot.style_columns, title='MBI soft up') plot(mbiShowBars and mbiShowBarsContinuation ? mbiSoftDn : na , color=color.new(color.red, 70), style=plot.style_columns, title='MBI soft down') plot(mbiShowBars ? mbiConflictUp : na , color=color.new(color.purple, 25), style=plot.style_columns, title='MBI conflict up') plot(mbiShowBars ? mbiConflictDn : na , color=color.new(color.purple, 25), style=plot.style_columns, title='MBI conflict down') mbiHighPlot = plot(mbiShowChannel ? mbiHigh : na, color=color.new(#006064, 0), linewidth=1, style=plot.style_line, title='MBI high') mbiLowPlot = plot(mbiShowChannel ? mbiLow : na, color=color.new(#006064, 0), linewidth=1, style=plot.style_line, title='MBI low') fill(mbiHighPlot, mbiLowPlot, color=color.new(#43c2be, 92), title="MBI fill") plotchar(mbiShowBarBackMarker and barstate.isrealtime, offset=-mbiHighestLength - 1, char='↡', location=location.top, color=color.yellow, title='MBI bar back') plotchar(mbiShowBarBackMarker and barstate.isrealtime, offset=-mbiLowestLength - 1, char='↡', location=location.top, color=color.yellow, title='MBI bar back')
Volume Adaptive Bollinger Bands (MZ VABB)
https://www.tradingview.com/script/RUtjZgYA-Volume-Adaptive-Bollinger-Bands-MZ-VABB/
MightyZinger
https://www.tradingview.com/u/MightyZinger/
364
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © MightyZinger //@version=4 study("Volume Adaptive Bollinger Bands (MZ VABB)", shorttitle="MZ VABB", overlay=true) uha =input(true, title="Use Heikin Ashi Candles for Volume Oscillator Calculations") // Use only Heikinashi Candles for all calculations haclose = uha ? security(heikinashi(syminfo.tickerid), timeframe.period, close) : security(syminfo.tickerid, timeframe.period, close) haopen = uha ? security(heikinashi(syminfo.tickerid), timeframe.period, open) : security(syminfo.tickerid, timeframe.period, open) hahigh = security(syminfo.tickerid, timeframe.period, high) halow = security(syminfo.tickerid, timeframe.period, low) vol = security(syminfo.tickerid, timeframe.period, volume) ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// ///// Source Options ////// ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// // ─── Different Sources Options List ───► [ string SRC_Tv = "Use traditional TradingView Sources " string SRC_Wc = "(high + low + (2 * close)) / 4" string SRC_Wo = "close+high+low-2*open" string SRC_Wi = "(close+high+low) / 3" string SRC_Ex = "close>open ? high : low" string SRC_Hc = "Heikin Ashi Close" string src_grp = "Source Parameters" // ●───────── Inputs ─────────● { diff_src = input(SRC_Wi, "→ Different Sources Options", options=[SRC_Tv, SRC_Wc, SRC_Wo, SRC_Wi, SRC_Ex, SRC_Hc], group = src_grp) i_sourceSetup = input(close, "  ‍↳ Source Setup", group = src_grp) uha_src =input(true, title="‍↳ Use Heikin Ashi Candles for Different Source Calculations", group = src_grp) i_Symmetrical = input(true, "‍↳ Apply Symmetrically Weighted Moving Average at the price source?", group = src_grp) // Heikinashi Candles for calculations h_close = uha_src ? security(heikinashi(syminfo.tickerid), timeframe.period, close) : security(syminfo.tickerid, timeframe.period, close) h_open = uha_src ? security(heikinashi(syminfo.tickerid), timeframe.period, open) : security(syminfo.tickerid, timeframe.period, open) h_high = security(syminfo.tickerid, timeframe.period, high) h_low = security(syminfo.tickerid, timeframe.period, low) // Get Source src_o = diff_src == SRC_Wc ? (high + low + (2 * h_close)) / 4 : diff_src == SRC_Wo ? h_close+h_high+h_low-2*h_open : diff_src == SRC_Wi ? (h_close+h_high+h_low) / 3: diff_src == SRC_Ex ? h_close>h_open ? h_high : h_low : diff_src == SRC_Hc ? security(heikinashi(syminfo.tickerid), timeframe.period, close) : i_sourceSetup src_f = i_Symmetrical ? swma(src_o) : src_o // Symmetrically Weighted Moving Average? ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// ///// Dynamic Inputs ////// ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// // Basis (AEDSMA) Parameters grp1 = "Basis (AEDSMA) Parameters" grp2 = "Adapt Dynamic Length Based on (Max Length if both left unchecked)" grp3 = "Show Signals and Dynamic Coloring Based on" minLength = input(50, title="Basis MA Minimum Length:", group = grp1, inline = "bs1") maxLength = input(100, title="Basis MA Maximum Length:", group = grp1, inline = "bs1") ssfLength = input(title="EDSMA - Super Smoother Filter Length", type=input.integer, minval=1, defval=20, group = grp1) ssfPoles = input(title="EDSMA - Super Smoother Filter Poles", type=input.integer, defval=2, options=[2, 3], group = grp1) adaptPerc = input(3.141, minval = 0, maxval = 100, title="Adapting Percentage:", group = grp1) / 100.0 mult = input(2.0, minval=0.001, maxval=50, title="StdDev", group = grp1) offset = input(0, "Offset", minval = -500, maxval = 500, group = grp1) // Adaptive Length Checks ch1 = "Slope" ch2 = "Volume" ch3 = "Volatility" volume_chk = input(true, title= ch2, group= grp2, inline="len_chks") volat_chk = input(false, title= ch3, group= grp2, inline="len_chks") t_slp_chk = input(true, title= ch1, group= grp3, inline="trd_chks") t_volume_chk = input(true, title= ch2, group= grp3, inline="trd_chks") t_volat_chk = input(false, title= ch3, group= grp3, inline="trd_chks") showSignals = input(true, title="Show Possible Signals", group="Plot Parameters") showFibs = input(true, title="Show Fibonacci Bands", group="Plot Parameters") showBg = input(true, title="Enable Background Warning Color", group="Plot Parameters") ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// // Volume and other Inputs // Volume Oscillator Types Input osc1 = "TFS Volume Oscillator" osc2 = "On Balance Volume" osc3 = "Klinger Volume Oscillator" osc4 = "Cumulative Volume Oscillator" osc5 = "Volume Zone Oscillator" osctype = input(title="Volume Oscillator Type", type=input.string, group="RVSI Parameters", defval = osc3, options=[osc1, osc2, osc3, osc4, osc5]) volLen = input(30, minval=1,title="Volume Length", group="MZ RVSI Indicator Parameters") rvsiLen = input(14, minval=1,title="RVSI Period", group="MZ RVSI Indicator Parameters") vBrk = input(50, minval=1,title="RVSI Break point", group="MZ RVSI Indicator Parameters") atrFlength = input(14, title="ATR Fast Length", group="Volatility Dynamic Optimization Parameters") atrSlength = input(46, title="ATR Slow Length", group="Volatility Dynamic Optimization Parameters") slopePeriod = input(34, title="Slope Period", group="Slope Dynamic Optimization Parameters") slopeInRange = input(25, title="Slope Initial Range", group="Slope Dynamic Optimization Parameters") flat = input(17, title="Consolidation area is when slope below:", group="Slope Dynamic Optimization Parameters") ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// ///// DSMA Function ////// ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// // Pre-reqs get2PoleSSF(src, length) => PI = 2 * asin(1) arg = sqrt(2) * PI / length a1 = exp(-arg) b1 = 2 * a1 * cos(arg) c2 = b1 c3 = -pow(a1, 2) c1 = 1 - c2 - c3 ssf = 0.0 ssf := c1 * src + c2 * nz(ssf[1]) + c3 * nz(ssf[2]) get3PoleSSF(src, length) => PI = 2 * asin(1) arg = PI / length a1 = exp(-arg) b1 = 2 * a1 * cos(1.738 * arg) c1 = pow(a1, 2) coef2 = b1 + c1 coef3 = -(c1 + b1 * c1) coef4 = pow(c1, 2) coef1 = 1 - coef2 - coef3 - coef4 ssf = 0.0 ssf := coef1 * src + coef2 * nz(ssf[1]) + coef3 * nz(ssf[2]) + coef4 * nz(ssf[3]) // MA Main function dsma(src, len) => float result = 0.0 zeros = src - nz(src[2]) avgZeros = (zeros + zeros[1]) / 2 // Ehlers Super Smoother Filter ssf = ssfPoles == 2 ? get2PoleSSF(avgZeros, ssfLength) : get3PoleSSF(avgZeros, ssfLength) // Rescale filter in terms of Standard Deviations stdev = stdev(ssf, len) scaledFilter = stdev != 0 ? ssf / stdev : 0 alpha = 5 * abs(scaledFilter) / len edsma = 0.0 edsma := alpha * src + (1 - alpha) * nz(edsma[1]) result := edsma result ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// ///// Dynamic Length Function ////// ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// dyn_Len(volume_chk, volat_chk, volume_Break, high_Volatility, adapt_Pct, minLength, maxLength) => var float result = avg(minLength,maxLength) para = (volume_chk == true and volat_chk == false) ? volume_Break : (volume_chk == false and volat_chk == true) ? high_Volatility : (volume_chk == true and volat_chk == true) ? volume_Break and high_Volatility : na result := iff(para, max(minLength, result * (1 - adapt_Pct)), min(maxLength, result * (1 + adapt_Pct))) result //Slope calculation to determine whether market is in trend, or in consolidation or choppy, or might about to change current trend calcslope(_ma,src,slope_period,range)=> pi = atan(1) * 4 highestHigh = highest(slope_period) lowestLow = lowest(slope_period) slope_range = range / (highestHigh - lowestLow) * lowestLow dt = (_ma[2] - _ma) / src * slope_range c = sqrt(1 + dt * dt) xAngle = round(180 * acos(1 / c) / pi) maAngle = iff(dt > 0, -xAngle, xAngle) maAngle //MA coloring function to mark market dynamics dyn_col(slp_chk, volume_chk, volat_chk, slp1, slp2, slp3, _flat, vol_Brk_up, vol_Brk_dn, high_Volatility, col_1, col_2, col_3, col_4, col_r) => bool up_para = 0.0 bool dn_para = 0.0 bool sc1 = 0.0 bool sc2 = 0.0 bool sc3 = 0.0 bool c1 = 0.0 bool c2 = 0.0 bool c3 = 0.0 bool c4 = 0.0 bool c5 = 0.0 var color col = color.green if volume_chk == true and volat_chk == false up_para := vol_Brk_up dn_para := vol_Brk_dn if volume_chk == false and volat_chk == true up_para := high_Volatility dn_para := high_Volatility if volume_chk == true and volat_chk == true up_para := high_Volatility and vol_Brk_up dn_para := high_Volatility and vol_Brk_dn if volume_chk == false and volat_chk == false up_para := na dn_para := na sc1 := slp1 > _flat and slp2 > _flat and slp3 > _flat sc2 := slp1 <= _flat and slp1 > -flat and slp2 <= _flat and slp2 > -flat and slp3 <= _flat and slp3 > -flat sc3 := slp1 <= -_flat and slp2 <= -_flat and slp3 <= -_flat c1 := iff(slp_chk == true , sc1 and up_para, up_para) c2 := iff(slp_chk == true , sc1 and not up_para, na) c3 := iff(slp_chk == true , sc2, na) c4 := iff(slp_chk == true , sc3 and dn_para, dn_para) c5 := iff(slp_chk == true , sc3 and not dn_para, na) col := c1 ? col_1 : c2 ? col_2 : c3 ? col_r : c4 ? col_3 : c5 ? col_4 : (c2 == c3 == c5 == na ) ? col_r : col_r col ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// ///// Volume Oscillator Functions ////// ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// // Volume Zone Oscillator zone(_src, _type, _len) => vp = _src > _src[1] ? _type : _src < _src[1] ? -_type : _src == _src[1] ? 0 : 0 z = 100 * (ema(vp, _len) / ema(_type, _len)) vzo(vol_src, _close) => float result = 0 zLen = input(21, "VZO Length", minval=1, group="Volume Zone Oscillator Parameters") result := zone(_close, vol_src, zLen) result // Cumulative Volume Oscillator _rate(cond, tw, bw, body) => ret = 0.5 * (tw + bw + (cond ? 2 * body : 0)) / (tw + bw + body) ret := nz(ret) == 0 ? 0.5 : ret ret cvo(vol_src, _open, _high, _low, _close) => float result = 0 ema1len = input(defval = 8, title = "EMA 1 Length", minval = 1, group="Cumulative Volume Oscillator Parameters") ema2len = input(defval = 21, title = "EMA 1 Length", minval = 1, group="Cumulative Volume Oscillator Parameters") obvl = "On Balance Volume" cvdo = "Cumulative Volume Delta" pvlt = "Price Volume Trend" cvtype = input(defval = pvlt, options = [obvl, cvdo, pvlt], group="Cumulative Volume Oscillator Parameters") tw = _high - max(_open, _close) bw = min(_open, _close) - _low body = abs(_close - _open) deltaup = vol_src * _rate(_open <= _close , tw, bw, body) deltadown = vol_src * _rate(_open > _close , tw, bw, body) delta = _close >= _open ? deltaup : -deltadown cumdelta = cum(delta) float ctl = na ctl := cumdelta cv = cvtype == obvl ? obv : cvtype == cvdo ? ctl : pvt ema1 = ema(cv,ema1len) ema2 = ema(cv,ema2len) result := ema1 - ema2 result // Volume Oscillator function vol_osc(type, vol_src, vol_Len, _open, _high, _low, _close) => float result = 0 if type=="TFS Volume Oscillator" nVolAccum = sum(iff(_close > _open, vol_src, iff(_close < _open, -vol_src, 0)) ,vol_Len) result := nVolAccum / vol_Len if type=="On Balance Volume" result := cum(sign(change(_close)) * vol_src) if type=="Klinger Volume Oscillator" FastX = input(50, minval=1,title="Volume Fast Length", group="Klinger Volume Oscillator Parameters") SlowX = input(200, minval=1,title="Volume Slow Length", group="Klinger Volume Oscillator Parameters") xTrend = iff(_close > _close[1], vol * 100, -vol * 100) xFast = ema(xTrend, FastX) xSlow = ema(xTrend, SlowX) result := xFast - xSlow if type=="Cumulative Volume Oscillator" result := cvo(vol_src, _open, _high, _low, _close) if type=="Volume Zone Oscillator" result := vzo(vol_src, _close) result ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// // MA of Volume Oscillator Source volMA = sma(vol_osc(osctype,vol,volLen,haopen,hahigh,halow,haclose) , rvsiLen) // HMA can also be used just like used in RVSI's original Indicator // RSI of Volume Oscillator Data rsivol = rsi(volMA, rvsiLen) rvsi = hma(rsivol, rvsiLen) rvsiSlp = calcslope(rvsi, rsivol, slopePeriod, slopeInRange) // Slope of RVSI // Volume Breakout Condition volBrkUp = rvsi > vBrk // and rvsiSlp >= flat volBrkDn = rvsi < vBrk //or rvsiSlp <= -flat // //Volatility Meter highVolatility = atr(atrFlength) > atr(atrSlength) ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// dynaLen = dyn_Len(volume_chk, volat_chk, volBrkUp, highVolatility, adaptPerc, minLength, maxLength) basis = dsma(src_f , int(dynaLen)) dev = mult * stdev(src_f, int(dynaLen)) upper = basis + dev lower = basis - dev slopeBasis = calcslope(basis, src_f, slopePeriod, slopeInRange) slopeUpper = calcslope(upper, src_f, slopePeriod, slopeInRange) slopeLower = calcslope(lower, src_f, slopePeriod, slopeInRange) up_col = color.lime w_up_col = color.fuchsia dn_col = color.red w_dn_col = color.gray dynCol = dyn_col(t_slp_chk, t_volume_chk, t_volat_chk, slopeBasis, slopeUpper, slopeLower, flat, volBrkUp, volBrkDn, highVolatility, up_col, w_up_col, dn_col, w_dn_col, color.yellow) ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// // Live Dynamic Length Table on Chart var length_table = table(na) length_table := table.new(position.bottom_right , columns = 2, rows = 1, border_width = 1) table.cell(length_table, 0, 0, "VABB Dynamic Length", bgcolor = #cccccc) table.cell(length_table, 1, 0, tostring(int(dynaLen)), bgcolor = #cccccc) // SIGNALS _upSig = dynCol == up_col //or dynCol == w_up_col _dnSig = dynCol == dn_col //or dynCol == w_dn_col buy = _upSig and not _upSig[1] sell = _dnSig and not _dnSig[1] var sig = 0 if buy and sig <= 0 sig := 1 if sell and sig >= 0 sig := -1 longsignal = sig == 1 and (sig != 1)[1] shortsignal = sig == -1 and (sig != -1)[1] // Caution for price crossing outer bands top_out = high > upper bot_out = low < lower upWarn = top_out and not top_out[1] dnWarn = bot_out and not bot_out[1] // Signal Plots atrPos = 0.72 * atr(5) plotshape(showSignals and buy ? basis-atrPos: na, style=shape.circle, color= #AADB1E, location=location.absolute, size = size.tiny) plotshape(showSignals and sell ? basis+atrPos: na, style=shape.circle, color= #E10600, location=location.absolute, size = size.tiny) plotshape(showSignals and longsignal ? lower-atrPos: na, style = shape.triangleup, color = color.green, location=location.absolute, text = "Long", size = size.small) plotshape(showSignals and shortsignal ? upper+atrPos: na, style = shape.triangledown, color = color.red, location=location.absolute, text = "Short", size = size.small) plotchar(showSignals and upWarn ? upper+atrPos: dnWarn? lower-atrPos: na, color = upWarn ? #E10600 : dnWarn ? #AADB1E : na, location=location.absolute, char = "⚑", size = size.tiny) bgScheme = upWarn ? color.rgb(153,71,88,90) : dnWarn ? color.rgb(0,155,119,90): na bgcolor(showBg ? bgScheme: na) // BB Plots plot(basis, "Basis", color=dynCol, offset = offset, linewidth = 3) up_width = iff(upWarn, 5, 1) fill_col = iff(sig == 1, color.rgb(0,155,119,85), color.rgb(153,71,88,85) ) p1 = plot(upper, "Upper", color= color.new(fill_col, 5), offset = offset) p2 = plot(lower, "Lower", color= color.new(fill_col, 5), offset = offset) fill(p1, p2, title = "Background", color = fill_col) plotchar(rvsi, "RVSI", "", location.top, color.red) plotchar(int(dynaLen), "VABB Dynamic Length", "", location.top, dynCol) // Fibonacci Bands m1 = input(0.236, minval=0, maxval=1, step=0.01, title="Fib 1", group= "Fibonacci Parameters", inline = "fibs1") m2 = input(0.382, minval=0, maxval=1, step=0.01, title="Fib 2", group= "Fibonacci Parameters", inline = "fibs1") m3 = input(0.5, minval=0, maxval=1, step=0.01, title="Fib 3", group= "Fibonacci Parameters", inline = "fibs1") m4 = input(0.618, minval=0, maxval=1, step=0.01, title="Fib 4", group= "Fibonacci Parameters", inline = "fibs1") m5 = input(0.764, minval=0, maxval=1, step=0.01, title="Fib 5", group= "Fibonacci Parameters", inline = "fibs1") upper_1= basis + (m1 * (upper - basis)) upper_2= basis + (m2 * (upper - basis)) upper_3= basis + (m3 * (upper - basis)) upper_4= basis + (m4 * (upper - basis)) upper_5= basis + (m5 * (upper - basis)) lower_1= basis - (m1 * (basis - lower)) lower_2= basis - (m2 * (basis - lower)) lower_3= basis - (m3 * (basis - lower)) lower_4= basis - (m4 * (basis - lower)) lower_5= basis - (m5 * (basis - lower)) f1_col = color.rgb(235,33,46,80) f2_col = color.rgb(0,135,62,80) f3_col = color.rgb(0,154,23,80) f4_col = color.rgb(47,249,36,80) f5_col = color.rgb(187,0,0,80) fu1 = plot(showFibs ? upper_1 : na, color=f1_col , linewidth=2, title="0.236") fu2 = plot(showFibs ? upper_2 : na, color=f2_col , linewidth=2, title="0.382") fu3 = plot(showFibs ? upper_3 : na, color=f3_col , linewidth=2, title="0.5") fu4 = plot(showFibs ? upper_4 : na, color=f4_col , linewidth=3, title="0.618") fu5 = plot(showFibs ? upper_5 : na, color=f5_col , linewidth=2, title="0.764") fl1 = plot(showFibs ? lower_1 : na, color=f1_col, linewidth=2, title="0.236") fl2 = plot(showFibs ? lower_2 : na, color=f2_col , linewidth=2, title="0.382") fl3 = plot(showFibs ? lower_3 : na, color=f3_col , linewidth=2, title="0.5") fl4 = plot(showFibs ? lower_4 : na, color=f4_col , linewidth=3, title="0.618") fl5 = plot(showFibs ? lower_5 : na, color=f5_col , linewidth=2, title="0.764")
Moving Averages Histogram
https://www.tradingview.com/script/SxRG79pA-Moving-Averages-Histogram/
dman103
https://www.tradingview.com/u/dman103/
106
study
5
CC-BY-SA-4.0
// This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License https://creativecommons.org/licenses/by-sa/4.0/ //@version=5 /// © dman103 // An interesting idea is to simplify the display of whether ONE fast-moving average crosses FIVE other slower-moving averages using just a histogram. //The idea is to increase the step counter by 1 every time a fast-moving average crosses over one of the five slower-moving averages and //decrease the step counter by 1 every time the fast-moving average crosses down each one of the other five slower moving averages. // ==== Step System explained ==== // The step system is quite straightforward, every time the FAST moving average crosses one of the slower moving average step counters is increased by 1 until reaching the maximum of 5 (we have 5 slower-moving averages) //===Cut To Chase=== // If the histogram is at the value of 5 (green), it means FAST moving averages is ABOVE ALL slower-moving averages, Hench, the asset is up trending. // If the histogram is at the value of 0 (red), it means FAST moving average is BELOW ALL slower-moving averages, Hench, the asset is down trending. //Midway area is the area where you can see how the fast-moving average is cross the slower moving averages. //You change from a variety of moving averages like EMA, ALMA, HMA, and so on. //You can reduce the number of slow moving average by placing the same length. //Note that fast-moving average should have the lowest length. //You can visualize the moving averages in case you want to see how it works behind, by going to settings and clicking 'Show MA lines'. //Every moving average length can be modified inside settings. indicator(title='Moving Averages Histogram') ma_type = input.string(title='Moving Average Type', defval='RMA', options=['RMA', 'SMA', 'EMA', 'WMA', 'ALMA', 'HMA', 'JMA', 'VMA', 'WWMA', 'SMMA']) length_fast = input.int(7, minval=1, title='Fast MA Length') length_1 = input.int(10, minval=1, title='Slow MA Length 1') length_2 = input.int(20, minval=1, title='Slow MA Length 2') length_3 = input.int(50, minval=1, title='Slow MA Length 3') length_4 = input.int(100, minval=1, title='Slow MA Length 4') length_5 = input.int(200, minval=1, title='Slow MA Length 5') show_mas = input.bool(false, title="Show MA lines") source_to_use = input(close, title='Source') ////// Moving averages function ma_function(source, length, ma_seleted_type) => if ma_seleted_type == 'RMA' ta.rma(source, length) else if ma_seleted_type == 'SMA' ta.sma(source, length) else if ma_seleted_type == 'EMA' ta.ema(source, length) else if ma_seleted_type == 'WMA' ta.wma(source, length) else if ma_seleted_type == 'HMA' ta.wma(2 * ta.wma(source, length / 2) - ta.wma(source, length), math.round(math.sqrt(length))) else if ma_seleted_type == 'ALMA' ta.alma(source, length, 0.85, 6) else if ma_seleted_type == 'JMA' beta = 0.45 * (length - 1) / (0.45 * (length - 1) + 2) alpha = beta tmp0 = 0.0 tmp1 = 0.0 tmp2 = 0.0 tmp3 = 0.0 tmp4 = 0.0 tmp0 := (1 - alpha) * source + alpha * nz(tmp0[1]) tmp1 := (source - tmp0[0]) * (1 - beta) + beta * nz(tmp1[1]) tmp2 := tmp0[0] + tmp1[0] tmp3 := (tmp2[0] - nz(tmp4[1])) * (1 - alpha) * (1 - alpha) + alpha * alpha * nz(tmp3[1]) tmp4 := nz(tmp4[1]) + tmp3[0] tmp4 else if ma_seleted_type == 'VMA' valpha = 2 / (length + 1) vud1 = source > source[1] ? source - source[1] : 0 vdd1 = source < source[1] ? source[1] - source : 0 vUD = math.sum(vud1, length) // was 9 constant vDD = math.sum(vdd1, length) // was 9 constant vCMO = nz((vUD - vDD) / (vUD + vDD)) VAR = 0.0 VAR := nz(valpha * math.abs(vCMO) * source) + (1 - valpha * math.abs(vCMO)) * nz(VAR[1]) VAR else if ma_seleted_type == 'WWMA' wwalpha = 1 / length WWMA = 0.0 WWMA := wwalpha * source + (1 - wwalpha) * nz(WWMA[1]) WWMA else if ma_seleted_type == 'SMMA' smma = float(0.0) smaval = ta.sma(source, length) smma := na(smma[1]) ? smaval : (smma[1] * (length - 1) + source) / length smma ma_fast=ma_function(source_to_use,length_fast,ma_type) ma_1=ma_function(source_to_use,length_1,ma_type) ma_2=ma_function(source_to_use,length_2,ma_type) ma_3=ma_function(source_to_use,length_3,ma_type) ma_4=ma_function(source_to_use,length_4,ma_type) ma_5=ma_function(source_to_use,length_5,ma_type) varip int counter = 0 var color Pcolor = na ma_fast_cross_over_1= ma_fast>ma_1 and ma_fast[1]<=ma_1[1] ma_fast_cross_under_1= ma_fast<ma_1 and ma_fast[1]>=ma_1[1] ma_fast_cross_over_2=ma_fast>ma_2 and ma_fast[1]<=ma_2[1] ma_fast_cross_under_2=ma_fast<ma_2 and ma_fast[1]>=ma_2[1] ma_fast_cross_over_3=ma_fast>ma_3 and ma_fast[1]<=ma_3[1] ma_fast_cross_under_3=ma_fast<ma_3 and ma_fast[1]>=ma_3[1] ma_fast_cross_over_4=ma_fast>ma_4 and ma_fast[1]<=ma_4[1] ma_fast_cross_under_4=ma_fast<ma_4 and ma_fast[1]>=ma_4[1] ma_fast_cross_over_5=ma_fast>ma_5 and ma_fast[1]<=ma_5[1] ma_fast_cross_under_5=ma_fast<ma_5 and ma_fast[1]>=ma_5[1] if(ma_fast_cross_over_1) counter:=math.min(counter+1,5) if(ma_fast_cross_over_2) counter:=math.min(counter+1,5) if(ma_fast_cross_over_3) counter:=math.min(counter+1,5) if(ma_fast_cross_over_4) counter:=math.min(counter+1,5) if(ma_fast_cross_over_5) counter:=math.min(counter+1,5) if (ma_fast_cross_under_1) counter:=math.max(counter-1,0) if (ma_fast_cross_under_2) counter:=math.max(counter-1,0) if (ma_fast_cross_under_3) counter:=math.max(counter-1,0) if (ma_fast_cross_under_4) counter:=math.max(counter-1,0) if (ma_fast_cross_under_5) counter:=math.max(counter-1,0) Pcolor:=color.from_gradient(counter, 0, 5, color.new(color.red, 50), color.new(color.green, 0)) plot(show_mas==false ? counter : na, color=color.new(Pcolor, 0), style=plot.style_columns,linewidth=3) plot(show_mas ? ma_fast : na ,color=color.yellow, linewidth=2) plot(show_mas ? ma_1 : na ,color=color.orange) plot(show_mas ? ma_2: na ,color=color.blue) plot(show_mas ? ma_3 : na ,color=color.lime) plot(show_mas ? ma_4 : na ,color=color.purple) plot(show_mas ? ma_5 : na ,color=color.navy)
PriceCatch Bank FD Return Level
https://www.tradingview.com/script/aEY36lY1-PriceCatch-Bank-FD-Return-Level/
PriceCatch
https://www.tradingview.com/u/PriceCatch/
9
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © PriceCatch //@version=5 indicator(title="PriceCatch Bank FD Return Level", shorttitle="PriceCatch BankFD RL", precision=0, overlay=true) ln_X2 = time_close + (time-time[20]) float _buyPrice = input.price(defval=1,confirm = true,title="Buy Price",tooltip="You may also click on chart and drag the line to select price") string _bankName = input.string(title="Bank Name", defval="State Bank of India",options=["State Bank of India", "HDFC Bank","Kotak Mahindra Bank", "Axis Bank", "ICICI Bank"],tooltip="Interest rate for 1 year will be used") float _bankRate = switch _bankName "State Bank of India" => 5.40 "HDFC" => 5.60 "Kotak Mahindra Bank" => 4.90 "Axis Bank" => 5.75 "ICICI Bank" => 5.00 float _fdRateGainPrice = _buyPrice + (_buyPrice * _bankRate / 100) _showGainLevel = input.bool(title="Show Gain Level",defval=true) _GainLineColor = input.color(color.red, "Line color") var line _GainLine = na string gainPrice = str.tostring(_fdRateGainPrice,format.mintick) string fdRate = str.tostring(_bankRate,format.mintick) if _showGainLevel line.delete(_GainLine) _GainLine := line.new(time[bar_index],_fdRateGainPrice, ln_X2, _fdRateGainPrice, extend=extend.none,color=_GainLineColor, style=line.style_dashed, xloc=xloc.bar_time) // Show guide text var label lbl_guide = na label.delete(lbl_guide) lbl_guide := label.new(bar_index,0, text="") label.set_xloc(lbl_guide, bar_index, xloc.bar_index) label.set_yloc(lbl_guide,yloc.price) label.set_x(lbl_guide,bar_index) label.set_y(lbl_guide,_fdRateGainPrice) label.set_text(lbl_guide, "When price reaches " + gainPrice + " you have gained\n" + _bankName + " (" + fdRate + ") FD Interest Rate") label.set_style(lbl_guide,label.style_none) //label.set_color(lbl_guide, _GainLineColor) label.set_textcolor(lbl_guide, _GainLineColor) label.set_size(lbl_guide, size.normal) label.set_textalign(lbl_guide, text.align_right)
Multi-Timeframe TTM Squeeze Pro
https://www.tradingview.com/script/7VXF3amy-Multi-Timeframe-TTM-Squeeze-Pro/
Beardy_Fred
https://www.tradingview.com/u/Beardy_Fred/
641
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Beardy_Fred //@version=5 indicator("Multi-Timeframe TTM Squeeze Pro", shorttitle="MTF Squeeze Pro", overlay=true) length = input.int(20, "TTM Squeeze Length") //BOLLINGER BANDS BB_mult = input.float(2.0, "Bollinger Band STD Multiplier") BB_basis = ta.sma(close, length) dev = BB_mult * ta.stdev(close, length) BB_upper = BB_basis + dev BB_lower = BB_basis - dev //KELTNER CHANNELS KC_mult_high = input.float(1.0, "Keltner Channel #1") KC_mult_mid = input.float(1.5, "Keltner Channel #2") KC_mult_low = input.float(2.0, "Keltner Channel #3") KC_basis = ta.sma(close, length) devKC = ta.sma(ta.tr, length) KC_upper_high = KC_basis + devKC * KC_mult_high KC_lower_high = KC_basis - devKC * KC_mult_high KC_upper_mid = KC_basis + devKC * KC_mult_mid KC_lower_mid = KC_basis - devKC * KC_mult_mid KC_upper_low = KC_basis + devKC * KC_mult_low KC_lower_low = KC_basis - devKC * KC_mult_low //SQUEEZE CONDITIONS NoSqz = BB_lower < KC_lower_low or BB_upper > KC_upper_low //NO SQUEEZE: GREEN LowSqz = BB_lower >= KC_lower_low or BB_upper <= KC_upper_low //LOW COMPRESSION: BLACK MidSqz = BB_lower >= KC_lower_mid or BB_upper <= KC_upper_mid //MID COMPRESSION: RED HighSqz = BB_lower >= KC_lower_high or BB_upper <= KC_upper_high //HIGH COMPRESSION: ORANGE //MOMENTUM OSCILLATOR mom = ta.linreg(close - math.avg(math.avg(ta.highest(high, length), ta.lowest(low, length)), ta.sma(close, length)), length, 0) //MOMENTUM HISTOGRAM COLOR mom_up1_col = input.color(color.new(color.aqua, 0), title = "+ive Rising Momentum", group = "Histogram Color") mom_up2_col = input.color(color.new(#2962ff, 0), title = "+ive Falling Momentum", group = "Histogram Color") mom_down1_col = input.color(color.new(color.red, 0), title = "-ive Rising Momentum", group = "Histogram Color") mom_down2_col = input.color(color.new(color.yellow, 0), title = "-ive Falling Momentum", group = "Histogram Color") iff_1 = mom > nz(mom[1]) ? mom_up1_col : mom_up2_col iff_2 = mom < nz(mom[1]) ? mom_down1_col : mom_down2_col mom_color = mom > 0 ? iff_1 : iff_2 //SQUEEZE DOTS COLOR NoSqz_Col = input.color(color.new(color.green, 0), title = "No Squeeze", group = "Squeeze Dot Color") LowSqz_Col = input.color(color.new(color.black, 0), title = "Low Compression", group = "Squeeze Dot Color") MidSqz_Col = input.color(color.new(color.red, 0), title = "Medium Compression", group = "Squeeze Dot Color") HighSqz_Col = input.color(color.new(color.orange, 0), title = "High Compression", group = "Squeeze Dot Color") sq_color = HighSqz ? HighSqz_Col : MidSqz ? MidSqz_Col : LowSqz ? LowSqz_Col : NoSqz_Col //MULTI TIMEFRAME HISTOGRAM COLOR [HC_1m] = request.security(syminfo.tickerid, "1", [mom_color]) [HC_5m] = request.security(syminfo.tickerid, "5", [mom_color]) [HC_15m] = request.security(syminfo.tickerid, "15", [mom_color]) [HC_30m] = request.security(syminfo.tickerid, "30", [mom_color]) [HC_1H] = request.security(syminfo.tickerid, "60", [mom_color]) [HC_4H] = request.security(syminfo.tickerid, "240", [mom_color]) [HC_D] = request.security(syminfo.tickerid, "D" , [mom_color]) [HC_W] = request.security(syminfo.tickerid, "W" , [mom_color]) [HC_M] = request.security(syminfo.tickerid, "M" , [mom_color]) //MULTI TIMEFRAME SQUEEZE COLOR [SC_1m] = request.security(syminfo.tickerid, "1", [sq_color]) [SC_5m] = request.security(syminfo.tickerid, "5", [sq_color]) [SC_15m] = request.security(syminfo.tickerid, "15", [sq_color]) [SC_30m] = request.security(syminfo.tickerid, "30", [sq_color]) [SC_1H] = request.security(syminfo.tickerid, "60", [sq_color]) [SC_4H] = request.security(syminfo.tickerid, "240", [sq_color]) [SC_D] = request.security(syminfo.tickerid, "D" , [sq_color]) [SC_W] = request.security(syminfo.tickerid, "W" , [sq_color]) [SC_M] = request.security(syminfo.tickerid, "M" , [sq_color]) tableYposInput = input.string("top", "Panel position", options = ["top", "middle", "bottom"]) tableXposInput = input.string("right", "", options = ["left", "center", "right"]) var table TTM = table.new(tableYposInput + "_" + tableXposInput, 10, 2, border_width = 1) TC = input.color(color.new(color.white, 0), "Table Text Color") TS = input.string(size.small, "Table Text Size", options = [size.tiny, size.small, size.normal, size.large]) if barstate.isconfirmed table.cell(TTM, 0, 0, "MOM", text_color = color.new(color.white, 0), bgcolor = color.new(color.gray, 0), text_size = TS) table.cell(TTM, 1, 0, "1m", text_color = TC, bgcolor = HC_1m, text_size = TS) table.cell(TTM, 2, 0, "5m", text_color = TC, bgcolor = HC_5m, text_size = TS) table.cell(TTM, 3, 0, "15m", text_color = TC, bgcolor = HC_15m, text_size = TS) table.cell(TTM, 4, 0, "30m", text_color = TC, bgcolor = HC_30m, text_size = TS) table.cell(TTM, 5, 0, "1H", text_color = TC, bgcolor = HC_1H, text_size = TS) table.cell(TTM, 6, 0, "4H", text_color = TC, bgcolor = HC_4H, text_size = TS) table.cell(TTM, 7, 0, "D", text_color = TC, bgcolor = HC_D, text_size = TS) table.cell(TTM, 8, 0, "W", text_color = TC, bgcolor = HC_W, text_size = TS) table.cell(TTM, 9, 0, "M", text_color = TC, bgcolor = HC_M, text_size = TS) table.cell(TTM, 0, 1, "SQZ", text_color = color.new(color.white, 0), bgcolor = color.new(color.gray, 0), text_size = TS) table.cell(TTM, 1, 1, "1m", text_color = TC, bgcolor = SC_1m, text_size = TS) table.cell(TTM, 2, 1, "5m", text_color = TC, bgcolor = SC_5m, text_size = TS) table.cell(TTM, 3, 1, "15m", text_color = TC, bgcolor = SC_15m, text_size = TS) table.cell(TTM, 4, 1, "30m", text_color = TC, bgcolor = SC_30m, text_size = TS) table.cell(TTM, 5, 1, "1H", text_color = TC, bgcolor = SC_1H, text_size = TS) table.cell(TTM, 6, 1, "4H", text_color = TC, bgcolor = SC_4H, text_size = TS) table.cell(TTM, 7, 1, "D", text_color = TC, bgcolor = SC_D, text_size = TS) table.cell(TTM, 8, 1, "W", text_color = TC, bgcolor = SC_W, text_size = TS) table.cell(TTM, 9, 1, "M", text_color = TC, bgcolor = SC_M, text_size = TS)
Box Samples (Price Ranges)
https://www.tradingview.com/script/U7TJI3zG-Box-Samples-Price-Ranges/
Azzrael
https://www.tradingview.com/u/Azzrael/
112
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Azzrael //@version=5 indicator("Box Samples (Price Ranges) for Azzrael Code YT", overlay=true, max_boxes_count=500) period = input.int(title="Период", defval=50, minval=5) var float[] ranges = array.new_float(0) max = ta.highest(high, period) min = ta.lowest(low, period) rng = (max - min) avg = rng/2 + min var lbox = box.new( 0,0,0,0, bgcolor=na, border_style=line.style_dotted, border_color=color.new(color.blue, 50), text_color=color.new(color.white, 70) ) if bar_index % period == 0 array.push(ranges, rng) med_range = array.median(ranges) is_grow = low[period] < avg and high > avg box.new( bar_index[period], min, bar_index, max, text=str.tostring(min, ".##") + "\n" + str.tostring(rng, ".##") , text_halign=text.align_right, text_valign= is_grow ? text.align_bottom : text.align_top, text_size=size.small, text_color=color.white, border_color=is_grow ? color.green : color.red, border_width=(rng > med_range*1.5) ? 5 : 1, bgcolor=na ) else if barstate.isrealtime or barstate.islast box.set_lefttop(lbox, bar_index[period], min) box.set_rightbottom(lbox, bar_index, max) box.set_text(lbox, str.tostring(rng, ".##"))
TrendLineScalping-Basic
https://www.tradingview.com/script/E0ydgOWU-TrendLineScalping-Basic/
TradeWiseWithEase
https://www.tradingview.com/u/TradeWiseWithEase/
982
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © TradeWiseWithEase //@version=5 indicator(title = "TrendLineScalping-Basic", shorttitle = "TL-Basic",overlay = true) import TradeWiseWithEase/BE_CustomFx_Library/2 as BEL var GroupText1 = "Calcuation Inputs" var GroupText2 = "Display Settings" var GroupText3 = "Trade Settings" LBC = input.int(title="Past Candles to Consider", defval=4, minval=1, inline="1",group=GroupText1) LBF = input.int(title="Future Candles to Consider", defval=2, minval=1, inline="1",group=GroupText1) TrackTL = input.int(title='TL to Track from Past Candles', defval=50, minval=20, maxval=450, inline="2",group=GroupText1) PlotOnType = input.string(defval = 'HL', title = 'Plot Lines On', options = ['HL','OC'], inline="2",group=GroupText2) ColorUp=input.color(title='UpLine',defval=color.lime,inline='3',group=GroupText2) ColorDown=input.color(title='DownLine',defval=color.red,inline='3',group=GroupText2) Linetype = input.string(title='Line Style', options=['solid (─)', 'dotted (┈)', 'dashed (╌)', 'arrow left (←)', 'arrow right (→)', 'arrows both (↔)'], defval='dotted (┈)',group=GroupText2,inline='4') lnSize=input.int(title='Width',defval=1, minval=1, maxval=3,inline='4',group=GroupText2) Repaint = input.bool(defval = false, title = 'Calc on RealTime Bar ?', inline="5",group=GroupText3) sess = input.session(defval = '0930-1510', title = 'Consider Trade During', inline="5",group=GroupText3) SessionTrue = BEL.Chk_TradingTime(sess) // ————— Converts current "timeframe.multiplier" plus the TF into minutes of type float. GetCurrentResInMinutes() => _resInMinutes = timeframe.multiplier * ( timeframe.isseconds ? 1. / 60. : timeframe.isminutes ? 1. : timeframe.isdaily ? 1440. : timeframe.isweekly ? 10080. : timeframe.ismonthly ? 43800. : na) ResBeingLoaded = GetCurrentResInMinutes() // Initiating Temporary Variables which gets reset on each bar Initial_PH = nz(ta.pivothigh( PlotOnType == 'HL' ? BEL.G_CandleInfo("CandleHigh",0,true) : math.max(BEL.G_CandleInfo("CandleOpen",0,true), BEL.G_CandleInfo("CandleClose",0,true)), LBC, LBF),0.0) Initial_PH_Candle = nz(ta.valuewhen(Initial_PH, bar_index[LBF], 0),0) Initial_PL = nz(ta.pivotlow( PlotOnType == 'HL' ? BEL.G_CandleInfo("CandleLow",0,true) : math.min(BEL.G_CandleInfo("CandleOpen",0,true), BEL.G_CandleInfo("CandleClose",0,true)), LBC, LBF),0.0) Initial_PL_Candle = nz(ta.valuewhen(Initial_PL, bar_index[LBF], 0),0) SlowEMA = BEL.G_Indicator_Val("EMA",8, BEL.G_CandleInfo("CandleClose",0,Repaint)) FastEMA = BEL.G_Indicator_Val("EMA",3, BEL.G_CandleInfo("CandleClose",0,Repaint)) StTermDelta = ((FastEMA - SlowEMA) / hlc3 ) * 100 R_Time_SlowEMA = BEL.G_Indicator_Val("EMA",8, BEL.G_CandleInfo("CandleClose",0,true)) R_Time_FastEMA = BEL.G_Indicator_Val("EMA",3, BEL.G_CandleInfo("CandleClose",0,true)) R_Time_StTermDelta = ((FastEMA - SlowEMA) / hlc3 ) * 100 float First_PH = na float First_PL = na int FPH_Bar = na int FPL_Bar = na if BEL.BarToStartYourCalculation(TrackTL) and ResBeingLoaded <= 5 and SessionTrue First_PH := Initial_PH First_PL := Initial_PL FPH_Bar := Initial_PH_Candle FPL_Bar := Initial_PL_Candle var SeriesOf_PH=array.new_float(0) var CandleInfoOf_PH=array.new_int(0) var SeriesOf_PL=array.new_float(0) var CandleInfoOf_PL=array.new_int(0) var R_SeriesOf_PH=array.new_float(0) var R_CandleInfoOf_PH=array.new_int(0) var R_SeriesOf_PL=array.new_float(0) var R_CandleInfoOf_PL=array.new_int(0) var int SizeOfPH_Array = 0 var int SizeOfPL_Array = 0 sizeH = array.size(SeriesOf_PH) sizeL = array.size(SeriesOf_PL) //========================== PIVOT HIGH CALCULATION =============================== if Initial_PH != 0.00 and BEL.BarToStartYourCalculation(TrackTL) and ResBeingLoaded <= 5 and SessionTrue if sizeH == 0 array.push(SeriesOf_PH,Initial_PH) array.push(CandleInfoOf_PH,Initial_PH_Candle) else if Initial_PH_Candle - array.get(CandleInfoOf_PH, sizeH - 1) > 4 and array.get(SeriesOf_PH, sizeH - 1) >= Initial_PH array.push(SeriesOf_PH,Initial_PH) array.push(CandleInfoOf_PH,Initial_PH_Candle) else array.pop(SeriesOf_PH) array.pop(CandleInfoOf_PH) array.push(SeriesOf_PH,Initial_PH) array.push(CandleInfoOf_PH,Initial_PH_Candle) //========================== PIVOT LOW CALCULATION =============================== if Initial_PL != 0.00 and BEL.BarToStartYourCalculation(TrackTL) and ResBeingLoaded <= 5 and SessionTrue if sizeL == 0 array.push(SeriesOf_PL,Initial_PL) array.push(CandleInfoOf_PL,Initial_PL_Candle) else if Initial_PL_Candle - array.get(CandleInfoOf_PL, sizeL - 1) > 4 and array.get(SeriesOf_PL, sizeL - 1) <= Initial_PL array.push(SeriesOf_PL,Initial_PL) array.push(CandleInfoOf_PL,Initial_PL_Candle) else array.pop(SeriesOf_PL) array.pop(CandleInfoOf_PL) array.push(SeriesOf_PL,Initial_PL) array.push(CandleInfoOf_PL,Initial_PL_Candle) SizeOfPH_Array:= array.size(SeriesOf_PH) SizeOfPL_Array:= array.size(SeriesOf_PL) var line[] trend_line=array.new_line(2) var float UpTrendlftval = 0 var float UpTrendrgtval = 0 var int UpLft = 0 var int Uprgt = 0 var float DnTrendlftval = 0 var float DnTrendrgtval = 0 var int DnLft = 0 var int Dnrgt = 0 var bool SetUpPriceLineScan = false var bool SetDnPriceLineScan = false if SizeOfPL_Array == 2 SetUpPriceLineScan:= true UpTrendlftval := array.get(SeriesOf_PL, 0) UpTrendrgtval := array.get(SeriesOf_PL,1) UpLft := array.get(CandleInfoOf_PL, 0) Uprgt := array.get(CandleInfoOf_PL, 1) array.shift(SeriesOf_PL) array.shift(CandleInfoOf_PL) if UpTrendlftval <= UpTrendrgtval line.delete(array.get(trend_line, 0)) array.set(trend_line, 0, line.new(x1 = UpLft, y1 = UpTrendlftval, x2 = Uprgt, y2 = UpTrendrgtval, color = ColorUp, style = BEL.G_Reg_LineType(Linetype), width = lnSize, extend = extend.right)) if SizeOfPH_Array == 2 SetDnPriceLineScan:= true DnTrendlftval := array.get(SeriesOf_PH, 0) DnTrendrgtval := array.get(SeriesOf_PH,1) DnLft := array.get(CandleInfoOf_PH, 0) Dnrgt := array.get(CandleInfoOf_PH, 1) array.shift(SeriesOf_PH) array.shift(CandleInfoOf_PH) if DnTrendlftval >= DnTrendrgtval line.delete(array.get(trend_line, 1)) array.set(trend_line, 1, line.new(x1 = DnLft, y1 = DnTrendlftval, x2 = Dnrgt, y2 = DnTrendrgtval, color = ColorDown, style = BEL.G_Reg_LineType(Linetype), width = lnSize, extend = extend.right)) line UpTrndLine = array.get(trend_line, 0) line DnTrndLine = array.get(trend_line, 1) var float UpTrackPrice = na var float DnTrackPrice = na UpTrackPrice:= SetUpPriceLineScan ? BEL.G_TradableValue(line.get_price(UpTrndLine, bar_index)) : na DnTrackPrice:= SetDnPriceLineScan ? BEL.G_TradableValue(line.get_price(DnTrndLine, bar_index)) : na var bool InTheTrade = false var TradeNo = array.new_int(0) var int TradeNoCounter = 0 var int SizeOfTrades_Array = 0 var TradeEntryCandle = array.new_int(0) var TradeExitCandle = array.new_int(0) var TradeEntryPrice = array.new_float(0) var TradeExitPrice = array.new_float(0) var Trade_Types = array.new_string(0) var string TradeType = "" var int GapCounter = 0 if BEL.G_CandleInfo("CandleClose",0,Repaint) < UpTrackPrice and not InTheTrade and StTermDelta < 0.00 if GapCounter == 0 InTheTrade:= true TradeNoCounter += 1 TradeType := "BrDn -Short" array.push(TradeNo,TradeNoCounter) array.push(TradeEntryCandle,bar_index) array.push(TradeEntryPrice,BEL.G_CandleInfo("CandleClose",0,Repaint)) array.push(Trade_Types,TradeType) else if GapCounter >= 3 InTheTrade:= false GapCounter:= 0 else if BEL.G_CandleInfo("CandleClose",0,Repaint) > DnTrackPrice InTheTrade:= false GapCounter:= 0 else GapCounter += 1 if BEL.isStar() or BEL.isBearishEC() InTheTrade:= true TradeNoCounter += 1 array.push(TradeNo,TradeNoCounter) array.push(TradeEntryCandle,bar_index) array.push(TradeEntryPrice,BEL.G_CandleInfo("CandleClose",0,Repaint)) array.push(Trade_Types,TradeType) if BEL.G_CandleInfo("CandleClose",0,Repaint) > DnTrackPrice and not InTheTrade and StTermDelta > 0.00 if GapCounter == 0 InTheTrade:= true TradeNoCounter += 1 TradeType := "BrOut -Long" array.push(TradeNo,TradeNoCounter) array.push(TradeEntryCandle,bar_index) array.push(TradeEntryPrice,BEL.G_CandleInfo("CandleClose",0,Repaint)) array.push(Trade_Types,TradeType) else if GapCounter >= 3 InTheTrade:= false GapCounter:= 0 else if BEL.G_CandleInfo("CandleClose",0,Repaint) < UpTrackPrice InTheTrade:= false GapCounter:= 0 else GapCounter += 1 if BEL.isStar() or BEL.isBearishEC() InTheTrade:= true TradeNoCounter += 1 TradeType := "BrOut -Long" array.push(TradeNo,TradeNoCounter) array.push(TradeEntryCandle,bar_index) array.push(TradeEntryPrice,BEL.G_CandleInfo("CandleClose",0,Repaint)) array.push(Trade_Types,TradeType) highestDelta = ta.highest(StTermDelta,5) lowestDelta = ta.lowest(StTermDelta,5) smaDelta = BEL.G_Indicator_Val("SMA",5,StTermDelta) if InTheTrade and TradeType == "BrOut -Long" if ta.crossunder(R_Time_StTermDelta,smaDelta) InTheTrade := false array.push(TradeExitCandle,bar_index) array.push(TradeExitPrice,BEL.G_CandleInfo("CandleClose",0,Repaint)) else if InTheTrade and TradeType == "BrDn -Short" if ta.crossover(R_Time_StTermDelta,smaDelta) InTheTrade := false array.push(TradeExitCandle,bar_index) array.push(TradeExitPrice,BEL.G_CandleInfo("CandleClose",0,Repaint)) SizeOfTrades_Array:= array.size(TradeNo) var table MyTable = table.new(position.bottom_left,5,40, border_width = 1, border_color=color.gray, frame_width = 1, frame_color=color.gray) var int NoOfCandles = 0 NoOfCandles += 1 if bar_index == (NoOfCandles - 1) table.cell(MyTable,0,0,"Trade No",text_size=size.normal, text_color= color.red) table.cell(MyTable,1,0,"En Val | Candle",text_size=size.normal, text_color= color.red) table.cell(MyTable,2,0,"Ex Val | Candle",text_size=size.normal, text_color= color.lime) table.cell(MyTable,3,0,"Trade",text_size=size.normal, text_color= color.lime) if SizeOfTrades_Array > 0 for cell = SizeOfTrades_Array - 1 to 0 table.cell(MyTable, 0, cell + 1, str.tostring(array.get(TradeNo, cell)),text_size=size.auto, text_color= color.orange) table.cell(MyTable, 1, cell + 1, str.tostring(array.get(TradeEntryPrice, cell)) + "|" + str.tostring(array.get(TradeEntryCandle, cell)),text_size=size.auto, text_color= color.gray) table.cell(MyTable, 3, cell + 1, str.tostring(array.get(Trade_Types, cell)),text_size=size.auto, text_color= color.red) for cellExit = array.size(TradeExitPrice) - 1 to 0 if array.size(TradeExitPrice) > 0 table.cell(MyTable, 2, cellExit + 1, str.tostring(array.get(TradeExitPrice, cellExit)) + "|" + str.tostring(array.get(TradeExitCandle, cellExit)),text_size=size.auto, text_color= color.gray)
Value traded per day
https://www.tradingview.com/script/XEAcNBSS-Value-traded-per-day/
yourtradingbuddy
https://www.tradingview.com/u/yourtradingbuddy/
26
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © doppelgunner //@version=5 indicator("Value ($)", overlay=false, format=format.volume) //value value = volume * ohlc4 ma_length = input.int(10, "MA Length", minval=1, group="Value MA") ma = ta.sma(value, ma_length) plot_sma = plot(ma, "Value MA", color=color.new(color.orange, 70), style=plot.style_area) plot_value = plot(value, "Value", style=plot.style_columns, color=value > ma ? color.blue : color.gray)
MA Bollinger Bands + RSI (Study)
https://www.tradingview.com/script/8YA3BdLu-MA-Bollinger-Bands-RSI-Study/
LucasVivien
https://www.tradingview.com/u/LucasVivien/
170
study
4
MPL-2.0
// This close code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Special credits: ChartArt / Matthew J. Slabosz / Zen & The Art of Trading // Scipt Author: © LucasVivien //@version=4 study("MA Bollinger Bands + RSI (Study)", shorttitle="MABB+RSI (Stud)", overlay=true) //////////////////////////////////////////////////////////////////////////////// ///////////////////////////////// INPUTS /////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// LongTrades = input(title="Strategy takes Long trades" ,type=input.bool ,defval=true ,group="Trade Directions" ,tooltip="Untick Short trades to trade Longs only") ShortTrades = input(title="Strategy takes Short trades" ,type=input.bool ,defval=true ,group="Trade Directions" ,tooltip="Untick Long trades to trade Shorts only") REenterSL = input(title="Allow Re-Entry after Stops" ,type=input.bool ,defval=false ,group="Trade Directions" ,tooltip="Allow trade re-entry in same direction (as previous trade) if previous trade's stop loss was hit and new signal occurs.") SLenable = input(title="Enable MAE Stop Loss" ,type=input.bool ,defval=false ,group="Stop Loss" ,tooltip="Stop set as % of Max Adverse Excursion (Max Drawdown tolerated) // If turned off, the Strategy will trade a certain direction then close and reverse uppon opposite direction entry signal.") SLprct = input(title="Stop Loss Distance" ,type=input.float ,defval=5.0 ,group="Stop Loss" ,tooltip="Set stop loss further from closing price by x% of trade entry price.") TrailStop = input(title="Enable ATR Trailing Stop" ,type=input.bool ,defval=false ,group="Stop Loss" ,tooltip="Set stop loss as a trailing stop as a % value of current ATR + Overwrite other Stop Losses.") ATRX = input(title="ATR Multiplier" ,type=input.float ,defval=10.0 ,group="Stop Loss" ,tooltip="Increase/decrease to set trailing stop further/closer to trade entry price. Formula = close +/- ATRX * ATR", minval=0.1) ATRlen = input(title="ATR Length" ,type=input.integer ,defval=14 ,group="Stop Loss" ,tooltip="Average True Range lookback", minval=1) UseTPprct = input(title="Enable Target Parameter" ,type=input.bool ,defval=false ,group="Take Profit" ,tooltip="Set take profit target as a fixed percentage from trade entry price") TPprct = input(title="Take Profit %" ,type=input.integer ,defval=10 ,group="Take Profit" ,tooltip="Percentage from entry price to set Take profit targets") REenterTP = input(title="Allow Re-Entry after Take Profit" ,type=input.bool ,defval=false ,group="Take Profit" ,tooltip="Allow trade re-entry in same direction (as previous trade) if previous trade's Take Profit in % was hit and new signal occurs.") UseTrend = input(title="Enable Trend Parameter" ,type=input.bool ,defval=false ,group="Trend Parameter" ,tooltip="Enable trend paramters: No shorts when price > Trend EMA and no longs when price < Trend EMA") TrendEMAlen = input(title="Trend EMA Length" ,type=input.integer ,defval=375 ,group="Trend Parameter" ,tooltip="Trend EMA lookback. security() called 1H SMA. Eg: 1H SMA 375 = 15m SMA 1500") UseVol = input(title="Enable Volatility Parameter" ,type=input.bool ,defval=false ,group="Volatility" ,tooltip="If turned on, a volatility filter is added to trade signals detection: Strategy will not enter trade during extreme high/expanding volatility.") AddVol = input(title="Additionnal Vol. Visuals" ,type=input.bool ,defval=false ,group="Volatility" ,tooltip="Adds additionnal volatility plots lower on the chart scale to visually represent how extreme levels of volatility are defined. To see it along with price chart on same pane, use log scale.") BBvolX = input(title="Vol. Factor" ,type=input.float ,defval=5.0 ,group="Volatility" ,tooltip="Lower to filter out more trades when volatility is high. Setting to max (10) is like not taking Volatility Parameters into account for trade signal detection.", maxval=10, minval=0.1, step=0.1) baselen = input(title="Vol. Base Line Length" ,type=input.integer ,defval=2000 ,group="Volatility" ,tooltip="Base SMA line from wich upper and lower volatility bands (BBvol) are defined.") BBX = input(title="StDev. Multiplier" ,type=input.float ,defval=2.0 ,group="MABB" ,tooltip="Set upper & lower bounds (BB Price) closer / appart", step=0.01, minval=0.001) BBlen = input(title="StDev. Length" ,type=input.integer ,defval=200 ,group="MABB" ,tooltip="Standard deviation lookback") MAlen = input(title="MA Length" ,type=input.integer ,defval=200 ,group="MABB" ,tooltip="Moving average lookback") MAtype = input(title="MA Type" ,type=input.string ,defval="SMA" ,group="MABB" ,tooltip="Type of moving average used for standard deviation", options=["SMA","EMA","WMA","VWMA","HMA"]) RSINlen = input(title="RSI Cross Loockback " ,type=input.integer ,defval=10 ,group="RSI" ,tooltip="How many bars back (from price crossing-over lower bound or crossing-under upper bound) to look for corresponding RSI neutral crossover/under. Setting to max (1000) is like not taking RSI neutral crosses into account for trade signal detection.", minval=0, maxval=1000) RSIN = input(title="RSI Neutral" ,type=input.integer ,defval=50 ,group="RSI" ,tooltip="Defines the level at wich RSI neutral crossover or crossunder occurs. Sometimes, if +/- few points give consistently better results over multiple timeframes, good!") RSIlen = input(title="RSI Length" ,type=input.integer ,defval=6 ,group="RSI" ,tooltip="Relative Strenght Index lookback") UseDateFilter = input(title="Enable Date Filter" ,type=input.bool ,defval=false ,group="Date & Time" ,tooltip="Turns on/off date filter") StartDate = input(title="Start Date Filter" ,type=input.time ,defval=timestamp("1 Jan 2000 00:00 +0000") ,group="Date & Time" ,tooltip="Date & time to start excluding trades") EndDate = input(title="End Date Filter" ,type=input.time ,defval=timestamp("1 Jan 2100 00:00 +0000") ,group="Date & Time" ,tooltip="Date & time to stop excluding trades") UseTimeFilter = input(title="Enable Time Session Filter" ,type=input.bool ,defval=false ,group="Date & Time" ,tooltip="Turns on/off time session filter") TradingSession = input(title="Trading Session" ,type=input.session ,defval="1000-2200:1234567" ,group="Date & Time" ,tooltip="No trades will be taken outside of this range") //////////////////////////////////////////////////////////////////////////////// ////////////////////////////////// SIGNALS ///////////////////////////////// //////////////////////////////////////////////////////////////////////////////// ////////////////// Bollinger Bands ////////////////// BBdev = stdev (close, BBlen) * BBX MA = sma (close, MAlen) if MAtype == "HMA" MA := hma (close, MAlen) if MAtype == "WMA" MA := wma (close, MAlen) if MAtype == "EMA" MA := ema (close, MAlen) if MAtype == "VWMA" MA := vwma (close, MAlen) BBupper = MA + BBdev BBlower = MA - BBdev BBbull = open < BBlower and close > BBlower BBbear = open > BBupper and close < BBupper ////////////////// Relative Strength Index ////////////////// RSI = rsi (close, RSIlen) RSIcrossover = crossover (RSI, RSIN) RSIcrossunder = crossunder(RSI, RSIN) RSIbull = false for i = 0 to RSINlen if RSIcrossover[i] == true RSIbull := true RSIbear = false for i = 0 to RSINlen if RSIcrossunder[i] == true RSIbear := true ////////////////// Volatility ////////////////// BBvol = BBupper - BBlower SignalLine = sma(BBvol, 50) BaseLine = sma(BBvol, 2000) HighVolLvl = BaseLine + BaseLine * BBvolX/10 LowVolLvl = BaseLine - BaseLine * BBvolX/10 var volExtrmHigh = false var volExtrmLow = false if BBvol > HighVolLvl and UseVol volExtrmHigh := true else volExtrmHigh := false if BBvol < LowVolLvl and UseVol volExtrmLow := true else volExtrmLow := false ////////////////// Date and Time ////////////////// In(t) => na(time(timeframe.period, t)) == false TimeFilter = (UseTimeFilter and not In(TradingSession)) or not UseTimeFilter DateFilter = time >= StartDate and time <= EndDate DateTime = (UseDateFilter ? not DateFilter : true) and (UseTimeFilter ? In(TradingSession) : true) ////////////////// Trend Following Parameters ////////////////// var BullTrend = false var BearTrend = false var GoLongs = true var GoShorts = true // Trend Definition TrendEMA = security(syminfo.tickerid, "60", ema(close, TrendEMAlen)[barstate.isrealtime ? 1 : 0]) if close > TrendEMA BullTrend := true BearTrend := false if close < TrendEMA BearTrend := true BullTrend := false if BullTrend and UseTrend GoShorts := false GoLongs := true if BearTrend and UseTrend GoLongs := false GoShorts := true ////////////////// Combined validation ////////////////// longsignal = BBbull and RSIbull and not volExtrmHigh and DateTime shortsignal = BBbear and RSIbear and not volExtrmHigh and DateTime longsignalonly = longsignal and LongTrades shortsignalonly = shortsignal and ShortTrades //////////////////////////////////////////////////////////////////////////////// /////////////////////////////// STOP LOSSES /////////////////////////////// //////////////////////////////////////////////////////////////////////////////// ////////////////// Determine Signal Direction Change ////////////////// var lastsignalislong = false var lastsignalisshort = false if longsignal lastsignalislong := true lastsignalisshort := false if shortsignal lastsignalislong := false lastsignalisshort := true var newtradedirection = false if lastsignalislong == true and lastsignalislong[1] == false or lastsignalisshort == true and lastsignalisshort[1] == false newtradedirection := true else newtradedirection := false ////////////////// Stop losses calculations ////////////////// // MAE Stop LongSL = close - close * SLprct / 100 ShortSL = close + close * SLprct / 100 // Trailing Stop ATR = atr (ATRlen) Stop = ATRX * ATR LongTrailSL = close - Stop ShortTrailSL = close + Stop ////////////////// LSF Identifier ////////////////// var LSF = 0 var longSLhit = false var shortSLhit = false // Set LSF to Long or Short if new direction if (longsignal[1] and newtradedirection[1] and not UseTrend) or (longsignal[1] and newtradedirection[1] and UseTrend and BullTrend) LSF := 1 if (shortsignal[1] and newtradedirection[1] and not UseTrend) or (shortsignal[1] and newtradedirection[1] and UseTrend and BearTrend) LSF := -1 // Set LSF to Long or Short if re-entry if LSF[1] == 0 and longsignal[1] and REenterSL and not UseTrend or (LSF[1] == 0 and longsignal[1] and REenterSL and UseTrend and BullTrend) LSF := 1 if LSF[1] == 0 and shortsignal[1] and REenterSL and not UseTrend or (LSF[1] == 0 and shortsignal[1] and REenterSL and UseTrend and BearTrend) LSF := -1 ////////////////// Stop losses application conditions ////////////////// // Long Stops var LongEntryPrice = 0.0 var SLlongsaved = 0.0 var TrailSLlongsaved = 0.0 if longsignal and newtradedirection or longsignal and LSF[1] == 0 LongEntryPrice := close if SLenable and not TrailStop SLlongsaved := LongSL if TrailStop TrailSLlongsaved := LongTrailSL if LSF[1] > 0 TrailSLlongsaved := max(TrailSLlongsaved[1], close - Stop) // Short Stops var ShortEntryPrice = 0.0 var SLshortsaved = 0.0 var TrailSLshortsaved = 0.0 if shortsignal and newtradedirection or shortsignal and LSF[1] == 0 ShortEntryPrice := close if SLenable and not TrailStop SLshortsaved := ShortSL if TrailStop TrailSLshortsaved := ShortTrailSL if LSF[1] < 0 TrailSLshortsaved := min(TrailSLshortsaved[1], close + Stop) ////////////////// SLF conditions after SL hit ////////////////// // Set LSF to Flat if SL was hit if (LSF[1] > 0 and SLenable and not TrailStop and low < SLlongsaved) or (LSF[1] > 0 and TrailStop and low < TrailSLlongsaved) or (LSF[1] > 0 and UseTrend and shortsignal and newtradedirection) LSF := 0 if (LSF[1] < 0 and SLenable and not TrailStop and high > SLshortsaved) or (LSF[1] < 0 and TrailStop and high > TrailSLshortsaved) or (LSF[1] < 0 and UseTrend and longsignal and newtradedirection) LSF := 0 // Plot where SL was hit if LSF[1] > 0 and LSF == 0 longSLhit := true else longSLhit := false if LSF[1] < 0 and LSF == 0 shortSLhit := true else shortSLhit := false ////////////////// Take profit as % of entry price ////////////////// LongTPprct = LongEntryPrice + LongEntryPrice * TPprct/100 ShortTPprct = ShortEntryPrice - ShortEntryPrice * TPprct/100 var LongTPprctsaved = 0.0 var ShortTPprctsaved = 0.0 var longTPhit = false var shortTPhit = false if LSF[1] > 0 and UseTPprct LongTPprctsaved := LongTPprct else LongTPprctsaved := na if LSF[1] < 0 and UseTPprct ShortTPprctsaved := ShortTPprct else ShortTPprctsaved := na // Set LSF to Flat if TP was hit if (LSF[1] > 0 and UseTPprct and high > LongTPprctsaved) LSF := 0 if (LSF[1] < 0 and UseTPprct and low < ShortTPprctsaved) LSF := 0 // Set LSF to Long or Short if re-entry if LSF[1] == 0 and longsignal[1] and REenterTP LSF := 1 if LSF[1] == 0 and shortsignal[1] and REenterTP LSF := -1 // Plot where TP was hit if LSF[1] > 0 and LSF == 0 and UseTPprct longTPhit := true else longTPhit := false if LSF[1] < 0 and LSF == 0 and UseTPprct shortTPhit := true else shortTPhit := false //////////////////////////////////////////////////////////////////////////////// ////////////////////////////////// PLOTS /////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// ////////////////// Signals ////////////////// (2 are study() specific) plotchar(longsignal and not newtradedirection and GoLongs, title="Long Signal" , char='⬆', location=location.belowbar, size=size.tiny, color=#3064fc) plotchar(shortsignal and not newtradedirection and GoShorts, title="Short Signal", char='⬇', location=location.abovebar, size=size.tiny, color=#fc1049) plotchar(longsignal and LongTrades and newtradedirection and GoLongs, title="New Direction Long Signal" , char='⬆', location=location.belowbar, size=size.small, color=#3064fc) plotchar(shortsignal and ShortTrades and newtradedirection and GoShorts, title="New Direction Short Signal", char='⬇', location=location.abovebar, size=size.small, color=#fc1049) ////////////////// Stop Losses ////////////////// // MAE Stop plot(SLenable and not TrailStop and longsignal and GoLongs and (newtradedirection or LSF[1] == 0) ? SLlongsaved : na, title="Long MAE Stop Start" , color=color.red, style=plot.style_linebr, linewidth=6) plot(SLenable and not TrailStop and shortsignal and GoShorts and (newtradedirection or LSF[1] == 0) ? SLshortsaved : na, title="Short MAE Stop Start", color=color.red, style=plot.style_linebr, linewidth=6) plot(SLenable and not TrailStop ? SLlongsaved : na, title="Long MAE Stop" , color= LSF[1] > 0 and SLlongsaved < LongEntryPrice ? color.red : LSF[1] > 0 and SLlongsaved > LongEntryPrice ? color.green : color.rgb(0,0,0,100), style=plot.style_linebr) plot(SLenable and not TrailStop ? SLshortsaved : na, title="Short MAE Stop", color= LSF[1] < 0 and SLshortsaved > ShortEntryPrice ? color.red : LSF[1] < 0 and SLshortsaved < ShortEntryPrice ? color.green : color.rgb(0,0,0,100), style=plot.style_linebr) // Trailing Stop plot(TrailStop and longsignal and GoLongs and (newtradedirection or LSF[1] == 0) ? TrailSLlongsaved : na, title="Long Trailing Start" , color=color.orange, style=plot.style_linebr, linewidth=6) plot(TrailStop and shortsignal and GoShorts and (newtradedirection or LSF[1] == 0) ? TrailSLshortsaved : na, title="Short Trailing Start", color=color.orange, style=plot.style_linebr, linewidth=6) plot(TrailStop ? TrailSLlongsaved : na, title="Long Trailing Stop" ,color= LSF[1] > 0 and TrailSLlongsaved < LongEntryPrice ? color.red : LSF[1] > 0 and TrailSLlongsaved > LongEntryPrice ? color.green : color.rgb(0,0,0,100)) plot(TrailStop ? TrailSLshortsaved : na, title="Short Trailing Stop",color= LSF[1] < 0 and TrailSLshortsaved > ShortEntryPrice ? color.red : LSF[1] < 0 and TrailSLshortsaved < ShortEntryPrice ? color.green : color.rgb(0,0,0,100)) // Plots: SL & TP hits (study() specific) plot(longSLhit and SLenable and not TrailStop ? SLlongsaved : longSLhit and TrailStop ? TrailSLlongsaved : na, title="Long SL hit (price)" ,color=#d40df6, style=plot.style_linebr, linewidth=6) plot(shortSLhit and SLenable and not TrailStop ? SLshortsaved : shortSLhit and TrailStop ? TrailSLshortsaved : na, title="Short SL hit (price)",color=#d40df6, style=plot.style_linebr, linewidth=6) plotchar(longSLhit or (LongTrades and not ShortTrades and not longsignal and newtradedirection) or (high > LongTPprctsaved), title="Long SL hit (char)" ,color=#d40df6, location=location.abovebar, size=size.small, char='⤓') plotchar(shortSLhit or (ShortTrades and not LongTrades and not shortsignal and newtradedirection) or (low < ShortTPprctsaved), title="Short SL hit (char)" ,color=#d40df6, location=location.belowbar, size=size.small, char='⤒') ////////////////// Bollinger Bands ////////////////// plot(MA, title="Moving Average" , color=color.new(color.white, 50)) PriceUpperLine = plot(BBupper,title="BBprice Upper", color=color.new(color.gray, transp=60)) PriceLowerLine = plot(BBlower,title="BBprice Lower", color=color.new(color.gray, transp=60)) fill(PriceUpperLine, PriceLowerLine, title="BBprice Fill", color = volExtrmHigh and BBvol > BBvol[1] ? color.new(#ff1010, transp=70) : volExtrmHigh and BBvol < BBvol[1] ? color.new(#ff1010, transp=75) : volExtrmLow and BBvol < BBvol[1] ? color.new(#10ff10, transp=70) : volExtrmLow and BBvol > BBvol[1] ? color.new(#10ff10, transp=75) : color.new(color.white, transp=90)) ////////////////// Volatility ////////////////// plot(UseVol and AddVol ? BBvol : na, title="BBvol" ,color=color.new(color.blue, 10)) plot(UseVol and AddVol ? SignalLine : na, title="Signal Line" ,color=color.new(color.fuchsia, 10)) plot(UseVol and AddVol ? BaseLine : na, title="Base Line" ,color=color.new(color.yellow, 10)) VolUpperLine = plot(UseVol and AddVol ? HighVolLvl : na, title="BBvol Upper" ,color=color.new(color.yellow, 70)) VolLowerLine = plot(UseVol and AddVol ? LowVolLvl : na, title="BBvol Lower" ,color=color.new(color.yellow, 70)) fill(VolUpperLine, VolLowerLine, title="BBvol Fill", color=color.new(color.yellow, transp=98)) ////////////////// Date and/or Time exclusion ////////////////// bgcolor(DateFilter and UseDateFilter ? color.rgb(255,70,70,85) : na, title="Date Filter") bgcolor(TimeFilter and UseTimeFilter ? color.rgb(255,70,70,85) : na, title="Time Filter") ////////////////// Take Profits ////////////////// plot(LongTPprctsaved , color=color.green, style=plot.style_linebr) plot(ShortTPprctsaved, color=color.green, style=plot.style_linebr) ////////////////// Trend EMA ////////////////// plot(UseTrend ? TrendEMA : na, title="Trend EMA" ,color= BullTrend ? #00ff50 : BearTrend ? #ff0050 : na, linewidth=2) //////////////////////////////////////////////////////////////////////////////// ////////////////////////////////// ALERTS ////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// ////////////////// New trade direction ////////////////// alertcondition(condition = longsignal and newtradedirection, title = "MABB+RSI Long Signal" , message = "{{timenow}} - {{exchange}}:{{ticker}} (TF:{{interval}}) - Price: {{close}} - Close above lower bound & RSI crossover neutral line - TRADE DIRECTION REVERSE FROM SHORT TO LONG") alertcondition(condition = shortsignal and newtradedirection, title = "MABB+RSI Short Signal", message = "{{timenow}} - {{exchange}}:{{ticker}} (TF:{{interval}}) - Price: {{close}} - Close below upper bound & RSI crossunder neutral line - TRADE DIRECTION REVERSE FROM LONG TO SHORT") ////////////////// SL Hit ////////////////// alertcondition(condition = longSLhit, title = "MABB+RSI Long STOP Activated" , message = "{{timenow}} - {{exchange}}:{{ticker}} (TF:{{interval}}) - Price: {{close}} - Low < Long Stop - TRADE HAS BEEN STOPPED") alertcondition(condition = shortSLhit, title = "MABB+RSI Short STOP Activated", message = "{{timenow}} - {{exchange}}:{{ticker}} (TF:{{interval}}) - Price: {{close}} - High > Short Stop - TRADE HAS BEEN STOPPED") ////////////////// Re-entry trades ////////////////// alertcondition(condition = longsignal and LSF == 0 and REenterSL, title = "MABB+RSI Long Re-Entry Signal" , message = "{{timenow}} - {{exchange}}:{{ticker}} (TF:{{interval}}) - Price: {{close}} - Close above lower bound & RSI crossover neutral line - LONG RE-ENTRY AFTER LAST LONG WAS STOPPED") alertcondition(condition = shortsignal and LSF == 0 and REenterSL, title = "MABB+RSI Short Re-Entry Signal", message = "{{timenow}} - {{exchange}}:{{ticker}} (TF:{{interval}}) - Price: {{close}} - Close below upper bound & RSI crossunder neutral line - SHORT RE-ENTRY AFTER LAST SHORT WAS STOPPED") ////////////////// All signals ////////////////// alertcondition(condition = longsignal , title = "MABB+RSI Long Signal (all)" , message = "{{timenow}} - {{exchange}}:{{ticker}} (TF:{{interval}}) - Price: {{close}} - Close above lower bound & RSI crossover neutral line") alertcondition(condition = shortsignal, title = "MABB+RSI Short Signal (all)", message = "{{timenow}} - {{exchange}}:{{ticker}} (TF:{{interval}}) - Price: {{close}} - Close below upper bound & RSI crossunder neutral line") //////////////////////////////////////////////////////////////////////////////// // /////////////////////////// STRATEGY ENTRY/EXIT //////////////////////////// // //////////////////////////////////////////////////////////////////////////////// // ////////////////// Longs ////////////////// // if longsignalonly and newtradedirection and GoLongs // strategy.entry(id="Long" ,long=true) // strategy.exit (id="Long exit1" ,from_entry="Long", // stop = SLenable and not TrailStop ? SLlongsaved : TrailStop ? TrailSLlongsaved : newtradedirection ? BBupper : na, // limit = UseTPprct ? LongTPprctsaved : UseTrend and newtradedirection ? BBupper : na, // when = LSF[1] > 0) // if longsignalonly and LSF[1] == 0 and (REenterSL or REenterTP) and GoLongs // strategy.entry(id="Long after SL" ,long=true) // strategy.exit (id="Long exit2" ,from_entry="Long after SL", // stop = SLenable and not TrailStop ? SLlongsaved : TrailStop ? TrailSLlongsaved : newtradedirection ? BBupper : na, // limit = UseTPprct ? LongTPprctsaved : UseTrend and newtradedirection ? BBupper : na, // when = LSF[1] > 0) // ////////////////// Shorts ////////////////// // if shortsignalonly and newtradedirection and GoShorts // strategy.entry(id="Short" ,long=false) // strategy.exit (id="Short exit1" ,from_entry="Short", // stop = SLenable and not TrailStop ? SLshortsaved : TrailStop ? TrailSLshortsaved : newtradedirection ? BBlower : na, // limit = UseTPprct ? ShortTPprctsaved : UseTrend and newtradedirection ? BBlower : na, // when = LSF[1] < 0) // if shortsignalonly and LSF[1] == 0 and (REenterSL or REenterTP) and GoShorts // strategy.entry(id="Short after SL" ,long=false) // strategy.exit (id="Short exit2" ,from_entry="Short after SL", // stop = SLenable and not TrailStop ? SLshortsaved : TrailStop ? TrailSLshortsaved : newtradedirection ? BBlower : na, // limit = UseTPprct ? ShortTPprctsaved : UseTrend and newtradedirection ? BBlower : na, // when = LSF[1] < 0) //////////////////////////////////////////////////////////////////////////////// /////////////////////////// UNUSED CODE & NOTES //////////////////////////// //////////////////////////////////////////////////////////////////////////////// ////////////////// User input ////////////////// // RSIlvlOB = input(title="RSI Overbough" ,type=input.integer, defval=70 , group="RSI") // RSIlvlOS = input(title="RSI Oversold" ,type=input.integer, defval=30 , group="RSI") // // Potential use of latest swing high/low as as base for trailing stop (taken out: not good perf. on all TF) // SwingHL = input(title="Swing H/L as T. Stop base ?",type=input.bool ,defval=false ,group="Stop Loss" ,tooltip="If turned on, ATR will draw from latest swing high or swing low (within lookback period). If turned off, ATR will draw from trade entry signal closing price") // Swinglen = input(title="Swings H/L Lookback" ,type=input.integer ,defval=10 ,group="Stop Loss" ,tooltip="How many bars back (from trade entry signal) to look for last swing high or swing low", minval=0, maxval=1000) // Indicators // SwingHigh= highest(high , Swinglen) // SwingLow = lowest (low , Swinglen) // // Find use for SMA signal line on BBvol (change hard coded value (50) in plot(SignalLine) if input is back on) // signallen = input(title="Vol. Signal Line Length" ,type=input.integer ,defval=50 ,group="Volatility",tooltip="Does nothing at the moment but might become useful someday ^^") ////////////////// Count Variables ////////////////// // // Long and Short SIGNAL count // var longsignalcount = 0 // var shortsignalcount = 0 // if longsignal // longsignalcount := longsignalcount + 1 // if shortsignal // shortsignalcount := shortsignalcount + 1 // // Long and Short EXIT count // var longexitcount = 0 // var shortexitcount = 0 // if LSF[1] == 0 and LSF[1] > 0 // longexitcount := longexitcount + 1 // if LSF[1] == 0 and LSF[1] < 0 // shortexitcount := shortexitcount + 1 ////////////////// Plot string to chart with labels ////////////////// // lblcheck= input(title="Label bar Index" , type=input.integer , defval=1728) // lab1 = label.new(bar_index[lblcheck], close[lblcheck]*1.05, color=color.yellow, text= // "Last signal is LONG: " + tostring(lastsignalislong) + " /// " + "Last signal is SHORT: " + tostring(lastsignalisshort), style=label.style_label_down) // if barstate.isrealtime // lab1 // label.delete(lab1[1]) // lab2 = label.new(bar_index[lblcheck], close[lblcheck]*.95, color=color.yellow, text=newtradedirection[lblcheck] ? "NEW TRADE DIRECTION" : na, style=label.style_label_up) // if barstate.isrealtime // lab2 // label.delete(lab2[1]) ////////////////// Plot Price bands directions ////////////////// // plot(BBupper > BBupper[1] ? 100 : na, color=color.green, style=plot.style_linebr, linewidth=3) // plot(BBupper < BBupper[1] ? 100 : na, color=color.red, style=plot.style_linebr, linewidth=3) // plot(BBlower > BBlower[1] ? 10 : na, color=color.green, style=plot.style_linebr, linewidth=3) // plot(BBlower < BBlower[1] ? 10 : na, color=color.red, style=plot.style_linebr, linewidth=3) // plot(BBvol > BBvol[1] ? 1 : na, color=color.blue, style=plot.style_linebr, linewidth=3) // plot(BBvol < BBvol[1] ? 1 : na, color=color.fuchsia, style=plot.style_linebr, linewidth=3) //// yeah right... ^^ (really need to practice for loops) // avgboundsdistance = 0.0 // avgboundsdistancelookback = input(title="AVG boud distance lookback",type=input.integer ,defval=10 ,group="MABB" ,tooltip="", minval=0, maxval=1000) // for i = 0 to avgboundsdistancelookback // avgboundsdistance := (BBupper[i] - BBlower[i]) // plot(avgboundsdistance) ////////////////// Plots ////////////////// // // Signals count // plot(longsignalcount, color=color.green) // plot(shortsignalcount, color=color.red) // // Trade Exits count // plot(longexitcount, color=color.yellow) // plot(shortexitcount, color=color.orange) // // Others // plot(sma(close, 500), color=color.fuchsia) // plot(LSF, color=color.fuchsia) // plot(strategy.position_size, title="Position_size check") // ------------------------------------------------------------ CONTRUCTION ZONE ------------------------------------------------------------ // // ------------------------------------------------------------ CONTRUCTION ZONE ------------------------------------------------------------ //
Nasdaq VXN Volatility Warning Indicator
https://www.tradingview.com/script/eGYw6XU4-Nasdaq-VXN-Volatility-Warning-Indicator/
TradeAutomation
https://www.tradingview.com/u/TradeAutomation/
58
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // @version = 5 // Author = TradeAutomation indicator("Nasdaq VXN Volatility Warning Indicator", shorttitle="Nasdaq VXN Volatility Warning") // Pulls in Nasdaq Volatility VXN data res = input.timeframe(title="VXN Resolution", defval="60") vxn = request.security("CBOE:VXN", res, high) // Calculates the Variance and Defines the Volatility Warning mean = ta.sma(vxn, input.int(2400, "Mean Length For Variance Calc")) SquaredDifference = math.pow(vxn-mean, 2) VolWarningLength = input.int(20, "Sustain Warning For X Bars", step=5) SquaredDifferenceThreshold = input.int(150, "Variance Threshold", tooltip="The indicator will go up once the variance exceeds this threshold") VolatilityWarning = ta.highest(SquaredDifference, VolWarningLength)>SquaredDifferenceThreshold Warning = VolatilityWarning ? 1 : 0 // Plot PlotVarianceInput = input.bool(false, "Plot the Variance?") IndicatorColor = Warning > 0.5 ? color.red : Warning < 0.5 ? color.purple : na plot(Warning, color=IndicatorColor, linewidth=2) VariancePlot = PlotVarianceInput == true ? SquaredDifference : na plot(VariancePlot, color=color.purple) hline(input(1, "Custom H-Line"))
RedK Momentum Bars (RedK Mo_Bars)
https://www.tradingview.com/script/O52gURXf-RedK-Momentum-Bars-RedK-Mo-Bars/
RedKTrader
https://www.tradingview.com/u/RedKTrader/
3,265
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © RedKTrader //@version=5 indicator('[dev]RedK Momentum Bars', shorttitle='RedK MoBars v3.0', explicit_plot_zorder = true, timeframe='', timeframe_gaps=false) // A trading system composed of 2 short Lazy Lines (preferably one open and one close - 2-3 bars apart) and a WMA long filter // loosely inspired by Edler Impulse // v2.0 cleaned up code and added MA options to be able to mix and match, and experiment with various setups // default values (my personal preference) remain the same as in v1.0 // for example, some traders will consider "bear territory" only below SMA50, others will use EMA30 .. and so on. // --------------------------------------------------------------------------------------------------------------- // MoBars v3.0: // updated defaults to match the most common 3x MA cross-over set-up of SMA (10, 20, 50) // updated visuals to push the 0 line to the background of the plot (using the explcit_plot_zorder param) // and added alerts for crossing up, down and swing around the 0 line (the Bullish/Bearish Filter MA) //============================================================================== f_LazyLine(_data, _length) => w1 = 0, w2 = 0, w3 = 0 L1 = 0.0, L2 = 0.0, L3 = 0.0 w = _length / 3 if _length > 2 w2 := math.round(w) w1 := math.round((_length - w2) / 2) w3 := int((_length - w2) / 2) L1 := ta.wma(_data, w1) L2 := ta.wma(L1, w2) L3 := ta.wma(L2, w3) else L3 := _data L3 //============================================================================== // ============================================================================= f_getMA(source, length, type) => type == "SMA" ? ta.sma(source, length) : type == "EMA" ? ta.ema(source, length) : type == "WMA" ? ta.wma(source, length) : type == "HMA" ? ta.hma(source, length) : f_LazyLine(source, length) // ============================================================================= // ------------------------------------------------------------------------------------------------ // Inputs // Note, in v3.0, changed default lengths to 10, 20 and 50 -- and all MA types to SMA. // ------------------------------------------------------------------------------------------------ Fast_Src = input.source(close, title='Fast MA Source', inline = 'Fast') Fast_Length = input.int(10, title = 'Length', minval = 1, inline = 'Fast') Fast_Type = input.string('SMA', title = 'Type', inline = 'Fast', options = ['RSS_WMA', 'WMA', 'EMA', 'SMA', 'HMA']) Slow_Src = input.source(close, title='Slow MA Source', inline = 'Slow') Slow_Length = input.int(20, title='Length', minval = 1, inline = 'Slow') Slow_Type = input.string('SMA', title = 'Type', inline = 'Slow', options = ['RSS_WMA', 'WMA', 'EMA', 'SMA', 'HMA']) Slow_Delay = input.int(3, title='Delay (1 = None)', minval = 1) Fil_Length = input.int(50, title='Filter MA Length', minval = 1, inline = 'Filter') Fil_Type = input.string('SMA', title = 'Type', inline = 'Filter', options = ['RSS_WMA', 'WMA', 'EMA', 'SMA', 'HMA']) // ------------------------------------------------------------------------------------------------ // Calculation // ------------------------------------------------------------------------------------------------ Fast = f_getMA(Fast_Src, Fast_Length, Fast_Type) Slow = f_getMA(Slow_Src, Slow_Length, Slow_Type) Filter = f_getMA(close, Fil_Length, Fil_Type) Fast_M = Fast - Filter Slow_M = Slow - Filter Rel_M = ta.wma(Slow_M, Slow_Delay) // prep the Momentum bars o = Rel_M c = Fast_M h = math.max(o, c) l = math.min(o, c) rising = ta.change(c) > 0 // ------------------------------------------------------------------------------------------------ // Colors & Plots // ------------------------------------------------------------------------------------------------ hline(0, title = 'Zero Line', color = color.blue, linestyle = hline.style_solid) c_barup = #11ff20ff c_bardn = #ff1111ff c_bardj = #ffffffff c_barupb = #1b5e20ff c_bardnb = #981919ff c_bardjb = #9598a1ff barcolor = c > o and rising ? c_barup : c < o and not rising ? c_bardn : c_bardj borcolor = c > o and rising ? c_barupb : c < o and not rising ? c_bardnb : c_bardjb plotcandle(o, h, l, c, 'MoBars', barcolor, barcolor, bordercolor = borcolor) // =========================================================================================================== // v3.0 adding alerts // these alerts will trigger as soon as the Momentum Bar touches above the filter line // this approach can lead to "false signals" but also has an advantage (of alerting to a possible mood/mode change) // another option - maybe in an updated version - could be to trigger alerts *only* when the full Momentum Bar completely clears the filter line (above or below) // and it's easy to make that a user choice in the study inputs // =========================================================================================================== Alert_up = ta.crossover(h,0) Alert_dn = ta.crossunder(l,0) Alert_swing = Alert_up or Alert_dn // "." in alert title for the alerts to show in the right order up/down/swing alertcondition(Alert_up, ". MoBars Crossing 0 Up", "MoBars Up - Bullish Mode Detected!") alertcondition(Alert_dn, ".. MoBars Crossing 0 Down", "MoBars Down - Bearish Mode Detected!") alertcondition(Alert_swing, "... MoBars Crossing 0", "Mobars Swing - Possible Reversal Detected!")
rth vwap
https://www.tradingview.com/script/WUTjhnEW-rth-vwap/
ldbc
https://www.tradingview.com/u/ldbc/
42
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © ldbc //@version=4 study("rth vwap", overlay=true) input_rth = input("0930-1600", type=input.session, title="Regular Session Time (EST)", tooltip="If you want to get full session (including overnight) high/low values, then change the regular session interval. For example, on a 5-mninute chart, 1800-1655 will provide the high and low for the full daily session.") rth_session = time("1440",str.format("{0}:23456", input_rth), "America/New_York") // RTH High/Low var float rth_vwap = na var float rth_p = na var float rth_vol = na if rth_session if not rth_session[1] rth_p := hlc3 * volume rth_vol := volume rth_vwap := hlc3 else rth_p := rth_p[1] + hlc3 * volume rth_vol := rth_vol[1] + volume rth_vwap := rth_p / rth_vol else rth_vwap := na // Plots rth_vwap_plot = plot(rth_session ? rth_vwap : na, title="rth_vwap", color = #00FFFFDD, linewidth=2, style=plot.style_linebr)
SuperJump Multi Time Frame Heiken Ashi Color
https://www.tradingview.com/script/sCJ83EGp/
SuperJump
https://www.tradingview.com/u/SuperJump/
72
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © SuperJump //@version=5 indicator("SuperJump Multi Time Frame Heiken Ashi Color",shorttitle="SJump Heiken Color", overlay=true) TopAreaRes = input.timeframe(title="Top Area Time Frame",defval="") BotAreaRes = input.timeframe(title="Bottom Area Time Fame",defval="15") IsActiveBotArea = input.bool(title="Auto Time Frame for Bottom Area", defval = false) BotTF1 = input.timeframe(title="Input TF", defval = "5", inline = '1') BotTF1T = input.timeframe(title=" > Convert TF", defval = "15", inline = '1') BotTF2 = input.timeframe(title="Input TF", defval = "15", inline = '2') BotTF2T = input.timeframe(title=" > Convert TF", defval = "60", inline = '2') BotTF3 = input.timeframe(title="Input TF", defval = "60", inline = '3') BotTF3T = input.timeframe(title=" > Convert TF", defval = "240", inline = '3') TargetBottomRes = IsActiveBotArea == false ? BotAreaRes : timeframe.period == BotTF1 ? BotTF1T : timeframe.period == BotTF2 ? BotTF2T : timeframe.period == BotTF3 ? BotTF3T : "" [hkOpen, hkHigh, hkLow, hkClose] = request.security(ticker.heikinashi(syminfo.tickerid), TopAreaRes, [open, high, low, close]) haColor = hkClose > hkOpen ? hkLow == hkOpen ? color.green : color.new(#26a69a,50) : hkHigh==hkOpen ? color.red : color.new(#ef5350,50) plotshape(hkOpen,style=shape.square,color=haColor,location=location.top,size=size.tiny,title = "Top Area Heiken Color") [bhkOpen, bhkHigh, bhkLow, bhkClose] = request.security(ticker.heikinashi(syminfo.tickerid), TargetBottomRes, [open, high, low, close]) bhaColor = bhkClose > bhkOpen ? bhkLow == bhkOpen ? color.green : color.new(#26a69a,50) : bhkHigh==bhkOpen ? color.red : color.new(#ef5350,50) plotshape(bhkOpen,style=shape.square,color=bhaColor,location=location.bottom,size=size.tiny,title = "Bottom Area Heiken Color") alertcondition(hkClose > hkOpen and hkLow == hkOpen ,"TOP 양봉"," TOP 꽉찬 양봉" ) alertcondition(hkClose < hkOpen and hkHigh==hkOpen ,"TOP 음봉", "TOP 꽉찬 음봉" ) alertcondition(bhkClose > bhkOpen and bhkLow == bhkOpen ,"BOTTOM 양봉","BOTTOM 꽉찬 양봉" ) alertcondition(bhkClose < bhkOpen and bhkHigh==bhkOpen ,"BOTTOM 음봉", "BOTTOM 꽉찬 음봉" )
Imbalance Identifier With Target Box
https://www.tradingview.com/script/UKsOdaJD-Imbalance-Identifier-With-Target-Box/
Travelling_Trader
https://www.tradingview.com/u/Travelling_Trader/
548
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Travelling_Trader //@version=5 indicator('Imbalance Finder With Pip Target Box', overlay=true, max_lines_count=500) showema = input(defval=true, title='Show all EMAs', group='Plot EMA ') Overridetargetsize = input(defval=false, title='Change Standard Target Size', group='Targets') Targetssize = input.float(title='Pips for Target', defval=0.0001, minval=0.0001, group = 'Targets') color black100 = color.new(color.black,100) color green75 = color.new(color.green,75) color green0 = color.new(color.green,0) color aqua0 = color.new(color.aqua, 0) color black0 = color.new(color.black, 0) color blue0 = color.new(#0F52BA, 0) color gray0 = color.new(color.gray, 0) color orange0 = color.new(#FF8C00,0) color red0 = color.new(color.red, 0) color red75 = color.new(color.red,75) color white0 = color.new(color.white, 0) color yellow0 = color.new(#FFF700, 0) bool showgreydiamond = input(defval=false, title='Show Diamond For Back Testing' ,group='=== Information ===') LabelDigitDisplay = syminfo.ticker == 'AUDCAD' == true ? '#.#####' : syminfo.ticker == 'AUDCHF' == true ? '#.#####' : syminfo.ticker == 'AUDJPY' == true ? '#.###' : syminfo.ticker == 'AUDNZD' == true ? '#.#####' : syminfo.ticker == 'AUDUSD' == true ? '#.#####' : syminfo.ticker == 'CADCHF' == true ? '#.#####' : syminfo.ticker == 'CADJPY' == true ? '#.###' : syminfo.ticker == 'CHFJPY' == true ? '#.###' : syminfo.ticker == 'EURAUD' == true ? '#.#####' : syminfo.ticker == 'EURCAD' == true ? '#.#####' : syminfo.ticker == 'EURCHF' == true ? '#.#####' : syminfo.ticker == 'EURGBP' == true ? '#.#####' : syminfo.ticker == 'EURJPY' == true ? '#.###' : syminfo.ticker == 'EURNZD' == true ? '#.#####' : syminfo.ticker == 'EURUSD' == true ? '#.#####' : syminfo.ticker == 'GBPAUD' == true ? '#.#####' : syminfo.ticker == 'GBPCAD' == true ? '#.#####' : syminfo.ticker == 'GBPCHF' == true ? '#.#####' : syminfo.ticker == 'GBPJPY' == true ? '#.###' : syminfo.ticker == 'GBPNZD' == true ? '#.#####' : syminfo.ticker == 'GBPUSD' == true ? '#.#####' : syminfo.ticker == 'NZDCAD' == true ? '#.#####' : syminfo.ticker == 'NZDCHF' == true ? '#.#####' : syminfo.ticker == 'NZDJPY' == true ? '#.###': syminfo.ticker == 'NZDUSD' == true ? '#.#####' : syminfo.ticker == 'USDCAD' == true ? '#.#####' : syminfo.ticker == 'USDCHF' == true ? '#.#####' : syminfo.ticker == 'USDJPY' == true ? '#.###': syminfo.ticker == 'GOLD' == true ? '#.##' : syminfo.ticker == 'US100' == true ? '#.##' : syminfo.ticker == 'US30' == true ? '#.##' : syminfo.ticker == 'US500' == true ? '#.##' : syminfo.ticker == 'DE40' == true ? '#.##' : '#.#####' PipsMultiplier = syminfo.ticker == 'AUDCAD' == true ? 0.00050 : syminfo.ticker == 'AUDCHF' == true ? 0.00050 : syminfo.ticker == 'AUDJPY' == true ? 00.050 : syminfo.ticker == 'AUDNZD' == true ? 0.00050 : syminfo.ticker == 'AUDUSD' == true ? 0.00050 : syminfo.ticker == 'CADCHF' == true ? 0.00050 : syminfo.ticker == 'CADJPY' == true ? 00.050 : syminfo.ticker == 'CHFJPY' == true ? 00.050: syminfo.ticker == 'EURAUD' == true ? 0.00050 : syminfo.ticker == 'EURCAD' == true ? 0.00050 : syminfo.ticker == 'EURCHF' == true ? 0.00050 : syminfo.ticker == 'EURGBP' == true ? 0.00050 : syminfo.ticker == 'EURJPY' == true ? 00.050 : syminfo.ticker == 'EURNZD' == true ? 0.00050 : syminfo.ticker == 'EURUSD' == true ? 0.00050 : syminfo.ticker == 'GBPAUD' == true ? 0.00050 : syminfo.ticker == 'GBPCAD' == true ? 0.00050 : syminfo.ticker == 'GBPCHF' == true ? 0.00050 : syminfo.ticker == 'GBPJPY' == true ? 00.050 : syminfo.ticker == 'GBPNZD' == true ? 0.00050 : syminfo.ticker == 'GBPUSD' == true ? 0.00050 : syminfo.ticker == 'NZDCAD' == true ? 0.00050 : syminfo.ticker == 'NZDCHF' == true ? 0.00050 : syminfo.ticker == 'NZDJPY' == true ? 00.050: syminfo.ticker == 'NZDUSD' == true ? 0.00050 : syminfo.ticker == 'USDCAD' == true ? 0.00050 : syminfo.ticker == 'USDCHF' == true ? 0.00050 : syminfo.ticker == 'USDJPY' == true ? 00.050: syminfo.ticker == 'GOLD' == true ? 1.5 : syminfo.ticker == 'US100' == true ? 10 : syminfo.ticker == 'US30' == true ? 25 : syminfo.ticker == 'US500' == true ? 10 : syminfo.ticker == 'DE40' == true ? 10 : 1 Targettouse = Overridetargetsize ? Targetssize : PipsMultiplier Imbcol = input.color(yellow0, 'Imbalance Colour', inline="1" ,group='=== Information ===') Dimcol = input.color(gray0, 'Imbalance Colour', inline="1" ,group='=== Information ===') TopImbalance = low[2] <= open[1] and high[0] >= close[1] TopImbalancesize = low[2] - high[0] if TopImbalance and TopImbalancesize > 0 BOX1 = box.new(left=bar_index[1], top=low[2], right=bar_index[0], bottom=high[0]) box.set_bgcolor(BOX1, Imbcol ) box.set_border_color(BOX1, Imbcol ) BottomInbalance = high[2] >= open[1] and low[0] <= close[1] BottomInbalancesize = low[0] - high[2] if BottomInbalance and BottomInbalancesize > 0 BOX2 = box.new(left=bar_index[1], top=low[0], right=bar_index[0], bottom=high[2]) box.set_bgcolor(BOX2, Imbcol ) box.set_border_color(BOX2, Imbcol ) DownImbalance = TopImbalance and TopImbalancesize > 0 plotshape(DownImbalance[0] and showgreydiamond, style=shape.diamond, location=location.abovebar, color=Dimcol, size=size.tiny) UpImbalance = BottomInbalance and BottomInbalancesize > 0 plotshape(UpImbalance[0] and showgreydiamond, style=shape.diamond, location=location.belowbar, color=Dimcol, size=size.tiny) DownSell = close[1]>open[1] and close<open UpBuy = close[1]<open[1] and close>open boxcolourtop = UpBuy ? green0 : black100 boxcolourbottom = DownSell ? red0 : black100 boxcolourtopfill = UpBuy ? green75 : black100 boxcolourbottomfill = DownSell ? red75 : black100 BottomLabel = label.new(x=bar_index, y=high+(Targettouse/3), xloc=xloc.bar_index) label.set_text(BottomLabel, text = "\n \n Entry = " + str.tostring(close,LabelDigitDisplay) + "\n Stop Loss = " + str.tostring(high,LabelDigitDisplay) + "\n Take Profit = " + str.tostring(close-PipsMultiplier,LabelDigitDisplay) + "\n Target Size = " + str.tostring(PipsMultiplier,LabelDigitDisplay)) label.set_textalign(BottomLabel, text.align_left) label.set_style(BottomLabel, label.style_label_left) label.set_color(BottomLabel, black100) label.set_textcolor(BottomLabel, boxcolourbottom) label.delete(BottomLabel[1]) Bottom = box.new(left=bar_index[0], top=low, right=bar_index[0], bottom=low-Targettouse, xloc=xloc.bar_index) box.set_right(Bottom,right=box.get_right(id=Bottom)+10) box.set_bgcolor(Bottom , color=boxcolourbottomfill ) box.set_border_color(Bottom , color=boxcolourbottom) box.delete(Bottom [1]) TopLabel = label.new(x=bar_index, y=low-(Targettouse/3), xloc=xloc.bar_index) label.set_text(TopLabel, text = "\n \n Entry = " + str.tostring(close,LabelDigitDisplay) + "\n Stop Loss = " + str.tostring(low,LabelDigitDisplay) + "\n Take Profit = " + str.tostring(close+Targettouse,LabelDigitDisplay) + "\n Target Size = " + str.tostring(PipsMultiplier,LabelDigitDisplay)) label.set_textalign(TopLabel, text.align_left) label.set_style(TopLabel, label.style_label_left) label.set_color(TopLabel, black100) label.set_textcolor(TopLabel, boxcolourtop ) label.delete(TopLabel[1]) Top = box.new(left=bar_index[0], top=high+Targettouse, right=bar_index[0], bottom=high, xloc=xloc.bar_index) box.set_right(Top,right=box.get_right(id=Top)+10) box.set_bgcolor(Top , color=boxcolourtopfill ) box.set_border_color(Top, color=boxcolourtop ) box.delete(Top[1]) ema13colour = showema ? red0 : black100 ema35colour = showema ? orange0 : black100 ema50colour = showema ? aqua0 : black100 offset = input.int(title='Offset', defval=0, minval=-500, maxval=500) emalen1513 =26 //input.int(13, minval=1, title='Length 13 EMA 15 Min', group='=== EMA Information ===') emasrc1513 = close EMA13 = request.security(syminfo.tickerid, '1', ta.ema(emasrc1513, emalen1513)) plot(EMA13, title='EMA 13 15 Min', color=ema13colour, linewidth=1, offset=offset) emalen1535 = 63 //input.int(35, minval=1, title='Length 35 EMA 15 Min', group='=== EMA Information ===') emasrc1535 = close EMA35 = request.security(syminfo.tickerid, '1', ta.ema(emasrc1535, emalen1535)) plot(EMA35, title='EMA 35 15 Min', color=ema35colour, linewidth=1, offset=offset) emalen1550 = 100 //input.int(50, minval=1, title='Length 50 EMA 15 Min', group='=== EMA Information ===') emasrc1550 = close EMA50 = request.security(syminfo.tickerid, '1', ta.ema(emasrc1550, emalen1550)) plot(EMA50, title='EMA 50 15 Min', color=ema50colour, linewidth=2, offset=offset) Up = EMA13 > EMA35 and EMA35 > EMA50 Down = EMA13 < EMA35 and EMA35 < EMA50 plotshape(Up , title='Up', style=shape.square, location=location.bottom, color=green0, size=size.tiny) plotshape(Down , title='Down', style=shape.square, location=location.bottom, color=red0, size=size.tiny) plotshape(not Down and not Up , title='Warning', style=shape.square, location=location.bottom, color=orange0, size=size.tiny) alertcondition(Up and not Up[1] , title='Buy Switch On', message='Buy Switch On') alertcondition(Down and not Down[1], title='Sell Switch On', message='Sell Switch On') alertcondition(Up[1] and not Up , title='Warning Stop any More Buys', message='Warning Stop any More Buys') alertcondition(Down[1] and not Down, title='Warning Stop any More Sells', message='Warning Stop any More Sells') alertcondition(open > close or close <= open , title='Every Bar Alert', message='Every Bar Alert')
QuantX VIX Radar
https://www.tradingview.com/script/SDKmxZ6D-QuantX-VIX-Radar/
QuantX_GmbH
https://www.tradingview.com/u/QuantX_GmbH/
64
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © QuantX_GmbH // https://www.youtube.com/watch?v=VA3dIAx5Pdk //@version=5 indicator("QuantX VIX Radar") // Input Values vixdisplay = input.string(title="Display Type", defval="Relative", options=["Relative", "Absolute"]) thresholdrelativeupper = input.int(title="Relative Upper Level", defval=95) thresholdrelativelower = input.int(title="Relative Lower Level", defval=5) thresholdabsoluteupper = input.int(title="Absolute Upper Level", defval=12) thresholdabsolutelower = input.int(title="Absolute Lower Level", defval=0) bars = input.int(title="Bars", minval = 1, maxval = 1000, defval = 52) vix9d = request.security("VIX9D", timeframe.period, close) vix = request.security("VIX", timeframe.period, close) vix3m = request.security("VIX3M", timeframe.period, close) vix6m = request.security("VIX6M", timeframe.period, close) vixdiff1 = vix - vix9d vixdiff2 = vix3m - vix vixdiff3 = vix6m - vix3m vixtotal = vixdiff1 + vixdiff2 + vixdiff3 vixhighest = ta.highest(vixtotal, bars) vixlowest = ta.lowest(vixtotal, bars) vixrelative = 100 * (vixtotal - vixlowest) / (vixhighest - vixlowest) plotvalue = vixtotal if vixdisplay == "Relative" plotvalue := vixrelative else plotvalue := vixtotal thresholdrelativeupper := thresholdabsoluteupper thresholdrelativelower := thresholdabsolutelower plot(plotvalue) plot(thresholdrelativeupper, "Upper Level", color=color.lime) plot(thresholdrelativelower, "Lower Level", color=color.red)
Chanu Delta RSI
https://www.tradingview.com/script/O0tyLt28/
chanu_lev10k
https://www.tradingview.com/u/chanu_lev10k/
10
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © chanu_lev10k //@version=5 indicator("Chanu Delta RSI") // Inputs sym_ref = input.symbol(title='BTCUSD reference market', defval='BYBIT:BTCUSDT') sym_amp = input.symbol(title='BTCUSD large amplitude market', defval='COINBASE:BTCUSD') src = input.source(title='Source', defval=close) res = input.timeframe(title='Resolution', defval='') isnorm = input.bool(title='Use Normalization of Chanu Delta ?', defval=true, tooltip='By dividing the original Chanu Delta value by the price of the reference Bitcoin market, it allows the Chanu Delta strategy to be universally used in the long term despite Bitcoin price fluctuations.') len = input.int(defval=4, title='Length of Chanu Delta RSI') bullLevel = input.int(title='Bull Level', defval=63, maxval=100, minval=0) bearLevel = input.int(title='Bear Level', defval=30, maxval=100, minval=0) highlightBreakouts = input(title='Highlight Bull/Bear Breakouts ?', defval=true) // Chanu Delta RSI Definition delta_f(res, src) => d = request.security(sym_amp, res, src) - request.security(sym_ref, res, src) n = d / request.security(sym_ref, res, src) * 100000 isnorm ? n : d delta = delta_f(res, src) delta_rsi = ta.rsi(delta, len) // Plot rcColor = delta_rsi > bullLevel ? #0ebb23 : delta_rsi < bearLevel ? #ff0000 : #f4b77d maxBand = hline(100, title='Max Level', linestyle=hline.style_dotted, color=color.white) hline(0, title='Zero Level', linestyle=hline.style_dotted) minBand = hline(0, title='Min Level', linestyle=hline.style_dotted, color=color.white) bullBand = hline(bullLevel, title='Bull Level', linestyle=hline.style_dotted) bearBand = hline(bearLevel, title='Bear Level', linestyle=hline.style_dotted) fill(bullBand, bearBand, color=color.new(color.purple, 95)) bullFillColor = delta_rsi > bullLevel and highlightBreakouts ? color.green : na bearFillColor = delta_rsi < bearLevel and highlightBreakouts ? color.red : na fill(maxBand, bullBand, color=color.new(bullFillColor, 80)) fill(minBand, bearBand, color=color.new(bearFillColor, 80)) plot(delta_rsi, title='Chanu Delta RSI', linewidth=2, color=rcColor)
SPY Option returns calculations
https://www.tradingview.com/script/y8ldEo4C-SPY-Option-returns-calculations/
tonycsa
https://www.tradingview.com/u/tonycsa/
31
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © tonycsa //@version=4 study("Option Calc O-C & C-C") //input data lookback = input(defval = 0, title = "Lookback Period") HISTORICALCLOSE = input(defval = 20, title = "History open-close") HISTORICALOPEN = input(defval = 20, title = "History close-close") difference1 = abs(close-round(close[1])) difference2 = abs(close-round(open)) difference3 = abs(close[1]-open) Credit = input(defval = 0, step = 0.01, title ="Strategy -cost/+credit") Option1 = input(defval = 0, title ="Option1 Dist. From Open") Option2 = input(defval = 2, title ="Option2 Dist. From Open") Option3 = input(defval = 4, title ="Option3 Dist. From Open") Contracts1 = input(defval = 1, title ="# of Contracts #1") Contracts2 = input(defval = -3, title ="# of Contracts #2") Contracts3 = input(defval = 2, title ="# of Contracts #3") //background colors to screen off days of the week bgcolor( dayofweek==dayofweek.monday ? color.black : color.white, title="Mon", transp=50) bgcolor( dayofweek==dayofweek.tuesday ? color.black : color.white, title="Tues", transp=50) bgcolor( dayofweek==dayofweek.wednesday ? color.black : color.white, title="Wed", transp=50) bgcolor( dayofweek==dayofweek.thursday ? color.black : color.white, title="Thurs", transp=50) bgcolor( dayofweek==dayofweek.friday ? color.black : color.white, title="Fri", transp=50) //Calculations for options values float CLOSECLOSE = 0 for i = 1 to lookback if (difference1 < Option1) and ((dayofweek==dayofweek.monday) or (dayofweek==dayofweek.wednesday) or (dayofweek==dayofweek.friday)) CLOSECLOSE := Credit if (difference1 >= Option1) and (difference1 < Option2) and ((dayofweek==dayofweek.monday) or (dayofweek==dayofweek.wednesday) or (dayofweek==dayofweek.friday)) CLOSECLOSE := Contracts1 * ( abs(round(close[i+1]) - close[i]) - Option1 ) + Credit if (difference1 >= Option2) and (difference1 < Option3) and ((dayofweek==dayofweek.monday) or (dayofweek==dayofweek.wednesday) or (dayofweek==dayofweek.friday)) CLOSECLOSE := Contracts1 * ( abs(round(close[i+1]) - close[i]) - Option1 ) + Contracts2 * ( abs(round(close[i+1]) - close[i]) - Option2 ) + Credit if (difference1 >= Option3) and ((dayofweek==dayofweek.monday) or (dayofweek==dayofweek.wednesday) or (dayofweek==dayofweek.friday)) CLOSECLOSE := Contracts1 * ( abs(round(close[i+1]) - close[i]) - Option1 ) + Contracts2 * ( abs(round(close[i+1]) - close[i]) - Option2 ) + Contracts3 * ( abs(round(close[i+1]) - close[i]) - Option3 ) + Credit float OPENCLOSE = 0 for i = 1 to lookback if (difference2 < Option1) and ((dayofweek==dayofweek.monday) or (dayofweek==dayofweek.wednesday) or (dayofweek==dayofweek.friday)) OPENCLOSE := Credit if (difference2 >= Option1) and (difference2 < Option2) and ((dayofweek==dayofweek.monday) or (dayofweek==dayofweek.wednesday) or (dayofweek==dayofweek.friday)) OPENCLOSE := Contracts1 * ( abs(round(open[i]) - close[i]) - Option1 ) + Credit if (difference2 >= Option2) and (difference2 < Option3) and ((dayofweek==dayofweek.monday) or (dayofweek==dayofweek.wednesday) or (dayofweek==dayofweek.friday)) OPENCLOSE := Contracts1 * ( abs(round(open[i]) - close[i]) - Option1 ) + Contracts2 * ( abs(round(open[i]) - close[i]) - Option2 ) + Credit if (difference2 >= Option3) and ((dayofweek==dayofweek.monday) or (dayofweek==dayofweek.wednesday) or (dayofweek==dayofweek.friday)) OPENCLOSE := Contracts1 * ( abs(round(open[i]) - close[i]) - Option1 ) + Contracts2 * ( abs(round(open[i]) - close[i]) - Option2 ) + Contracts3 * ( abs(round(open[i]) - close[i]) - Option3 ) + Credit //chart plots plot (CLOSECLOSE, color = color.red, title="Close-Close") plot (sum(CLOSECLOSE, HISTORICALCLOSE), color = color.red) plot (OPENCLOSE, color = color.blue, title="Open-Close") plot (sum(OPENCLOSE, HISTORICALCLOSE), color = color.blue) plot (difference3, color = color.purple, title="Close-Open") hline(0, color = color.fuchsia, linestyle = hline.style_solid)
Didi index alerts
https://www.tradingview.com/script/vsRW14vG-Didi-index-alerts/
vitorleo
https://www.tradingview.com/u/vitorleo/
134
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © vitorleo //@version=5 indicator('Didi index alerts', shorttitle='Didi alerts') // Inputs for Didi Index curta = input.int(title="Fast average", defval=3, group="Didi index config") media = input.int(title="Normal average", defval=8, group="Didi index config") longa = input.int(title="Slow average", defval=20, group="Didi index config") distMinCurta = input.float(title="Fast average", defval=-0.5, step=0.1, group="Minimum neddle distance", tooltip="Minimum number of previous bars where the needle occured.\nNegative and decimal numbers are allowed.\nDefault:-0.5") distMinLonga = input.float(title="Slow average", defval=-0.5, step=0.1, group="Minimum neddle distance", tooltip="Minimum number of previous bars where the needle occured.\nNegative and decimal numbers are allowed.\nDefault:-0.5") distMaxCurta = input.float(title="Fast average", defval=1.6, step=0.1, group="Maximum neddle distance", tooltip="Maximum number of previous bars where the needle occured.\nNegative and decimal numbers are allowed.\nDefault:1.6") distMaxLonga = input.float(title="Slow average", defval=1.8, step=0.1, group="Maximum neddle distance", tooltip="Maximum number of previous bars where the needle occured.\nNegative and decimal numbers are allowed.\nDefault:1.8") // Didi index Average normalisation DidiLonga = (ta.sma(close, longa) / ta.sma(close, media) - 1) * 100 DidiCurta = (ta.sma(close, curta) / ta.sma(close, media) - 1) * 100 DidiPrice = (close / ta.sma(close, media) - 1) * 100 // Plots the lines plot(DidiCurta, color=color.new(color.blue, 0), linewidth=2, title='Fast average') plot(0, color=color.new(color.white, 0), title='Normal average') plot(DidiLonga, color=color.new(color.fuchsia, 0), linewidth=2, title='Slow average') // Alerts longaUp = DidiLonga > DidiLonga[1]*1.03 longaDown = DidiLonga < DidiLonga[1]*1.03 alertaCompra = ta.crossover(DidiCurta, 0) alertaVenda = ta.crossunder(DidiCurta, 0) confirmaCompra = ta.crossunder(DidiLonga, 0) confirmaVenda = ta.crossover(DidiLonga, 0) // Fake long and short compraFalsa = alertaCompra and longaUp and DidiLonga > DidiCurta vendaFalsa = alertaVenda and longaDown and DidiLonga < DidiCurta // Needle conditions // Classic needles agulhadaCruzamento = (alertaCompra and confirmaCompra) or (alertaVenda and confirmaVenda) // Projected Needles projCurta = DidiCurta[1]/(DidiCurta-DidiCurta[1]) projLonga = DidiLonga[1]/(DidiLonga-DidiLonga[1]) agulhadaProjCurta = projCurta > distMinCurta and projCurta < distMaxCurta agulhadaProjLonga = projLonga > distMinLonga and projLonga < distMaxLonga agulhadaProj = agulhadaProjCurta and agulhadaProjLonga // Projected and crossing projCrossLong = (confirmaCompra and agulhadaProjCurta) or (alertaCompra and agulhadaProjLonga) projCrossShort = (confirmaVenda and agulhadaProjCurta) or (alertaVenda and agulhadaProjLonga) // Direction of needles didiComprado = DidiCurta > 0 and DidiLonga < 0 didiVendido = DidiCurta < 0 and DidiLonga > 0 //or (agulhadaProjLonga and alertaCompra) or (agulhadaProjCurta and confirmaCompra) agulhadaCompra = didiComprado and (agulhadaProj or agulhadaCruzamento or projCrossLong) agulhadaVenda = didiVendido and (agulhadaProj or agulhadaCruzamento or projCrossShort) plotchar(projCurta, 'Fast average projection', '', location.top, color.blue) plotchar(projLonga, 'Slow average projection', '', location.top, color.red) plotshape(agulhadaVenda, 'Short Needle', shape.triangledown, location.bottom, color.new(color.red, 20), size=size.tiny) plotshape(agulhadaCompra, 'Long Needle', shape.triangleup, location.bottom, color.new(color.green, 20), size=size.tiny) bgcolor(agulhadaCompra ? color.new(color.green, 60) : na, title='Long needles background') bgcolor(agulhadaVenda ? color.new(color.red, 60) : na, title='Short needles background') bgcolor(vendaFalsa ? color.new(color.green, 75) : na, title='Fake long background') bgcolor(compraFalsa ? color.new(color.red, 75) : na, title='Fake short background') alertcondition(agulhadaVenda, title='Short Needle (Agulhada de venda)', message='Short Needle') alertcondition(agulhadaCompra, title='Long Needle (Agulhada de compra)', message='Long Needle') alertcondition(compraFalsa, title='Fake long (Compra falsa)', message='Fake long') alertcondition(vendaFalsa, title='Fake short (Venda falsa)', message='Fake short')
Sell alert [Crypto_BCT]
https://www.tradingview.com/script/RgNxAx6K-sell-alert-crypto-bct/
Crypto_BitCoinTrader
https://www.tradingview.com/u/Crypto_BitCoinTrader/
53
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Crypto_BitCoinTrader //@version=5 indicator(title="Sell alert [Crypto_BCT]", overlay=true, max_labels_count = 500) rsi = ta.rsi(close,14) RSI_Top = input(64, "RSI High") rsisell = rsi>RSI_Top mfi = ta.mfi(close,14) MFI_Top = input(70, "MFI High") mfisell = mfi>MFI_Top cci = ta.cci(hlc3, 20) CCI_Top = input(200, "CCI High") ccisell = cci>CCI_Top atrinput = input(6, "ATR") atr = ta.atr(atrinput) emainput = input(150, "EMA") ema = ta.ema(close, emainput) highbar = input(36, "Highest bar from") highclosebar = ta.highestbars(close, highbar) color labelsell = color(color.red) resultema = 0 int emahigh = input.int(30, minval=2, title="Highest EMA bar ago") for i = 1 to emahigh if ema[i-1]>ema[i] resultema += 1 sell = highclosebar == 0 and rsisell and mfisell and ccisell and open>ema and resultema == emahigh and (high-low>atr or low-high>atr) plot(ema, "EMA") if sell label.new(bar_index, high, yloc = yloc.abovebar, color=labelsell, style=label.style_triangledown, size=size.tiny) bgcolor(sell ? color.new(color.red,70) : na) alertcondition(sell, title="High Price Detected", message="High Price Detected")
Buy / Sell alert indicator [Crypto_BCT]
https://www.tradingview.com/script/Y0SIb8jA-buy-sell-alert-indicator-crypto-bct/
Crypto_BitCoinTrader
https://www.tradingview.com/u/Crypto_BitCoinTrader/
617
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Crypto_BitCoinTrader //@version=5 indicator(title="Buy / Sell alert [Crypto_BCT]", overlay=true, max_labels_count = 500) // ATR atrinput = input(6, "ATR") atr = ta.atr(atrinput) // EMA emainput = input(150, "EMA") ema = ta.ema(close, emainput) // RSI rsi = ta.rsi(close,14) RSI_Bottom = input(36, "(Buy) RSI low") rsibuy = rsi<RSI_Bottom RSI_Top = input(64, "(Sell) RSI High") rsisell = rsi>RSI_Top // MFI mfi = ta.mfi(close,14) MFI_Bottom = input(30, "(Buy) MFI low") mfibuy = mfi<MFI_Bottom MFI_Top = input(70, "(Sell) MFI High") mfisell = mfi>MFI_Top // CCI cci = ta.cci(hlc3, 20) CCI_Bottom = input(-200, "(Buy) CCI Low") ccibuy = cci<CCI_Bottom CCI_Top = input(200, "(Sell) CCI High") ccisell = cci>CCI_Top // High-Low Bars lowbar = input(36, "(Buy) Lowest bar from") lowclosebar = ta.lowestbars(close, lowbar) highbar = input(36, "(Sell) Highest bar from") highclosebar = ta.highestbars(close, highbar) // EMA bar ago resultbuyema = 0 int emalow = input.int(30, minval=2, title="(Buy) Lowest EMA bar ago") for i = 1 to emalow if ema[i-1]<ema[i] resultbuyema += 1 resultsellema = 0 int emahigh = input.int(30, minval=2, title="(Sell) Highest EMA bar ago") for i = 1 to emahigh if ema[i-1]>ema[i] resultsellema += 1 buy = lowclosebar == 0 and rsibuy and mfibuy and ccibuy and open<ema and resultbuyema == emalow and (high-low>atr or low-high>atr) sell = highclosebar == 0 and rsisell and mfisell and ccisell and open>ema and resultsellema == emahigh and (high-low>atr or low-high>atr) plot(ema, "EMA") if buy label.new(bar_index, low, yloc = yloc.belowbar, color=color(color.green), style=label.style_triangleup, size=size.tiny) if sell label.new(bar_index, high, yloc = yloc.abovebar, color=color(color.red), style=label.style_triangledown, size=size.tiny) bgcolor(buy ? color.new(color.green,70) : na) alertcondition(buy, title="Low Price Detected", message="Low Price Detected") bgcolor(sell ? color.new(color.red,70) : na) alertcondition(sell, title="High Price Detected", message="High Price Detected")
Indicators Overview
https://www.tradingview.com/script/Ik74SYl8-Indicators-Overview/
safeuse97
https://www.tradingview.com/u/safeuse97/
33
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © safeuse97 //@version=5 indicator('Indicators Overview', overlay=true) //////////// // INPUTS // // SMA rsi_len = input.int( 14, title = "RSI Length", group = "Indicators") rsi_os = input.float(40, title = "RSI Overbought", group = "Indicators") rsi_ob = input.float(60, title = "RSI Oversold", group = "Indicators") // SuperTrend sup_atr_len = input.int( 10, "Supertrend ATR Length", group = 'Indicators') sup_factor = input.float(2.0, "Supertrend Factor", group = 'Indicators') ///////////// // SYMBOLS // u01 = input.bool(true, title = "", group = 'Symbols', inline = 's01') u02 = input.bool(true, title = "", group = 'Symbols', inline = 's02') u03 = input.bool(true, title = "", group = 'Symbols', inline = 's03') u04 = input.bool(true, title = "", group = 'Symbols', inline = 's04') u05 = input.bool(true, title = "", group = 'Symbols', inline = 's05') u06 = input.bool(true, title = "", group = 'Symbols', inline = 's06') u07 = input.bool(true, title = "", group = 'Symbols', inline = 's07') u08 = input.bool(true, title = "", group = 'Symbols', inline = 's08') u09 = input.bool(true, title = "", group = 'Symbols', inline = 's09') u10 = input.bool(true, title = "", group = 'Symbols', inline = 's10') u11 = input.bool(true, title = "", group = 'Symbols', inline = 's11') u12 = input.bool(true, title = "", group = 'Symbols', inline = 's12') u13 = input.bool(true, title = "", group = 'Symbols', inline = 's13') u14 = input.bool(true, title = "", group = 'Symbols', inline = 's14') u15 = input.bool(true, title = "", group = 'Symbols', inline = 's15') s01 = input.symbol('NIFTY', group = 'Symbols', inline = 's01') s02 = input.symbol('BANKNIFTY', group = 'Symbols', inline = 's02') s03 = input.symbol('HDFCBANK', group = 'Symbols', inline = 's03') s04 = input.symbol('ICICIBANK', group = 'Symbols', inline = 's04') s05 = input.symbol('SBIN', group = 'Symbols', inline = 's05') s06 = input.symbol('AXISBANK', group = 'Symbols', inline = 's06') s07 = input.symbol('KOTAKBANK', group = 'Symbols', inline = 's07') s08 = input.symbol('INDUSINDBK', group = 'Symbols', inline = 's08') s09 = input.symbol('RELIANCE', group = 'Symbols', inline = 's09') s10 = input.symbol('INFY', group = 'Symbols', inline = 's10') s11 = input.symbol('HDFC', group = 'Symbols', inline = 's11') s12 = input.symbol('TCS', group = 'Symbols', inline = 's12') s13 = input.symbol('LT', group = 'Symbols', inline = 's13') s14 = input.symbol('BAJFINANCE', group = 'Symbols', inline = 's14') s15 = input.symbol('ITC', group = 'Symbols', inline = 's15') ////////////////// // CALCULATIONS // // Get only symbol only_symbol(s) => array.get(str.split(s, ":"), 1) screener_func() => // RSI rsi = ta.rsi(close, rsi_len) //vwap vwap1=(ta.vwap>close)?1:0 // Supertrend [sup_value, sup_dir] = ta.supertrend(sup_factor, sup_atr_len) [math.round_to_mintick(close), rsi, vwap1, sup_dir] // Security call [cl01, rsi01, vwap01, sup01] = request.security(s01, timeframe.period, screener_func()) [cl02, rsi02, vwap02, sup02] = request.security(s02, timeframe.period, screener_func()) [cl03, rsi03, vwap03, sup03] = request.security(s03, timeframe.period, screener_func()) [cl04, rsi04, vwap04, sup04] = request.security(s04, timeframe.period, screener_func()) [cl05, rsi05, vwap05, sup05] = request.security(s05, timeframe.period, screener_func()) [cl06, rsi06, vwap06, sup06] = request.security(s06, timeframe.period, screener_func()) [cl07, rsi07, vwap07, sup07] = request.security(s07, timeframe.period, screener_func()) [cl08, rsi08, vwap08, sup08] = request.security(s08, timeframe.period, screener_func()) [cl09, rsi09, vwap09, sup09] = request.security(s09, timeframe.period, screener_func()) [cl10, rsi10, vwap10, sup10] = request.security(s10, timeframe.period, screener_func()) [cl11, rsi11, vwap11, sup11] = request.security(s11, timeframe.period, screener_func()) [cl12, rsi12, vwap12, sup12] = request.security(s12, timeframe.period, screener_func()) [cl13, rsi13, vwap13, sup13] = request.security(s13, timeframe.period, screener_func()) [cl14, rsi14, vwap14, sup14] = request.security(s14, timeframe.period, screener_func()) [cl15, rsi15, vwap15, sup15] = request.security(s15, timeframe.period, screener_func()) //////////// // ARRAYS // s_arr = array.new_string(0) u_arr = array.new_bool(0) cl_arr = array.new_float(0) rsi_arr = array.new_float(0) vwap_arr = array.new_float(0) sup_arr = array.new_float(0) // Add Symbols array.push(s_arr, only_symbol(s01)) array.push(s_arr, only_symbol(s02)) array.push(s_arr, only_symbol(s03)) array.push(s_arr, only_symbol(s04)) array.push(s_arr, only_symbol(s05)) array.push(s_arr, only_symbol(s06)) array.push(s_arr, only_symbol(s07)) array.push(s_arr, only_symbol(s08)) array.push(s_arr, only_symbol(s09)) array.push(s_arr, only_symbol(s10)) array.push(s_arr, only_symbol(s11)) array.push(s_arr, only_symbol(s12)) array.push(s_arr, only_symbol(s13)) array.push(s_arr, only_symbol(s14)) array.push(s_arr, only_symbol(s15)) /////////// // FLAGS // array.push(u_arr, u01) array.push(u_arr, u02) array.push(u_arr, u03) array.push(u_arr, u04) array.push(u_arr, u05) array.push(u_arr, u06) array.push(u_arr, u07) array.push(u_arr, u08) array.push(u_arr, u09) array.push(u_arr, u10) array.push(u_arr, u11) array.push(u_arr, u12) array.push(u_arr, u13) array.push(u_arr, u14) array.push(u_arr, u15) /////////// // CLOSE // array.push(cl_arr, cl01) array.push(cl_arr, cl02) array.push(cl_arr, cl03) array.push(cl_arr, cl04) array.push(cl_arr, cl05) array.push(cl_arr, cl06) array.push(cl_arr, cl07) array.push(cl_arr, cl08) array.push(cl_arr, cl09) array.push(cl_arr, cl10) array.push(cl_arr, cl11) array.push(cl_arr, cl12) array.push(cl_arr, cl13) array.push(cl_arr, cl14) array.push(cl_arr, cl15) ///////// // RSI // array.push(rsi_arr, rsi01) array.push(rsi_arr, rsi02) array.push(rsi_arr, rsi03) array.push(rsi_arr, rsi04) array.push(rsi_arr, rsi05) array.push(rsi_arr, rsi06) array.push(rsi_arr, rsi07) array.push(rsi_arr, rsi08) array.push(rsi_arr, rsi09) array.push(rsi_arr, rsi10) array.push(rsi_arr, rsi11) array.push(rsi_arr, rsi12) array.push(rsi_arr, rsi13) array.push(rsi_arr, rsi14) array.push(rsi_arr, rsi15) ///////// //VWAP// array.push(vwap_arr,vwap01) array.push(vwap_arr,vwap02) array.push(vwap_arr,vwap03) array.push(vwap_arr,vwap04) array.push(vwap_arr,vwap05) array.push(vwap_arr,vwap06) array.push(vwap_arr,vwap07) array.push(vwap_arr,vwap08) array.push(vwap_arr,vwap09) array.push(vwap_arr,vwap10) array.push(vwap_arr,vwap11) array.push(vwap_arr,vwap12) array.push(vwap_arr,vwap13) array.push(vwap_arr,vwap14) array.push(vwap_arr,vwap15) //////////////// // SUPERTREND // array.push(sup_arr, sup01) array.push(sup_arr, sup02) array.push(sup_arr, sup03) array.push(sup_arr, sup04) array.push(sup_arr, sup05) array.push(sup_arr, sup06) array.push(sup_arr, sup07) array.push(sup_arr, sup08) array.push(sup_arr, sup09) array.push(sup_arr, sup10) array.push(sup_arr, sup11) array.push(sup_arr, sup12) array.push(sup_arr, sup13) array.push(sup_arr, sup14) array.push(sup_arr, sup15) /////////// // PLOTS // var tbl = table.new(position.top_right, 6, 41, frame_color=#151715, frame_width=1, border_width=2, border_color=color.new(color.white, 100)) if barstate.islast table.cell(tbl, 0, 0, 'Symbol', text_halign = text.align_center, bgcolor = color.gray, text_color = color.white, text_size = size.small) table.cell(tbl, 1, 0, 'Price', text_halign = text.align_center, bgcolor = color.gray, text_color = color.white, text_size = size.small) table.cell(tbl, 2, 0, 'RSI', text_halign = text.align_center, bgcolor = color.gray, text_color = color.white, text_size = size.small) table.cell(tbl, 3, 0, 'VWAP', text_halign = text.align_center, bgcolor = color.gray, text_color = color.white, text_size = size.small) table.cell(tbl, 4, 0, 'Supertrend', text_halign = text.align_center, bgcolor = color.gray, text_color = color.white, text_size = size.small) for i = 0 to 14 if array.get(u_arr, i) rsi_col = array.get(rsi_arr, i) > rsi_ob ? color.green : array.get(rsi_arr, i) < rsi_os ? color.red : #aaaaaa vwap_text = array.get(vwap_arr, i) < 1 ? "Up" : "Down" vwap_col = array.get(vwap_arr, i) < 1 ? color.green: color.red sup_text = array.get(sup_arr, i) > 0 ? "Down" : "Up" sup_col = array.get(sup_arr, i) > 0 ? color.red : color.green table.cell(tbl, 0, i + 1, array.get(s_arr, i), text_halign = text.align_left, bgcolor = color.gray, text_color = color.white, text_size = size.small) table.cell(tbl, 1, i + 1, str.tostring(array.get(cl_arr, i)), text_halign = text.align_center, bgcolor = #aaaaaa, text_color = color.white, text_size = size.small) table.cell(tbl, 2, i + 1, str.tostring(array.get(rsi_arr, i), "#.##"), text_halign = text.align_center, bgcolor = rsi_col, text_color = color.white, text_size = size.small) table.cell(tbl, 3, i + 1, str.tostring(vwap_text), text_halign = text.align_center, bgcolor = vwap_col, text_color = color.white, text_size = size.small) table.cell(tbl, 4, i + 1, sup_text, text_halign = text.align_center, bgcolor = sup_col, text_color = color.white, text_size = size.small)
Total Percent Movement
https://www.tradingview.com/script/GRbNP3rJ-Total-Percent-Movement/
developerjoe
https://www.tradingview.com/u/developerjoe/
11
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © developerjoe //@version=5 indicator("Total Percent Movement") baseline = input(2, "Baseline") maInterval = input(55, "MA Interval") gain = ((high - low)/low)*100 plot(gain, title="Movement") plot(baseline, color=color.green, title="Baseline") plot(ta.sma(gain, maInterval), color=color.purple, title="Moving Average")
J-BUY & SELL
https://www.tradingview.com/script/D1kbybkx-J-BUY-SELL/
jayant0478
https://www.tradingview.com/u/jayant0478/
50
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © jayant0478 //@version=4 study(title="J-BUY & SELL", overlay=true) greenCandle = (close > open) redCandle = (close < open) myMA5 = sma(close, 5) myMA10 = sma(close, 10) myMA20 = sma(close, 20) //crossUp1 = crossover(close[1], myMA) //crossUp2 = crossover(close[1], myMA2) //crossDown1 = crossunder(close[1], myMA) //crossDown2 = crossunder(close[1], myMA2) // Bollinger Band attributes mdl = sma(close, 20) dev = stdev(close, 20) upr = mdl + 2*dev lwr = mdl - 2*dev pb = ((close - lwr)*100/upr - lwr) //Percent B bbw = (upr - lwr)*100/mdl //Bollinger Bands Width // Bollinger Band attributes close rsiValue = rsi(close, 14) rsiEMA = ema(rsiValue, 5) myBuyCondition1 = myMA5 > myMA10 and myMA10 > myMA20 and ((rsiValue > rsiEMA) or crossover(rsiValue, rsiEMA)) and greenCandle and close > open[2] and close > myMA5 myBuyCondition2 = myMA5 > myMA20 and myMA10 > myMA20 and ((rsiValue > rsiEMA) or crossover(rsiValue, rsiEMA)) and redCandle[2] and greenCandle[1] and greenCandle and close[1] > close[2] and close > open[2] and close > myMA5 //myBuyCondition3 = greenCandle and close < lwr and close < close[1] myBuyCondition4 = myMA5 > myMA20 and myMA10 > myMA20 and ((rsiValue > rsiEMA) or crossover(rsiValue, rsiEMA)) and redCandle[2] and greenCandle[1] and greenCandle and close[1] < myMA5 and close > myMA5 and close > open[2] myBuyCondition5 = myMA5 > myMA20 and myMA10 > myMA20 and ((rsiValue > rsiEMA) or crossover(rsiValue, rsiEMA)) and redCandle[1] and redCandle and close[1] < myMA5 and close > myMA5 and close > close[1] and close < upr and close > open[2] myBuyCondition6 = myMA5 > myMA10 and myMA10 > myMA20 and ((rsiValue > rsiEMA) or crossover(rsiValue, rsiEMA)) and redCandle[1] and greenCandle and close > open[1] and close > myMA5 and close > open[2] myBuyCondition7 = myMA5 > myMA10 and myMA10 > myMA20 and ((rsiValue > rsiEMA) or crossover(rsiValue, rsiEMA)) and greenCandle[1] and redCandle and close > open[1] and close > myMA5 and open < upr and close > open[2] myBuyCondition8 = myMA5 > myMA10 and myMA10 > myMA20 and ((rsiValue > rsiEMA) or crossover(rsiValue, rsiEMA)) and redCandle[2] and redCandle[1] and greenCandle and close > open[2] and close > myMA5 and close > open[2] myBuyCondition9 = redCandle[2] and close[2] < myMA5 and ((rsiValue > rsiEMA) or crossover(rsiValue, rsiEMA)) and greenCandle[1] and greenCandle and (close > open[2] or close > myMA5) and myMA5 > myMA20 and close > open[2] myBuyCondition10 = myMA5 > myMA10 and myMA5 < myMA20 and ((rsiValue > rsiEMA) or crossover(rsiValue, rsiEMA)) and redCandle[3] and greenCandle[2] and greenCandle[1] and greenCandle and open > myMA5 and close > myMA5 and close > open[3] and close > close[1] myBuyCondition11 = myMA5 > myMA10 and myMA10 > myMA20 and redCandle[2] and greenCandle[1] and greenCandle and open[2] > upr and close > close[1] and close > open[2] and ((rsiValue > rsiEMA) or crossover(rsiValue, rsiEMA)) //myBuyCondition12 = myMA5 < myMA20 and myMA10 > myMA20 and redCandle[2] and greenCandle[1] and greenCandle and close[2] < myMA5 and close[1] > myMA5 and close[1] > open[2] and open > myMA5 and close > myMA5 and close > open[2] //myBuyCondition13 = myMA5 < myMA20 and myMA10 > myMA20 and redCandle[2] and greenCandle[1] and greenCandle and close[2] < myMA5 and close > myMA5 and close > open[2] and close > open[2] myBuyCondition14 = myMA5 < myMA20 and myMA10 > myMA20 and ((rsiValue > rsiEMA) or crossover(rsiValue, rsiEMA)) and greenCandle[2] and greenCandle[1] and redCandle and close > myMA5 and close > open[1] and close > open[2] myBuyCondition15 = myMA5 < myMA10 and myMA10 < myMA20 and ((rsiValue > rsiEMA) or crossover(rsiValue, rsiEMA)) and redCandle[2] and redCandle[1] and greenCandle and close[1] < lwr and open > close[1] and close > open[1] and close > open[2] myBuyCondition16 = myMA5 > myMA10 and myMA10 > myMA20 and ((rsiValue > rsiEMA) or crossover(rsiValue, rsiEMA)) and greenCandle[1] and redCandle and close[1] > myMA5 and close > open[1] and close > open[2] and close < upr myBuyCondition17 = myMA5 > myMA10 and myMA10 < myMA20 and ((rsiValue > rsiEMA) or crossover(rsiValue, rsiEMA)) and greenCandle[1] and greenCandle and close > myMA20 and close > open[2] myBuyCondition18 = myMA5 > myMA10 and myMA5 < myMA20 and ((rsiValue > rsiEMA) or crossover(rsiValue, rsiEMA)) and greenCandle[1] and greenCandle and close > myMA20 and close > open[2] myBuyCondition19 = myMA5 < myMA20 and myMA10 < myMA20 and ((rsiValue > rsiEMA) or crossover(rsiValue, rsiEMA)) and greenCandle and open > myMA20 and close > myMA20 myBuyCondition20 = myMA5 > myMA10 and myMA10 < myMA20 and ((rsiValue > rsiEMA) or crossover(rsiValue, rsiEMA)) and redCandle[2] and greenCandle[1] and greenCandle and close[1] > myMA5 and (close[1] > open[1] or (close > myMA5 and close > open[2])) myBuyCondition21 = myMA5 > myMA10 and myMA5 < myMA20 and ((rsiValue > rsiEMA) or crossover(rsiValue, rsiEMA)) and redCandle[1] and greenCandle and close[1] < myMA5 and close > myMA5 and close > open[1] myBuyCondition22 = myMA5 < myMA10 and myMA10 < myMA20 and ((rsiValue > rsiEMA) or crossover(rsiValue, rsiEMA)) and redCandle[3] and redCandle[2] and greenCandle[1] and greenCandle and close > myMA5 and close > open[2] myBuyCondition23 = myMA5 < myMA10 and myMA10 < myMA20 and ((rsiValue > rsiEMA) or crossover(rsiValue, rsiEMA)) and redCandle[3] and redCandle[2] and greenCandle[1] and close > myMA5 and close > open[2] myBuyCondition24 = myMA5 > myMA10 and myMA5 < myMA20 and ((rsiValue > rsiEMA) or crossover(rsiValue, rsiEMA)) and greenCandle[1] and greenCandle and close > myMA5 myBuyCondition25 = myMA5 > myMA10 and myMA5 < myMA20 and (crossover(rsiValue, rsiEMA)) and greenCandle[2] and greenCandle[1] and greenCandle and close > myMA5 myBuyCondition26 = myMA5 > myMA10 and ((rsiValue > rsiEMA) or crossover(rsiValue, rsiEMA)) and close > myMA5 and close > open[2] myBuyCondition27 = myMA5 < myMA10 and myMA10 < myMA20 and greenCandle[2] and greenCandle[1] and greenCandle and ((rsiValue > rsiEMA) or crossover(rsiValue, rsiEMA)) myBuyCondition28 = myMA5 < myMA10 and myMA10 < myMA20 and ((rsiValue > rsiEMA) or crossover(rsiValue, rsiEMA)) and greenCandle and close > myMA10 and close > open[1] myBuyCondition29 = myMA5 < myMA10 and myMA10 < myMA20 and ((rsiValue > rsiEMA) or crossover(rsiValue, rsiEMA)) and greenCandle[1] and greenCandle and close > myMA10 myBuyConditionTotal = (myBuyCondition29 or myBuyCondition28 or myBuyCondition27 or myBuyCondition26 or myBuyCondition25 or myBuyCondition24 or myBuyCondition23 or myBuyCondition22 or myBuyCondition21 or myBuyCondition20 or myBuyCondition19 or myBuyCondition18 or myBuyCondition17 or myBuyCondition16 or myBuyCondition15 or myBuyCondition14 or myBuyCondition1 or myBuyCondition2 or myBuyCondition4 or myBuyCondition5 or myBuyCondition6 or myBuyCondition7 or myBuyCondition8 or myBuyCondition9 or myBuyCondition10 or myBuyCondition11 ) mySellCondition1 = myMA5 > myMA10 and myMA10 > myMA20 and greenCandle[4] and greenCandle[3] and redCandle[2] and redCandle[1] and redCandle and close < myMA5 and close < open[3] and (rsiValue < rsiEMA) mySellCondition2 = myMA5 > myMA10 and myMA10 > myMA20 and greenCandle[2] and redCandle[1] and redCandle and close[2] > myMA5 and close < myMA5 and close < open[2] and (rsiValue < rsiEMA) mySellCondition3 = myMA5 < myMA20 and myMA10 < myMA20 and greenCandle[2] and redCandle[1] and redCandle and close[2] > myMA5 and close < myMA5 and (rsiValue < rsiEMA) mySellCondition4 = myMA5 < myMA10 and myMA10 < myMA20 and redCandle[2] and greenCandle[1] and redCandle and close < myMA5 and ((rsiValue < rsiEMA)) mySellCondition5 = myMA5 > myMA20 and myMA10 < myMA20 and greenCandle[3] and redCandle[2] and greenCandle[1] and redCandle and close[1] > myMA5 and close < myMA5 and close < open[1] and close[2] < myMA5 and (rsiValue < rsiEMA) mySellCondition6 = myMA5 > myMA20 and myMA10 < myMA20 and redCandle and close < myMA20 and close < open[3] and (rsiValue < rsiEMA) mySellCondition7 = myMA5 < myMA10 and myMA10 < myMA20 and greenCandle[2] and greenCandle[1] and redCandle and close[1] > myMA5 and close < myMA5 and ((rsiValue < rsiEMA)) mySellCondition8 = myMA5 < myMA20 and myMA10 < myMA20 and greenCandle[1] and redCandle and close < myMA5 and (rsiValue < rsiEMA) and ((rsiValue < rsiEMA)) mySellCondition9 = myMA5 < myMA20 and myMA10 < myMA20 and redCandle[2] and greenCandle[1] and redCandle and close < myMA5 and close < open[1] and ((rsiValue < rsiEMA)) mySellCondition10 = myMA5 < myMA20 and myMA10 < myMA20 and redCandle[1] and redCandle and close < myMA5 and (rsiValue < rsiEMA) mySellCondition11 = myMA5 > myMA10 and myMA5 < myMA20 and redCandle[2] and greenCandle[1] and redCandle and close < myMA20 and (rsiValue < rsiEMA) mySellCondition12 = myMA5 < myMA10 and myMA10 < myMA20 and greenCandle[2] and greenCandle[1] and redCandle and close < open[1] and ((rsiValue < rsiEMA)) //mySellCondition13 = redCandle and open > upr and close > upr and close > close[1] //mySellCondition14 = myMA5 > myMA10 and myMA10 > myMA20 and greenCandle[3] and redCandle[2] and greenCandle[1] and redCandle and close < myMA5 and close[2] < myMA5 mySellCondition15 = myMA5 < myMA10 and myMA10 > myMA20 and redCandle[1] and redCandle and close < myMA20 and (rsiValue < rsiEMA) mySellCondition16 = myMA5 > myMA10 and myMA10 > myMA20 and redCandle[1] and redCandle and close < myMA20 and (rsiValue < rsiEMA) mySellCondition17 = myMA5 < myMA10 and myMA5 > myMA20 and redCandle and close < open[2] and (rsiValue < rsiEMA) mySellCondition18 = myMA5 > myMA10 and myMA10 > myMA20 and greenCandle[2] and greenCandle[1] and redCandle and open > close[1] and close < open[2] and close < myMA5 and (rsiValue < rsiEMA) mySellCondition19 = myMA5 > myMA10 and myMA10 > myMA20 and greenCandle[3] and redCandle[2] and greenCandle[1] and redCandle and close < myMA5 and close < open[3] and (close[2] < open[3]) and (rsiValue < rsiEMA) mySellCondition20 = myMA5 < myMA10 and myMA5 > myMA20 and redCandle[2] and greenCandle[1] and redCandle and ((rsiValue < rsiEMA)) mySellCondition21 = myMA5 > myMA10 and myMA10 > myMA20 and greenCandle[2] and greenCandle[1] and redCandle and close < open[2] and close < myMA5 and (rsiValue < rsiEMA) mySellCondition22 = myMA5 > myMA10 and myMA10 > myMA20 and greenCandle[2] and redCandle[1] and redCandle and close < myMA10 and close < open[2] and (rsiValue < rsiEMA) mySellCondition23 = myMA5 > myMA10 and (rsiValue < rsiEMA) and close < myMA5 and greenCandle[3] and greenCandle[2] and redCandle[1] and redCandle and close < open[3] mySellCondition24 = myMA5 > myMA10 and myMA10 > myMA20 and redCandle[2] and redCandle[1] and redCandle and ((rsiValue < rsiEMA)) mySellCondition25 = myMA5 > myMA10 and myMA10 > myMA20 and redCandle and close < myMA10 and ((rsiValue < rsiEMA)) mySellConditionTotal = (mySellCondition25 or mySellCondition24 or mySellCondition23 or mySellCondition22 or mySellCondition20 or mySellCondition21 or mySellCondition18 or mySellCondition17 or mySellCondition16 or mySellCondition15 or mySellCondition12 or mySellCondition11 or mySellCondition10 or mySellCondition9 or mySellCondition8 or mySellCondition7 or mySellCondition6 or mySellCondition5 or mySellCondition4 or mySellCondition3 or mySellCondition2 or mySellCondition1) plot(series=myMA5, color=color.yellow, linewidth=2) plot(series=myMA10, color=color.blue, linewidth=2) plot(series=myMA20, color=color.white, linewidth=2) plotarrow(series=myBuyConditionTotal ? 1 : mySellConditionTotal ? -1 : na, colorup=color.new(color.white,0), colordown=color.new(color.lime,0), maxheight=30) alertcondition(condition=myBuyConditionTotal, title="Buy Bar", message="{{ticker}}-BUY, price = {{close}}") alertcondition(condition=mySellConditionTotal, title="Sell Bar", message="{{ticker}}-SELL, price = {{close}}") //currentPrice = security(syminfo.tickerid, "15", close) //BuyEntryPrice = if (myBuyConditionTotal) //currentPrice //BuyExitPrice = if (currentPrice > BuyEntryPrice * 100.05%) // alertcondition(condition=BuyExitPrice, title="buy wxit Bar", message="{{ticker}}-buy exit, price = {{close}}") plot(series=close) //Copyright: Jayanta Sarkar
Commitment of Traders: Total
https://www.tradingview.com/script/CQBbeOHQ-Commitment-of-Traders-Total/
TradingView
https://www.tradingview.com/u/TradingView/
700
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © TradingView //@version=5 indicator("Commitment of Traders: Total", "COT Total", format = format.volume) import TradingView/LibraryCOT/2 as cot // Tooltips. var string TT_MODE = "Determines which information from the chart's symbol will be used to fetch COT data:\n • 'Root' uses the root of a futures symbol ('ES' for 'ESH2020').\n • 'Base currency' uses the base currency in a forex pair ('EUR' for 'EURUSD').\n • 'Currency' uses the quote currency, i.e., the currency the symbol is traded in ('JPY' for 'TSE:9984' or 'USDJPY').\n • 'Auto' tries all modes, in turn.\n If no COT data can be found, a runtime error is generated." var string TT_OVERRIDE = "Instead of letting the script generate the CFTC COT code from the chart and the above selections when this field is empty, you can specify an unrelated CFTC COT code here, e.g., 001602 for wheat futures." // Inputs. string selectionModeInput = input.string("Auto", "COT selection mode", options = ["Auto", "Root", "Base currency", "Currency"], tooltip = TT_MODE) string includeOptionsInput = input.string("Futures", "Futures/Options", options = ["Futures", "Options", "Futures + Options"]) string selectedTypeInput = input.string("Long", "Display", options = ["Long", "Short", "Long + Short", "Long - Short", "Long %"]) string userCFTCCodeInput = input.string("", "CFTC Code", tooltip = TT_OVERRIDE) // Chart-based or user-based CFTC code. var string cftcCode = userCFTCCodeInput != "" ? userCFTCCodeInput : cot.convertRootToCOTCode(selectionModeInput) dataRequest(cftcCode, metricName, isLong) => futuresOnlyTicker = cot.COTTickerid("Legacy", cftcCode, false, metricName, isLong ? "Long" : "Short", "All") futuresWithOptionsTicker = cot.COTTickerid("Legacy", cftcCode, true, metricName, isLong ? "Long" : "Short", "All") futuresOnly = request.security(futuresOnlyTicker, "1D", close, ignore_invalid_symbol = true) futuresWithOptions = request.security(futuresWithOptionsTicker, "1D", close, ignore_invalid_symbol = true) if barstate.islastconfirmedhistory and (na(futuresOnly) or na(futuresWithOptions)) runtime.error(str.format("Could not find relevant COT data based on the current symbol and the COT selection mode `{0}`.", selectionModeInput)) switch includeOptionsInput "Futures" => futuresOnly "Options" => futuresWithOptions - futuresOnly "Futures + Options" => futuresWithOptions => na metric(cftcCode, metricCode) => cotLong = dataRequest(cftcCode, metricCode, true) cotShort = dataRequest(cftcCode, metricCode, false) switch selectedTypeInput "Long" => cotLong "Short" => cotShort "Long + Short" => cotLong + cotShort "Long - Short" => cotLong - cotShort "Long %" => cotLong / (cotLong + cotShort) * 100 => na largeTraders = metric(cftcCode, "Noncommercial Positions") smallTraders = metric(cftcCode, "Nonreportable Positions") commercialHedgers = metric(cftcCode, "Commercial Positions") // Plot COT data. plot(largeTraders, color=color.red, title="Large Traders", style=plot.style_stepline_diamond) plot(smallTraders, color=color.blue, title="Small Traders", style=plot.style_stepline_diamond) plot(commercialHedgers, color=color.green, title="Commercial Hedgers", style=plot.style_stepline_diamond) // Display the COT ticker in the lower left. var table displayedSymbol = table.new(position.bottom_left, 1, 1) if barstate.isfirst color TEXT_COLOR = color.white color BG_COLOR = color.new(color.blue, 50) string dataCOT = userCFTCCodeInput != "" ? userCFTCCodeInput : cot.convertRootToCOTCode(selectionModeInput, false) string txt = str.format("COT data for {0} {1}\nCFTC Code: {2}", dataCOT, includeOptionsInput, cftcCode) table.cell(displayedSymbol, 0, 0, txt, text_halign = text.align_left, text_color = TEXT_COLOR, bgcolor = BG_COLOR)
RSI Triple Time Frame
https://www.tradingview.com/script/yYWBxaeh-RSI-Triple-Time-Frame/
LucasVivien
https://www.tradingview.com/u/LucasVivien/
148
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Special credits: Matthew J. Slabosz / Zen & The Art of Trading // Scipt Author: © LucasVivien // last pbl. = v141 / V5 = v146 // @version=5 indicator('RSI Triple Time Frame', shorttitle='RSI TTF', overlay=false) //////////////////////////////////////// User input ////////////////////////////////////// rsiLen = input.int (title='Length' , defval=14, group='RSI Parameters') rsiOB = input.float(title='Overbought', defval=70, group='RSI Parameters') rsiN = input.float(title='Neutral' , defval=50, group='RSI Parameters') rsiOS = input.float(title='Oversold' , defval=30, group='RSI Parameters') OBcolor = input.bool(title='Overbought' , defval=false, group='Background Colors', tooltip='Color chart backgroud red when TF1 & TF2 & TF3 are overbought on the same tick') OScolor = input.bool(title='Oversold' , defval=false, group='Background Colors', tooltip='Color chart backgroud green when TF1 & TF2 & TF3 are oversold on the same tick') Nbullcolor = input.bool(title='Crossover neutral' , defval=false, group='Background Colors', tooltip='Color chart backgroud yellow when TF1 & TF2 & TF3 enter bull control zone on the same tick') Nbearcolor = input.bool(title='Crossunder neutral', defval=false, group='Background Colors', tooltip='Color chart backgroud orange when TF1 & TF2 & TF3 enter bear control zone on the same tick') on0 = input.bool (title='Chart Timeframe', defval=true , group='Timeframes', inline="0") on1 = input.bool (title='Timeframe 1' , defval=false , group='Timeframes', inline="1") TF1 = input.timeframe(title='' , defval='30' , group='Timeframes', inline="1") on2 = input.bool (title='Timeframe 2' , defval=false , group='Timeframes', inline="2") TF2 = input.timeframe(title='' , defval='60' , group='Timeframes', inline="2") on3 = input.bool (title='Timeframe 3' , defval=false , group='Timeframes', inline="3") TF3 = input.timeframe(title='' , defval='120' , group='Timeframes', inline="3") SMAplot = input(title='SMA / Lenght', defval=false, group='Signal Line', inline="4") SMAlen = input(title='' , defval=10 , group='Signal Line', inline="4") ////////////////////////////////////// RSI timeframes //////////////////////////////////// rsiact = ta.rsi(close, rsiLen) SMArsi = ta.sma(rsiact, SMAlen) rsiTF1 = request.security(syminfo.tickerid, TF1, rsiact[barstate.isrealtime ? 1 : 0]) rsiTF2 = request.security(syminfo.tickerid, TF2, rsiact[barstate.isrealtime ? 1 : 0]) rsiTF3 = request.security(syminfo.tickerid, TF3, rsiact[barstate.isrealtime ? 1 : 0]) ///////////////////////////////// Check if OB/OS/neutral ///////////////////////////////// RSIOB1 = rsiTF1 >= rsiOB RSIOB2 = rsiTF2 >= rsiOB RSIOB3 = rsiTF3 >= rsiOB RSIOS1 = rsiTF1 <= rsiOS RSIOS2 = rsiTF2 <= rsiOS RSIOS3 = rsiTF3 <= rsiOS RSIN1bullcross = ta.crossover(rsiTF1, rsiN) RSIN2bullcross = ta.crossover(rsiTF2, rsiN) RSIN3bullcross = ta.crossover(rsiTF3, rsiN) RSIN1bearcross = ta.crossunder(rsiTF1, rsiN) RSIN2bearcross = ta.crossunder(rsiTF2, rsiN) RSIN3bearcross = ta.crossunder(rsiTF3, rsiN) ///////////////////////////////// Conditions Validation ///////////////////////////////// OBtrigger = RSIOB1 and RSIOB2 and RSIOB3 OStrigger = RSIOS1 and RSIOS2 and RSIOS3 Nbulltrigger = RSIN1bullcross and RSIN2bullcross and RSIN3bullcross Nbeartrigger = RSIN1bearcross and RSIN2bearcross and RSIN3bearcross //////////////////////////////////////// Plot RSIs /////////////////////////////////////// plot(on0 == true ? rsiact : na, color=color.new(#ff0066 , 0), title='RSI Current Timeframe', linewidth=2) plot(on1 == true ? rsiTF1 : na, color=color.new(#ff00ff , 0), title='RSI Timeframe #1' , linewidth=1) plot(on2 == true ? rsiTF2 : na, color=color.new(#cc00cc , 0), title='RSI Timeframe #2' , linewidth=1) plot(on3 == true ? rsiTF3 : na, color=color.new(#660066 , 0), title='RSI Timeframe #3' , linewidth=1) plot(SMAplot ? SMArsi : na, color=color.new(color.yellow, 0), title="RSI SMA plot" , linewidth=1) rob = hline(rsiOB, color=#666666, title='RSI Overbought', linestyle=hline.style_dotted) ros = hline(rsiOS, color=#666666, title='RSI Oversold' , linestyle=hline.style_dotted) mid = hline(rsiN , color=#666666, title='RSI Neutral' , linestyle=hline.style_dashed) top = hline(100 , color=#666666, title='RSI Min' , linestyle=hline.style_solid) bot = hline(0 , color=#666666, title='RSI Max' , linestyle=hline.style_solid) fill(top, bot, color=OBtrigger and OBcolor ? color.new(color.red, 50) : OStrigger and OScolor ? color.new(color.green, 50) : na) fill(top, bot, color=Nbulltrigger and Nbullcolor ? color.new(#ffff1a , 50) : Nbeartrigger and Nbearcolor ? color.new(#ff8000 , 50) : na) //////////////////////////////////////// Alerts /////////////////////////////////////// alertcondition(OBtrigger or OStrigger, title="Triple TF RSI Alert", message="{{ticker}}: RSI values at extreme levels on all 3 timeframes")
Bitmex BTC Perpetual Premium and Funding
https://www.tradingview.com/script/zmCXl9mj-Bitmex-BTC-Perpetual-Premium-and-Funding/
egils75
https://www.tradingview.com/u/egils75/
79
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © egils75 //@version=4 study("Bitmex BTC Perp Premium and Funding", shorttitle="BTC Premium and Funding", overlay=false, format=format.percent, precision=4, resolution="") //Interest and funding calculation INTEREST_BASE = security("BITMEX:XBTBON8H", "", close)*100 INTEREST_QUOTE = security("BITMEX:USDBON8H", "", close)*100 INTEREST_RATE = (INTEREST_QUOTE - INTEREST_BASE)/3 PREMIUM = security("BITMEX:XBTUSDPI8H", "", close)*100 INTEREST_DIFF = INTEREST_RATE - PREMIUM FUNDING = if INTEREST_DIFF > 0.05 PREMIUM+0.05 else if INTEREST_DIFF < -0.05 PREMIUM-0.05 else PREMIUM+INTEREST_DIFF //Plot values hline(0, color=color.black, title="0 Line") plot(FUNDING, style=plot.style_columns, color=color.yellow, title="Perpetual Funding Rate") plot(PREMIUM, color=color.red, title="Perpetual Premium")
Commitment of Traders: Financial Metrics
https://www.tradingview.com/script/9wP2dU52-Commitment-of-Traders-Financial-Metrics/
TradingView
https://www.tradingview.com/u/TradingView/
346
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © TradingView //@version=5 indicator("Commitment of Traders: Financial Metrics", "COT Financial", format = format.volume) import TradingView/LibraryCOT/2 as cot // Directions. var string ND = " [ND]" var string LS = " [L|Sh]" var string LSS = " [L|Sh|Sp]" // ————— Metric names. var string MB01 = "Open Interest" var string MB02 = "Dealer Positions" var string MB03 = "Asset Manager Positions" var string MB04 = "Leveraged Funds Positions" var string MB05 = "Other Reportable Positions" var string MB06 = "Total Reportable Positions" var string MB07 = "Nonreportable Positions" var string MB08 = "Traders Total" var string MB09 = "Traders Dealer" var string MB10 = "Traders Asset Manager" var string MB11 = "Traders Leveraged Funds" var string MB12 = "Traders Other Reportable" var string MB13 = "Traders Total Reportable" var string MB14 = "Concentration Gross LE 4 TDR" var string MB15 = "Concentration Gross LE 8 TDR" var string MB16 = "Concentration Net LE 4 TDR" var string MB17 = "Concentration Net LE 8 TDR" // Metric name options. var string M01 = MB01 + ND var string M02 = MB02 + LSS var string M03 = MB03 + LSS var string M04 = MB04 + LSS var string M05 = MB05 + LSS var string M06 = MB06 + LS var string M07 = MB07 + LS var string M08 = MB08 + ND var string M09 = MB09 + LSS var string M10 = MB10 + LSS var string M11 = MB11 + LSS var string M12 = MB12 + LSS var string M13 = MB13 + LS var string M14 = MB14 + LS var string M15 = MB15 + LS var string M16 = MB16 + LS var string M17 = MB17 + LS // Tooltips. var string TT_METRIC = "Each metric is followed by its possible directions in square brackets:\n [ND] 🠆 No Direction\n [L] 🠆 Long\n [Sh] 🠆 Short\n [Sp] 🠆 Spreading" var string TT_DIR = "The 'direction' must be one that is allowed for the chosen metric. Valid selections are displayed with each metric in the above field's dropdown menu items." var string TT_TYPE = "The 'type' qualifies the metric data to be retrieved." var string TT_MODE = "Determines which information from the chart's symbol will be used to fetch COT data:\n • 'Root' uses the root of a futures symbol ('ES' for 'ESH2020').\n • 'Base currency' uses the base currency in a forex pair ('EUR' for 'EURUSD').\n • 'Currency' uses the quote currency, i.e., the currency the symbol is traded in ('JPY' for 'TSE:9984' or 'USDJPY').\n • 'Auto' tries all modes, in turn.\n If no COT data can be found, a runtime error is generated." var string TT_OVERRIDE = "Instead of letting the script generate the CFTC COT code from the chart and the above selections when this field is empty, you can specify an unrelated CFTC COT code here, e.g., 001602 for wheat futures." // Inputs. string metricNameInput = input.string(M01, "Metric", options = [M01, M02, M03, M04, M05, M06, M07, M08, M09, M10, M11, M12, M13, M14, M15, M16, M17], tooltip = TT_METRIC) string metricDirectionInput = input.string("No direction", "Direction", options = ["No direction", "Long", "Short", "Spreading"]) string selectionModeInput = input.string("Auto", "COT selection mode", options = ["Auto", "Root", "Base currency", "Currency"], tooltip = TT_MODE) string includeOptionsInput = input.string("Futures", "Futures/Options", options = ["Futures", "Options", "Futures + Options"]) string userCFTCCodeInput = input.string("", "CFTC Code", tooltip = TT_OVERRIDE) getMetricName(simple string userMetricName) => result = switch userMetricName M01 => MB01 M02 => MB02 M03 => MB03 M04 => MB04 M05 => MB05 M06 => MB06 M07 => MB07 M08 => MB08 M09 => MB09 M10 => MB10 M11 => MB11 M12 => MB12 M13 => MB13 M14 => MB14 M15 => MB15 M16 => MB16 M17 => MB17 => "" // Chart-based or user-based CFTC code. var string cftcCode = userCFTCCodeInput != "" ? userCFTCCodeInput : cot.convertRootToCOTCode(selectionModeInput) // Fetch the two sources from which we can generate all three combinations of futures and options data. string typeCOT = "Financial" string metricType = "All" string metricName = getMetricName(metricNameInput) string futuresOnlyTicker = cot.COTTickerid(typeCOT, cftcCode, false, metricName, metricDirectionInput, metricType) string futuresWithOptionsTicker = cot.COTTickerid(typeCOT, cftcCode, true, metricName, metricDirectionInput, metricType) float futuresOnly = request.security(futuresOnlyTicker, "D", close, ignore_invalid_symbol = true) float futuresWithOptions = request.security(futuresWithOptionsTicker, "D", close, ignore_invalid_symbol = true) if barstate.islastconfirmedhistory and (na(futuresOnly) or na(futuresWithOptions)) runtime.error(str.format("Could not find relevant COT data based on the current symbol and the COT selection mode `{0}`.", selectionModeInput)) // Select the user-defined futures and options content for the COT data. float COTSeries = switch includeOptionsInput "Futures" => futuresOnly "Options" => futuresWithOptions - futuresOnly "Futures + Options" => futuresWithOptions => na // Plot COT data. plot(COTSeries, "COT", style = plot.style_stepline_diamond) // Display the COT ticker in the lower left. var table displayedSymbol = table.new(position.bottom_left, 1, 1) if barstate.isfirst color TEXT_COLOR = color.white color BG_COLOR = color.new(color.blue, 50) string dataCOT = userCFTCCodeInput != "" ? userCFTCCodeInput : cot.convertRootToCOTCode(selectionModeInput, false) string requestedTicker = switch includeOptionsInput "Futures" => futuresOnlyTicker "Options" => futuresWithOptionsTicker + "-" + futuresOnlyTicker "Futures + Options" => futuresWithOptionsTicker string txt = str.format("COT3 data for {0} {1}\nRequested ticker: {2}", dataCOT, includeOptionsInput, requestedTicker) table.cell(displayedSymbol, 0, 0, txt, text_halign = text.align_left, text_color = TEXT_COLOR, bgcolor = BG_COLOR)
Commitment of Traders: Disaggregated Metrics
https://www.tradingview.com/script/QmIAaONl-Commitment-of-Traders-Disaggregated-Metrics/
TradingView
https://www.tradingview.com/u/TradingView/
287
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © TradingView //@version=5 indicator("Commitment of Traders: Disaggregated Metrics", "COT Disaggregated", format = format.volume) import TradingView/LibraryCOT/2 as cot // Directions. var string ND = " [ND]" var string LS = " [L|Sh]" var string LSS = " [L|Sh|Sp]" // ————— Metric names var string MB01 = "Open Interest" var string MB02 = "Producer Merchant Positions" var string MB03 = "Swap Positions" var string MB04 = "Managed Money Positions" var string MB05 = "Other Reportable Positions" var string MB06 = "Total Reportable Positions" var string MB07 = "Nonreportable Positions" var string MB08 = "Traders Total" var string MB09 = "Traders Producer Merchant" var string MB10 = "Traders Swap" var string MB11 = "Traders Managed Money" var string MB12 = "Traders Other Reportable" var string MB13 = "Traders Total Reportable" var string MB14 = "Concentration Gross LE 4 TDR" var string MB15 = "Concentration Gross LE 8 TDR" var string MB16 = "Concentration Net LE 4 TDR" var string MB17 = "Concentration Net LE 8 TDR" // Metric name options. var string M01 = MB01 + ND var string M02 = MB02 + LS var string M03 = MB03 + LSS var string M04 = MB04 + LSS var string M05 = MB05 + LSS var string M06 = MB06 + LS var string M07 = MB07 + LS var string M08 = MB08 + ND var string M09 = MB09 + LS var string M10 = MB10 + LSS var string M11 = MB11 + LSS var string M12 = MB12 + LSS var string M13 = MB13 + LS var string M14 = MB14 + LS var string M15 = MB15 + LS var string M16 = MB16 + LS var string M17 = MB17 + LS // Tooltips. var string TT_METRIC = "Each metric is followed by its possible directions in square brackets:\n [ND] 🠆 No Direction\n [L] 🠆 Long\n [Sh] 🠆 Short\n [Sp] 🠆 Spreading" var string TT_DIR = "The 'direction' must be one that is allowed for the chosen metric. Valid selections are displayed with each metric in the above field's dropdown menu items." var string TT_TYPE = "The 'type' qualifies the metric data to be retrieved." var string TT_OVERRIDE = "Instead of letting the script generate the CFTC COT code from the root of the chart symbol and the above selections when this field is empty, you can specify an unrelated CFTC COT code here, e.g., 001602 for wheat futures." // Inputs. string metricNameInput = input.string(M01, "Metric", options = [M01, M02, M03, M04, M05, M06, M07, M08, M09, M10, M11, M12, M13, M14, M15, M16, M17], tooltip = TT_METRIC) string metricDirectionInput = input.string("No direction", "Direction", options = ["No direction", "Long", "Short", "Spreading"], tooltip = TT_DIR) string metricTypeInput = input.string("All", "Type", options = ["All", "Old", "Other"], tooltip = TT_TYPE) string includeOptionsInput = input.string("Futures", "Futures/Options", options = ["Futures", "Options", "Futures + Options"]) string userCFTCCodeInput = input.string("", "CFTC Code", tooltip = TT_OVERRIDE) getMetricName(simple string userMetricName) => result = switch userMetricName M01 => MB01 M02 => MB02 M03 => MB03 M04 => MB04 M05 => MB05 M06 => MB06 M07 => MB07 M08 => MB08 M09 => MB09 M10 => MB10 M11 => MB11 M12 => MB12 M13 => MB13 M14 => MB14 M15 => MB15 M16 => MB16 M17 => MB17 => "" // Chart-based or user-based CFTC code. var string cftcCode = userCFTCCodeInput != "" ? userCFTCCodeInput : cot.convertRootToCOTCode("Root") // Fetch the two sources from which we can generate all three combinations of futures and options data. string typeCOT = "Disaggregated" string metricName = getMetricName(metricNameInput) string futuresOnlyTicker = cot.COTTickerid(typeCOT, cftcCode, false, metricName, metricDirectionInput, metricTypeInput) string futuresWithOptionsTicker = cot.COTTickerid(typeCOT, cftcCode, true, metricName, metricDirectionInput, metricTypeInput) float futuresOnly = request.security(futuresOnlyTicker, "D", close, ignore_invalid_symbol = true) float futuresWithOptions = request.security(futuresWithOptionsTicker, "D", close, ignore_invalid_symbol = true) if barstate.islastconfirmedhistory and (na(futuresOnly) or na(futuresWithOptions)) runtime.error(str.format("Could not find relevant COT data based on the current symbol and the COT selection mode `{0}`.", "Root")) // Select the user-defined futures and options content for the COT data. float COTSeries = switch includeOptionsInput "Futures" => futuresOnly "Options" => futuresWithOptions - futuresOnly "Futures + Options" => futuresWithOptions => na // Plot COT data. plot(COTSeries, "COT", style = plot.style_stepline_diamond) // Display the COT ticker in the lower left. var table displayedSymbol = table.new(position.bottom_left, 1, 1) if barstate.isfirst color TEXT_COLOR = color.white color BG_COLOR = color.new(color.blue, 50) string dataCOT = userCFTCCodeInput != "" ? userCFTCCodeInput : cot.convertRootToCOTCode("Root", false) string requestedTicker = switch includeOptionsInput "Futures" => futuresOnlyTicker "Options" => futuresWithOptionsTicker + "-" + futuresOnlyTicker "Futures + Options" => futuresWithOptionsTicker string txt = str.format("COT2 data for {0} {1}\nRequested ticker: {2}", dataCOT, includeOptionsInput, requestedTicker) table.cell(displayedSymbol, 0, 0, txt, text_halign = text.align_left, text_color = TEXT_COLOR, bgcolor = BG_COLOR)
Currency Strength
https://www.tradingview.com/script/hOTeeXCe-Currency-Strength/
HayeTrading
https://www.tradingview.com/u/HayeTrading/
166
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © HayeTrading //@version=5 indicator("Currency Strength", overlay=true) rsilen = input.int(14, "RSI Length") rsi = ta.rsi(close, rsilen) // Reverse the ticker value to make standard base currency rev(sec) => _r = 100 - sec _r // USD usdjpy = request.security("USDJPY", "", rsi) usdcad = request.security("USDCAD", "", rsi) eurusd = request.security("EURUSD", "", rsi) eurusd_r = rev(eurusd) gbpusd = request.security("GBPUSD", "", rsi) gbpusd_r = rev(gbpusd) audusd = request.security("AUDUSD", "", rsi) audusd_r = rev(audusd) c_usd = math.avg(usdjpy,usdcad,eurusd_r,gbpusd_r,audusd_r) // EUR eurjpy = request.security("EURJPY", "", rsi) eurcad = request.security("EURCAD", "", rsi) eurgbp = request.security("EURGBP", "", rsi) // eurusd euraud = request.security("EURAUD", "", rsi) c_eur = math.avg(eurjpy,eurcad,eurgbp,eurusd,euraud) // GBP // gbpusd eurgbp_r = rev(eurgbp) gbpjpy = request.security("GBPJPY", "", rsi) gbpcad = request.security("GBPCAD", "", rsi) gbpaud = request.security("GBPAUD", "", rsi) c_gbp = math.avg(gbpusd,eurgbp_r,gbpjpy,gbpcad,gbpaud) // CAD usdcad_r = rev(usdcad) eurcad_r = rev(eurcad) gbpcad_r = rev(gbpcad) cadjpy = request.security("CADJPY", "", rsi) audcad = request.security("AUDCAD", "", rsi) audcad_r = rev(audcad) c_cad = math.avg(usdcad_r,eurcad_r,gbpcad_r,cadjpy,audcad_r) // AUD // audusd euraud_r = rev(euraud) gbpaud_r = rev(gbpaud) // audcad audjpy = request.security("AUDJPY", "", rsi) c_aud = math.avg(audusd,euraud_r,gbpaud_r,audcad,audjpy) // JPY usdjpy_r = rev(usdjpy) eurjpy_r = rev(eurjpy) gbpjpy_r = rev(gbpjpy) cadjpy_r = rev(cadjpy) audjpy_r = rev(audjpy) c_jpy = math.avg(usdjpy_r,eurjpy_r,gbpjpy_r,cadjpy_r,audjpy_r) // Round RSI average values to 1 decimal place r_usd = math.round(c_usd, 1) r_eur = math.round(c_eur, 1) r_gbp = math.round(c_gbp, 1) r_cad = math.round(c_cad, 1) r_aud = math.round(c_aud, 1) r_jpy = math.round(c_jpy, 1) // Calculate background color scale f_col(val) => g_base = 155 g_scale = g_base + math.min(((val - 50) * 8), 100) g_col = color.rgb(0, g_scale, 7) r_base = 90 r_rev_val = 100 - val r_scale = r_base - math.min(((r_rev_val - 50) * 3), 90) r_col = color.rgb(255, r_scale, r_scale) _col = val >= 50 ? g_col : r_col _col usd_col = f_col(r_usd) eur_col = f_col(r_eur) gbp_col = f_col(r_gbp) cad_col = f_col(r_cad) aud_col = f_col(r_aud) jpy_col = f_col(r_jpy) // Higher or lower than the value X bars ago difflen = input.int(5, "X Bar Change") highlow(val, difflen) => arrow = val > val[difflen] ? "▲" : val < val[difflen] ? "▼" : "-" arrow usd_hl = highlow(r_usd, difflen) eur_hl = highlow(r_eur, difflen) gbp_hl = highlow(r_gbp, difflen) cad_hl = highlow(r_cad, difflen) aud_hl = highlow(r_aud, difflen) jpy_hl = highlow(r_jpy, difflen) i_tableYpos = input.string("top", "Panel position", options = ["top", "middle", "bottom"]) i_tableXpos = input.string("right", "", options = ["left", "center", "right"]) i_size = input.string("Large", "Text Size", options = ["Large", "Normal", "Auto"]) t_size = i_size == "Large" ? size.large : i_size == "Normal" ? size.normal : size.auto var table panel = table.new(i_tableYpos + "_" + i_tableXpos, 3, 7, frame_color=color.black, frame_width=1, border_color=color.black, border_width=1) if barstate.islast // Table header. table.cell(panel, 0, 0, "Ticker", bgcolor = color.orange) table.cell(panel, 1, 0, "RSI", bgcolor = color.orange) table.cell(panel, 2, 0, "Dir.(" + str.tostring(difflen) + ")", bgcolor = color.orange) // Column 1 table.cell(panel, 0, 1, "USD", bgcolor = usd_col, text_size=t_size) table.cell(panel, 0, 2, "EUR", bgcolor = eur_col, text_size=t_size) table.cell(panel, 0, 3, "GBP", bgcolor = gbp_col, text_size=t_size) table.cell(panel, 0, 4, "CAD", bgcolor = cad_col, text_size=t_size) table.cell(panel, 0, 5, "AUD", bgcolor = aud_col, text_size=t_size) table.cell(panel, 0, 6, "JPY", bgcolor = jpy_col, text_size=t_size) // Column 2 table.cell(panel, 1, 1, str.tostring(r_usd), bgcolor = usd_col, text_size=t_size) table.cell(panel, 1, 2, str.tostring(r_eur), bgcolor = eur_col, text_size=t_size) table.cell(panel, 1, 3, str.tostring(r_gbp), bgcolor = gbp_col, text_size=t_size) table.cell(panel, 1, 4, str.tostring(r_cad), bgcolor = cad_col, text_size=t_size) table.cell(panel, 1, 5, str.tostring(r_aud), bgcolor = aud_col, text_size=t_size) table.cell(panel, 1, 6, str.tostring(r_jpy), bgcolor = jpy_col, text_size=t_size) // Column 3 table.cell(panel, 2, 1, usd_hl, bgcolor = usd_col, text_size=t_size) table.cell(panel, 2, 2, eur_hl, bgcolor = eur_col, text_size=t_size) table.cell(panel, 2, 3, gbp_hl, bgcolor = gbp_col, text_size=t_size) table.cell(panel, 2, 4, cad_hl, bgcolor = cad_col, text_size=t_size) table.cell(panel, 2, 5, aud_hl, bgcolor = aud_col, text_size=t_size) table.cell(panel, 2, 6, jpy_hl, bgcolor = jpy_col, text_size=t_size)
Commitment of Traders: Legacy Metrics
https://www.tradingview.com/script/195p3YlK-Commitment-of-Traders-Legacy-Metrics/
TradingView
https://www.tradingview.com/u/TradingView/
796
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © TradingView //@version=5 indicator("Commitment of Traders: Legacy Metrics", "COT Legacy", format = format.volume) import TradingView/LibraryCOT/2 as cot // Directions. var string ND = " [ND]" var string LS = " [L|Sh]" var string LSS = " [L|Sh|Sp]" // ————— Metric names var string MB01 = "Open Interest" var string MB02 = "Noncommercial Positions" var string MB03 = "Commercial Positions" var string MB04 = "Total Reportable Positions" var string MB05 = "Nonreportable Positions" var string MB06 = "Traders Total" var string MB07 = "Traders Noncommercial" var string MB08 = "Traders Commercial" var string MB09 = "Traders Total Reportable" var string MB10 = "Concentration Gross LT 4 TDR" var string MB11 = "Concentration Gross LT 8 TDR" var string MB12 = "Concentration Net LT 4 TDR" var string MB13 = "Concentration Net LT 8 TDR" // Metric name options. var string M01 = MB01 + ND var string M02 = MB02 + LSS var string M03 = MB03 + LS var string M04 = MB04 + LS var string M05 = MB05 + LS var string M06 = MB06 + ND var string M07 = MB07 + LSS var string M08 = MB08 + LS var string M09 = MB09 + LS var string M10 = MB10 + LS var string M11 = MB11 + LS var string M12 = MB12 + LS var string M13 = MB13 + LS // Tooltips. var string TT_METRIC = "Each metric is followed by its possible directions in square brackets:\n [ND] 🠆 No Direction\n [L] 🠆 Long\n [Sh] 🠆 Short\n [Sp] 🠆 Spreading" var string TT_DIR = "The 'direction' must be one that is allowed for the chosen metric. Valid selections are displayed with each metric in the above field's dropdown menu items." var string TT_TYPE = "The 'type' qualifies the metric data to be retrieved." var string TT_MODE = "Determines which information from the chart's symbol will be used to fetch COT data:\n • 'Root' uses the root of a futures symbol ('ES' for 'ESH2020').\n • 'Base currency' uses the base currency in a forex pair ('EUR' for 'EURUSD').\n • 'Currency' uses the quote currency, i.e., the currency the symbol is traded in ('JPY' for 'TSE:9984' or 'USDJPY').\n • 'Auto' tries all modes, in turn.\n If no COT data can be found, a runtime error is generated." var string TT_OVERRIDE = "Instead of letting the script generate the CFTC COT code from the chart and the above selections when this field is empty, you can specify an unrelated CFTC COT code here, e.g., 001602 for wheat futures." // Inputs. string metricNameInput = input.string(M01, "Metric", options = [M01, M02, M03, M04, M05, M06, M07, M08, M09, M10, M11, M12, M13], tooltip = TT_METRIC) string metricDirectionInput = input.string("No direction", "Direction", options = ["No direction", "Long", "Short", "Spreading"], tooltip = TT_DIR) string metricTypeInput = input.string("All", "Type", options = ["All", "Old", "Other"], tooltip = TT_TYPE) string selectionModeInput = input.string("Auto", "COT Selection Mode", options = ["Auto", "Root", "Base currency", "Currency"], tooltip = TT_MODE) string includeOptionsInput = input.string("Futures", "Futures/Options", options = ["Futures", "Options", "Futures + Options"]) string userCFTCCodeInput = input.string("", "CFTC Code", tooltip = TT_OVERRIDE) getMetricName(simple string userMetricName) => result = switch userMetricName M01 => MB01 M02 => MB02 M03 => MB03 M04 => MB04 M05 => MB05 M06 => MB06 M07 => MB07 M08 => MB08 M09 => MB09 M10 => MB10 M11 => MB11 M12 => MB12 M13 => MB13 => "" // Chart-based or user-based CFTC code. var string cftcCode = userCFTCCodeInput != "" ? userCFTCCodeInput : cot.convertRootToCOTCode(selectionModeInput) // Fetch the two sources from which we can generate all three combinations of futures and options data. string typeCOT = "Legacy" string metricName = getMetricName(metricNameInput) string futuresOnlyTicker = cot.COTTickerid(typeCOT, cftcCode, false, metricName, metricDirectionInput, metricTypeInput) string futuresWithOptionsTicker = cot.COTTickerid(typeCOT, cftcCode, true, metricName, metricDirectionInput, metricTypeInput) float futuresOnly = request.security(futuresOnlyTicker, "D", close, ignore_invalid_symbol = true) float futuresWithOptions = request.security(futuresWithOptionsTicker, "D", close, ignore_invalid_symbol = true) if barstate.islastconfirmedhistory and (na(futuresOnly) or na(futuresWithOptions)) runtime.error(str.format("Could not find relevant COT data based on the current symbol and the COT selection mode `{0}`.", selectionModeInput)) // Select the user-defined futures and options content for the COT data. float COTSeries = switch includeOptionsInput "Futures" => futuresOnly "Options" => futuresWithOptions - futuresOnly "Futures + Options" => futuresWithOptions => na // Plot COT data. plot(COTSeries, "COT", style = plot.style_stepline_diamond) // Display the COT ticker in the lower left. var table displayedSymbol = table.new(position.bottom_left, 1, 1) if barstate.isfirst color TEXT_COLOR = color.white color BG_COLOR = color.new(color.blue, 50) string dataCOT = userCFTCCodeInput != "" ? userCFTCCodeInput : cot.convertRootToCOTCode(selectionModeInput, false) string requestedTicker = switch includeOptionsInput "Futures" => futuresOnlyTicker "Options" => futuresWithOptionsTicker + "-" + futuresOnlyTicker "Futures + Options" => futuresWithOptionsTicker string txt = str.format("COT data for {0} {1}\nRequested ticker: {2}", dataCOT, includeOptionsInput, requestedTicker) table.cell(displayedSymbol, 0, 0, txt, text_halign = text.align_left, text_color = TEXT_COLOR, bgcolor = BG_COLOR)
3commas GRID bot Visualisation
https://www.tradingview.com/script/QfTOMnmr-3commas-grid-bot-visualisation/
Crypto_BitCoinTrader
https://www.tradingview.com/u/Crypto_BitCoinTrader/
251
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © @Crypto_BitCoinTrader based @ChrisKaye indicator //@version=5 indicator(title="3commas GRID bot Visualisation", shorttitle="Grid bot", overlay=true, max_lines_count=100) float HighPrice=input.float(50000.00, "Upper Price") float LowPrice=input.float(40000.00, "Lower Price") int n=input.int(10, "Number of grids (max 100)", minval=2, maxval=100) n -= 1 step=(HighPrice-LowPrice)/n maxprofitprc = (step*100)/HighPrice minprofitprc = (step*100)/LowPrice UpColor = color.green DownColor = color.red var downline = line.new(bar_index, LowPrice, bar_index, LowPrice, extend=extend.right, color = DownColor, width=4) var upline = line.new(bar_index, HighPrice, bar_index, HighPrice, extend=extend.right, color = UpColor, width=4) var GridTable = table.new(position = position.top_right, columns = 4, rows = 2, bgcolor = color.white, border_width = 1) curr = syminfo.currency table.set_border_color(table_id = GridTable, border_color=color.black) table.cell(table_id = GridTable, column = 0, row = 0, text = "Qty lines") table.cell(table_id = GridTable, column = 0, row = 1, text = str.tostring(n+1)) table.cell(table_id = GridTable, column = 1, row = 0, text = "Qty cells") table.cell(table_id = GridTable, column = 1, row = 1, text = str.tostring(n)) table.cell(table_id = GridTable, column = 2, row = 0, text = "Step grid") table.cell(table_id = GridTable, column = 2, row = 1, text = str.tostring(step, "#.######## ") + curr) table.cell(table_id = GridTable, column = 3, row = 0, text = "Profit") table.cell(table_id = GridTable, column = 3, row = 1, text = str.tostring(maxprofitprc, "#.####") + "% - " + str.tostring(minprofitprc, "#.####") + "%") line hiLine = na label metka = na if barstate.isrealtime for i = 1 to n+1 if LowPrice<close hiLine := line.new(bar_index[1], LowPrice, bar_index, LowPrice, extend=extend.both, color=DownColor) else hiLine := line.new(bar_index[1], LowPrice, bar_index, LowPrice, extend=extend.both, color=UpColor) LowPrice += step
Closing Momentum
https://www.tradingview.com/script/qVpNTQSO-Closing-Momentum/
Austimize
https://www.tradingview.com/u/Austimize/
43
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Austimize //@version=5 indicator("Momentum Detector", overlay = true) upCandle = close > open ? true : false range1 = input.int(1, minval=1, title="Range 1") range2 = input.int(3, minval=1, title="Range 2") range3 = input.int(6, minval=1, title="Range 3") range4 = input.int(10, minval=1, title="Range 4") range5 = input.int(15, minval=1, title="Range 5") range6 = input.int(21, minval=1, title="Range 6") range7 = input.int(28, minval=1, title="Range 7") range8 = input.int(36, minval=1, title="Range 8") range9 = input.int(45, minval=1, title="Range 9") range10 = input.int(55, minval=1, title="Range 10") maType = input.string("EMA", options=["EMA", "SMA", "WMA"], title="MA Base") doRsiCandles = input.bool(false, "RSI candles?") doRsiDev = input.bool(false, "RSI deviations?") doSymbols = input.bool(false, "Momentum Symbols?") get_lowest (num, source) => lowval = 99999999.9 for i = 1 to num if source[i] < lowval lowval := source[i] lowval get_highest (num, source) => highval = 0.0 for i = 1 to num if source[i] > highval highval := source[i] highval hr1 = get_highest(range1, high) hr2 = get_highest(range2, high) hr3 = get_highest(range3, high) hr4 = get_highest(range4, high) hr5 = get_highest(range5, high) hr6 = get_highest(range6, high) hr7 = get_highest(range7, high) hr8 = get_highest(range8, high) hr9 = get_highest(range9, high) hr10 = get_highest(range10, high) lr1 = get_lowest(range1, low) lr2 = get_lowest(range2, low) lr3 = get_lowest(range3, low) lr4 = get_lowest(range4, low) lr5 = get_lowest(range5, low) lr6 = get_lowest(range6, low) lr7 = get_lowest(range7, low) lr8 = get_lowest(range8, low) lr9 = get_lowest(range9, low) lr10 = get_lowest(range10, low) get_crosses (emaA, emaB) => cOver = ta.crossover(emaA, emaB) cUnder = ta.crossover(emaB, emaA) returnVal = 0 if cOver returnVal += 1 else if cUnder returnVal -= 1 returnVal count_crosses(Hsource, Lsource) => Hcount = 0 Lcount = 0 if Hsource > hr1 Hcount += 1 if Hsource > hr2 Hcount += 1 if Hsource > hr3 Hcount += 1 if Hsource > hr4 Hcount += 1 if Hsource > hr5 Hcount += 1 if Hsource > hr6 Hcount += 1 if Hsource > hr7 Hcount += 1 if Hsource > hr8 Hcount += 1 if Hsource > hr9 Hcount += 1 if Hsource > hr10 Hcount += 1 if Lsource < lr1 Lcount += 1 if Lsource < lr2 Lcount += 1 if Lsource < lr3 Lcount += 1 if Lsource < lr4 Lcount += 1 if Lsource < lr5 Lcount += 1 if Lsource < lr6 Lcount += 1 if Lsource < lr7 Lcount += 1 if Lsource < lr8 Lcount += 1 if Lsource < lr9 Lcount += 1 if Lsource < lr10 Lcount += 1 plotval = Hcount - Lcount ema1 = ta.ema(plotval, range2) ema2 = ta.ema(plotval, range4) ema3 = ta.ema(plotval, range6) ema4 = ta.ema(plotval, range8) ema5 = ta.ema(plotval, range10) if maType == "SMA" ema1 := ta.sma(plotval, range2) ema2 := ta.sma(plotval, range4) ema3 := ta.sma(plotval, range6) ema4 := ta.sma(plotval, range8) ema5 := ta.sma(plotval, range10) else if maType == "WMA" ema1 := ta.wma(plotval, range2) ema2 := ta.wma(plotval, range4) ema3 := ta.wma(plotval, range6) ema4 := ta.wma(plotval, range8) ema5 := ta.wma(plotval, range10) crossCount = 0 crossCount += get_crosses(ema1, ema2) crossCount += get_crosses(ema1, ema3) crossCount += get_crosses(ema1, ema4) crossCount += get_crosses(ema1, ema5) crossCount += get_crosses(ema2, ema3) crossCount += get_crosses(ema2, ema4) crossCount += get_crosses(ema2, ema5) crossCount += get_crosses(ema3, ema4) crossCount += get_crosses(ema3, ema5) crossCount += get_crosses(ema4, ema5) plotDirection = 0 if ema1 > ema2 and ema2 > ema3 and ema3 > ema4 and ema4 > ema5 plotDirection += 1 if ema1 < ema2 and ema2 < ema3 and ema3 < ema4 and ema4 < ema5 plotDirection -= 1 [crossCount, plotDirection] [crossCount, direction] = count_crosses(close, close) crossColor = color(na) strongUpColor = color.new(color.blue, 67) strongDownColor = color.new(color.orange, 67) sBackUpColor = color.new(color.green, 67) sBackDownColor = color.new(color.red, 67) if crossCount > 0 crossColor := strongUpColor else crossColor := strongDownColor pH = plot(ta.sma(high, 5), color=na) pL = plot(ta.sma(low, 5), color=na) plotHighest = (crossCount[1] == 5 or crossCount[1] == -5) and upCandle plotshape(doSymbols and plotHighest, style = shape.labelup, location=location.abovebar, color=crossColor) plotshape(doSymbols and (((crossCount[1] == 3 or crossCount[1] == -3) and upCandle) or ((crossCount[1] == 4 or crossCount[1] == -4) and upCandle)), style = shape.triangleup, location=location.abovebar, color=crossColor) plotshape(doSymbols and ((crossCount[1] == 2 or crossCount[1] == -2) and upCandle), style = shape.arrowup, location=location.abovebar, color=crossColor) plotshape(doSymbols and (((crossCount[1] == 5 or crossCount[1] == -5) and not upCandle)), style = shape.labeldown, location=location.belowbar, color=crossColor) plotshape(doSymbols and (((crossCount[1] == 3 or crossCount[1] == -3) and not upCandle) or ((crossCount[1] == 4 or crossCount[1] == -4)) and not upCandle), style = shape.triangledown, location=location.belowbar, color=crossColor) plotshape(doSymbols and (((crossCount[1] == 2 or crossCount[1] == -2) and not upCandle)), style = shape.arrowdown, location=location.belowbar, color=crossColor) backColor = if(true) switch direction > 0 => sBackUpColor direction < 0 => sBackDownColor => color(na) fill(pH, pL, backColor) paleUpColor = color.new(color.blue, 33) paleDownColor = color.new(color.orange, 33) pBackUpColor = color.new(color.green, 33) pBackDownColor = color.new(color.red, 33) [crossCount2, direction2] = count_crosses(high, low) crossColor := color(color.new(color.gray, 50)) if crossCount2 > 0 crossColor := paleUpColor else crossColor := paleDownColor plotshape(doSymbols and ((crossCount2[1] == 5 or crossCount2[1] == -5) and upCandle), style = shape.labelup, location=location.abovebar, color=crossColor) plotshape(doSymbols and (((crossCount2[1] == 3 or crossCount2[1] == -3) and upCandle) or ((crossCount2[1] == 4 or crossCount2[1] == -4) and upCandle)), style = shape.triangleup, location=location.abovebar, color=crossColor) plotshape(doSymbols and ((crossCount2[1] == 2 or crossCount2[1] == -2) and upCandle), style = shape.arrowup, location=location.abovebar, color=crossColor) plotshape(doSymbols and (((crossCount2[1] == 5 or crossCount2[1] == -5) and not upCandle)), style = shape.labeldown, location=location.belowbar, color=crossColor) plotshape(doSymbols and (((crossCount2[1] == 3 or crossCount2[1] == -3) and not upCandle) or ((crossCount2[1] == 4 or crossCount2[1] == -4) and not upCandle)), style = shape.triangledown, location=location.belowbar, color=crossColor) plotshape(doSymbols and (((crossCount2[1] == 2 or crossCount2[1] == -2) and not upCandle)), style = shape.arrowdown, location=location.belowbar, color=crossColor) backColor2 = if(true) switch direction2 > 0 => pBackUpColor direction2 < 0 => pBackDownColor => color(color.new(color.gray, 75)) fill(pL, pH, backColor2) //Optional rsi strength candles trsi = ta.rsi(close, 14) rsiMA = ta.sma(trsi, 14) hitrsi = false if trsi >= rsiMA hitrsi := true newHi = false newLo = false hRsi = get_highest(14, trsi) if trsi > hRsi newHi := true lRsi = get_lowest(14, trsi) if trsi < lRsi newLo := true spikeHi = (get_highest(5, trsi) < trsi) and not newHi spikeLo = (get_lowest(5, trsi) > trsi) and not newLo plotchar(spikeHi and doRsiDev, char="+", location=location.belowbar, color=color.green) plotchar(spikeLo and doRsiDev, char="x", location=location.abovebar, color=color.red) barColor = color.new(color.white, 100) if hitrsi if newHi barColor := color.new(color.green, 0) else barColor := color.new(color.green, 50) else if newLo barColor := color.new(color.red, 0) else barColor := color.new(color.red, 50) barcolor(doRsiCandles ? barColor : na) test_peak (source, isHi) => isPeak = false if isHi if (source[0] < source[2]) and (source[1] < source[2]) and (source[2] > source[3]) and (source[2] > source[4]) isPeak := true else if (source[0] > source[2]) and (source[1] > source[2]) and (source[2] < source[3]) and (source[2] < source[4]) isPeak := true isPeak hiDev = test_peak(high, true) hiRDev = false rhiRDev = false rhiRDev := test_peak(trsi, true) if (rhiRDev or rhiRDev[1] or rhiRDev[2] or rhiRDev[3] or trsi < trsi[2]) and trsi[2] > 50 and hitrsi hiRDev := true if hiDev and hiRDev hiDev := true else hiDev := false loDev = test_peak(low, false) loRDev = false rloRDev = false rloRDev := test_peak(trsi, false) if (rloRDev or rloRDev[1] or rloRDev[2] or rloRDev[3] or trsi > trsi[2]) and trsi[2] < 50 and not hitrsi loRDev := true if loDev and loRDev loDev := true else loDev := false hiColor = color.new(color.red, 50) loColor = color.new(color.green, 50) if (trsi[4] > 70 or trsi[4] < 30) or (trsi[3] > 70 or trsi[3] < 30) or (trsi[2] > 70 or trsi[2] < 30) or (trsi[1] > 70 or trsi[1] < 30) or (trsi > 70 or trsi < 30) hiColor := color.red loColor := color.green plotchar(hiDev and doRsiDev, "H", color=hiColor, location=location.abovebar, offset = -2) plotchar(loDev and doRsiDev, "L", color=loColor, location=location.belowbar, offset = -2) isPivotHigh = ta.pivothigh(high, 5, 5) isPivotLow = ta.pivotlow(low, 5, 5) isPivot = isPivotHigh or isPivotLow plotThisHigh = isPivotHigh > 0 sameDirection = ta.valuewhen(isPivot, isPivotHigh, 0) // check if the previous pivot was also a high if isPivotHigh plotThisHigh := not sameDirection // reassign our plotting var if its not the same direction plotThisLow = isPivotLow > 0 sameDirection := ta.valuewhen(isPivot, isPivotLow, 0) // check if the previous pivot was also a high if isPivotLow plotThisLow := not sameDirection // reassign our plotting var if its not the same direction plotshape(doSymbols and plotThisHigh, style=shape.cross, color = color.green, location=location.abovebar) plotshape(doSymbols and plotThisLow, style=shape.xcross, color = color.red, location=location.belowbar)
RSI true swings
https://www.tradingview.com/script/K6YXCogW-RSI-true-swings/
iitiantradingsage
https://www.tradingview.com/u/iitiantradingsage/
1,014
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © tradeswithashish //@version=5 indicator(title="RSI true swings indicator", shorttitle="RSI True swings", overlay=true) upthresh=input.int(title="RSI Upper threshhold", defval=60, minval=50, step=5, maxval=90) lwthresh=input.int(title="RSI Lower threshhold", defval=40, minval=10, step=5, maxval=50) //volume criteria checkup volcheck=volume>ta.sma(volume, 20) my_rsi=ta.rsi(close, 14) //Candle size must be above average bullbar_check= close>high[1] and (high-low)>ta.sma(high-low, 20) and (close-low)>(high-close) and low<=high[1] bearbar_check= close<low[1] and (high-low)>ta.sma(high-low, 20) and (high-close)>(close-low) and high>=low[1] //RSI crossover/crossunder must fulfilling following criteria rsicrossover=ta.crossover(my_rsi, lwthresh) and volcheck and bullbar_check and volume>volume[1] and close>high[1] and open<close and close>high[2] and my_rsi[1]>lwthresh-10 rsicrossunder=ta.crossunder(my_rsi, upthresh) and volcheck and close<low[1] and bearbar_check and volume>volume[1] and open>close and close<low[2] and my_rsi[1]<upthresh+10 //Plotting the signal confirming plotshape(rsicrossover, title="Short exit or Buy Entry", style= shape.labelup, location=location.belowbar, color=color.green, size=size.tiny, text="BUY", textcolor=color.white) plotshape(rsicrossunder, title="Bull exit or Short entry", style= shape.labeldown, location=location.abovebar, color=color.red, size=size.tiny, text="SELL", textcolor=color.white) rec_high=ta.highest(high,5) rec_low=ta.lowest(low, 5) if rsicrossover alert(str.tostring(syminfo.ticker)+": Exit SELL or BUY now"+"\n Stoploss below " + str.tostring(rec_low) + "\n CMP "+ str.tostring(close), alert.freq_once_per_bar_close) if rsicrossunder alert(str.tostring(syminfo.ticker)+": Exit BUY or SELL now \n Stoploss above"+ str.tostring(rec_high) + "\n CMP "+ str.tostring(close), alert.freq_once_per_bar_close)
test - wave collapse
https://www.tradingview.com/script/Y7AUkZIf-test-wave-collapse/
RicardoSantos
https://www.tradingview.com/u/RicardoSantos/
119
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © RicardoSantos //@version=5 indicator(title='test - wave collapse') // gaussian peak at (lx, ly)/2 g (x, y, lx, ly, z)=> math.exp(-0.5 * math.pow(x-lx/2.0, 2.0) - 0.5 * math.pow(y-ly/2.0, 2.0)) * (1.0/z) length = input(100) hb = math.abs(ta.highestbars(length)*0.1) mhb = ta.cum(hb) / (bar_index + 1) lb = math.abs(ta.lowestbars(length)*0.1) mlb = ta.cum(lb) / (bar_index + 1) plot(nz(-g(hb, hb, mhb, mhb, hb), 0.0)) plot(nz(g(lb, lb, mlb, mlb, lb), 0.0)) plot(nz(g(hb, lb, mhb, mlb, hb-lb), 0.0), '', color.yellow)
Auto VPT
https://www.tradingview.com/script/xvdUjAtk/
GioLucaas
https://www.tradingview.com/u/GioLucaas/
102
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © GioLucaas //@version=5 indicator("auto VPT", overlay=true) var p1 = 0.0 var p2 = 0.0 if volume >= (1.5 * volume[1]) if close >= open p1 := (close + (high-low)) else p2 := (close - (high-low)) plot(p1, color=color.green, style=plot.style_cross, linewidth=3) p1 := na plot(p2, color=color.red, style=plot.style_cross, linewidth=3) p2 := na
Range Volume Change
https://www.tradingview.com/script/lwOxh0Vh-Range-Volume-Change/
dman103
https://www.tradingview.com/u/dman103/
1,871
study
5
CC-BY-SA-4.0
// This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License https://creativecommons.org/licenses/by-sa/4.0/ // © dman103 //@version=5 // I was looking for a way to see if today's premarket volume is higher or lower than the previous day's premarket, did not find any, hence, I made my own in which I share with you now. // I call it 'Range Volume Change' or just RVC. // RVC will show the percentage of change between the selected time range and the previous day for the same time range. As an extra feature, it will also show the volume percentage of change outside the time range (can be disabled from settings). // This will allow us to see if the volume is increasing or decreasing today compare to the previous day in this specific time range. // Can be used for various things, like checking premarket volume compare to the previous day or checking specific time range of your interest to see if volume is increasing or decreasing compare to the previous day. // Also, RVC visualizes the incremental of the volume using increasing size columns giving you a better view of how the volume changes compared to the past. // in addition, RVC is also designed to work on real-time data. // Follow for more top indicators/strategies: https://www.tradingview.com/u/dman103/#published-scripts indicator('Range Volume Change', 'RVC', overlay=false) time_range_input = input.session('0400-0930', 'Time Range',tooltip="The time range to show the volume percentage of change between current day time range and previous day for the same time range.") show_volume_range_between_time_range= input.bool(false,'Show volume change between time range',tooltip="In addtion to the volume on the time range, it will also display volume percetnage of change OUTSIDE the time range.") val_sun = input(true, title="Sunday",group="Days of week") val_mon = input(true, title="Monday",group="Days of week") val_tue = input(true, title="Tuesday",group="Days of week") val_wed = input(true, title="Wednesday",group="Days of week") val_thu = input(true, title="Thursday",group="Days of week") val_fri = input(true, title="Friday",group="Days of week") val_sat = input(true, title="Saturday",group="Days of week") var string val_num_sun = val_sun ? '1' : na var string val_num_mon = val_mon ? '2' : na var string val_num_tue = val_tue ? '3' : na var string val_num_wed = val_wed ? '4' : na var string val_num_thu = val_thu ? '5' : na var string val_num_fri = val_fri ? '6' : na var string val_num_sat = val_sat ? '7' : na time_days = val_num_sun+val_num_mon+val_num_tue+val_num_wed+val_num_thu+val_num_fri+val_num_sat is_week_day = dayofweek == dayofweek.sunday and val_sun ? true : dayofweek == dayofweek.monday and val_mon ? true : dayofweek == dayofweek.tuesday and val_tue ? true : dayofweek == dayofweek.wednesday and val_wed ? true : dayofweek == dayofweek.wednesday and val_wed ? true : dayofweek == dayofweek.thursday and val_thu ? true : dayofweek == dayofweek.friday and val_fri ? true : dayofweek == dayofweek.saturday and val_sat ? true : false is_last_bar_of_day = is_week_day[1] and is_week_day==false is_time_range = time(timeframe.period, time_range_input + ':'+time_days)//,timzone_offset) tf = is_time_range ? 1 : 0 //1 in time range varip pre_volume = volume varip pre_v2 = volume varip pre_v3 = volume varip session_volume = 0. varip session_v2 = volume varip session_v3 = volume varip ses_vol = volume varip last_vol = 0. if barstate.isnew and barstate.isrealtime last_vol := volume else //////Calculations//////// //Sumup volume in time range pre_volume := tf > tf[1] or is_last_bar_of_day ? volume : tf == 1 and barstate.isrealtime ? pre_volume + volume - last_vol : barstate.ishistory and tf == 1 ? pre_volume + volume : pre_volume //sumup volume not in time range session_volume := tf < tf[1] or is_last_bar_of_day ? volume : tf == 0 and barstate.isrealtime ? session_volume + volume - last_vol : barstate.ishistory and tf == 0 ? session_volume + volume : session_volume session_v2 := (tf > tf[1] or is_last_bar_of_day) or (barstate.islast and barstate.isrealtime == false) ? session_volume[1] : session_v2 session_v3 := tf > tf[1] or is_last_bar_of_day? session_v2[1] : session_v3 //Time range ends, happens only once per day. pre_v2 := (tf < tf[1] or is_last_bar_of_day) or (barstate.islast and barstate.isrealtime == false) ? pre_volume[1] : pre_v2 //Time range ends, Takes the previous time range volume to calculate later the percentage, happens only once per day. pre_v3 := tf < tf[1] or is_last_bar_of_day ? pre_v2[1] : pre_v3 last_vol := volume plot(is_week_day ? pre_volume : na, style=plot.style_columns, color=tf == 1 ? color.new(color.blue, 25) : na) plot(show_volume_range_between_time_range and is_week_day ? session_volume : na , style=plot.style_columns, color=tf == 0 ? color.new(color.purple, 25) : na) //Time range chg1 = (pre_v2 / pre_v3 - 1) * 100 chg_premarket = (pre_volume / pre_v2[1] - 1) * 100 //Outside time range chg2 = (session_v2 / session_v3 - 1) * 100 chg_session = (session_volume / session_v2[1] - 1) * 100 var label lbl1 = na var label lbl2 = na //History Label if ((tf < tf[1] ) or (barstate.islast and barstate.isrealtime == false and (tf == 1)) and (is_week_day or is_last_bar_of_day)) lbl1 := label.new(bar_index, pre_volume[is_last_bar_of_day ? 1 : 0], size=size.normal, style=label.style_none, text=str.tostring(chg1, format.mintick) + ' %', textcolor=color.blue) //Real time label if barstate.isrealtime and (tf == 1) and (is_week_day or is_last_bar_of_day) lbl2 := label.new(bar_index, pre_volume[is_last_bar_of_day ? 1 : 0], size=size.normal, style=label.style_none, text=str.tostring(chg_premarket, format.mintick) + ' %', textcolor=color.blue) label.delete(lbl2[1]) //History Label if ((tf > tf[1] or is_last_bar_of_day) or (barstate.islast and barstate.isrealtime == false and tf == 0 )) and show_volume_range_between_time_range and (is_week_day or is_last_bar_of_day) and chg2!=0 lbl1 := label.new(bar_index, session_volume[is_last_bar_of_day ? 1 : 0], size=size.normal, style=label.style_none, text=str.tostring(chg2, format.mintick) + ' %', textcolor=color.purple) //Real time label if barstate.isrealtime and (tf == 0 ) and show_volume_range_between_time_range and (is_week_day or is_last_bar_of_day) //premarket time lbl2 := label.new(bar_index, session_volume[is_last_bar_of_day ? 1 : 0], size=size.normal, style=label.style_none, text=str.tostring(chg_session, format.mintick) + ' %', textcolor=color.purple) label.delete(lbl2[1])
RedK Ribbon v2 Extended by Loxxxa
https://www.tradingview.com/script/9k4rfZL1-RedK-Ribbon-v2-Extended-by-Loxxxa/
loxxxa
https://www.tradingview.com/u/loxxxa/
22
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © RedKTrader original script // Adapted and extended by Loxxxa //@version=4 study("RedK Ribbon Extended by Loxxxa", shorttitle = "RedKRibbon Loxxxa", precision=2, overlay=true) length = input(title="Length", type=input.integer, defval=7, minval=1, step=1) ribf = input(title="Ribbon Size", defval=1.6, minval=1, step=0.2) smooth = input(title="Smoothing", type=input.integer, defval=3, minval=1, step=1) // Optional plots - will be hidden by default Short_EMA = input(title="Short EMA", defval=30, minval=1, step=1) Long_EMA = input(title="Long EMA", defval = 50, minval=1, step=1) // Calculations SEMA = ema(close, Short_EMA) LEMA = ema(close, Long_EMA) CloseMA = wma(wma(close, length),smooth) ZLMA = (2 * CloseMA) - wma(CloseMA, length) length2 = int(length*ribf) //have to make length2 an integer or the wma call fails AvgMA = wma(wma(hl2,length2),smooth) // some other variables myred = #ff0000, mygreen = #00ff00 up = change(ZLMA) > 0 , dn = change(ZLMA) < 0 zup = #2196f3, zdown = #f57f17 // Optional Plots plot(SEMA, title="Short EMA", color = color.yellow) plot(LEMA, title="Long EMA", color = color.fuchsia) // Main Plot p1=plot(CloseMA, title="Bulls", color = color.green, linewidth=2, transp=50) p2=plot(AvgMA, title="Bears", color=color.red, linewidth=2, transp=50) fill(p1,p2,color = CloseMA > AvgMA ? mygreen : myred, transp=70) p3=plot(ZLMA, title="Zero Lag MA", color=up ? zup : zdown, linewidth=4) // Multiple EMAs //shortest = ema(close, 15) //short = ema(close, 30) longer = ema(close, 90) longest = wma(close, 140) //plot(shortest, color = color.red) //plot(short, color = color.orange) plot(longer, title="xLong EMA (90)", color = color.white) plot(longest, title="xLong WMA (120)", color = color.blue) // BB bblength = input(20, minval=1) src = input(close, title="Source") mult = input(2.0, minval=0.001, maxval=50, title="StdDev") basis = sma(src, bblength) dev = mult * stdev(src, bblength) upper = basis + dev lower = basis - dev offset = input(0, "BB Offset", type = input.integer, minval = -500, maxval = 500) plot(basis, "BB Basis", color=color.yellow, style = plot.style_circles, offset = offset) bbp1 = plot(upper, "BB Upper", color=color.teal, offset = offset) bbp2 = plot(lower, "BB Lower", color=color.fuchsia, offset = offset) fill(bbp1, bbp2, title = "BB Background", color=color.rgb(33, 150, 243, 95)) // Alerts on ZLMA changing direction up or down // TurnUp = up and dn[1], TurnDn = dn and up[1] // alertcondition(TurnUp, title="ZLMA Up!", message="Ribbon | Price Turning up! - {{exchange}}:{{ticker}} at {{close}}") // alertcondition(TurnDn, title="ZLMA Down!", message="Ribbon | Price Turning Down! - {{exchange}}:{{ticker}} at {{close}}")
The Witcher [30MIN] - Alerts
https://www.tradingview.com/script/8bL4XKnY-The-Witcher-30MIN-Alerts/
wielkieef
https://www.tradingview.com/u/wielkieef/
505
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © wielkieef //@version=4 //study("The Witcher [30MIN]", overlay=true) study("The Witcher [30MIN]", overlay=true) //SOURCE ============================================================================================================================================================================================================================================================================================================= src = input(hl2) // POSITION ========================================================================================================================================================================================================================================================================================================== Position = input("Both", title= "Longs / Shorts", options = ["Both","Longs","Shorts"]) is_Long = Position == "SHORT" ? na : true is_Short = Position == "LONG" ? na : true // INPUTS ============================================================================================================================================================================================================================================================================================================ //ADX -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ADX_options = input("CLASSIC", title= "Adx Type", options = ["CLASSIC", "MASANAKAMURA"], group = "ADX") ADX_len = input(18, title= "Adx lenght", type = input.integer, minval = 1, group = "ADX") th = input(17, title= "Adx Treshold", type = input.float, minval = 0, step = 0.5, group = "ADX") //RSI---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- len_3 = input(35, title="RSI lenght", group = "Relative Strenght Indeks") src_3 = input(low, title="RSI Source", group = "Relative Strenght Indeks") //TREND STRENGHT-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- n1 = input(10, title="Channel Length", group="Trend Strenght") n2 = input(21, title="Average Length", group="Trend Strenght") //JMA-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- inp = input(defval=hlc3, title="JMA Source", type=input.source, group = "Jurik Moving Average") reso = input("", title="JMA Resolution", type=input.resolution, group = "Jurik Moving Average") rep = input(false, title="JMA Allow Repainting?", type=input.bool, group = "Jurik Moving Average") src0 = security(syminfo.tickerid, reso, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1] lengths = input(22, title="JMA Length", type=input.integer, group = "Jurik Moving Average") //SAR------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- start = input(0.007, title="SAR Start", type=input.float, step=0.001 , group="SAR") increment = input(0.018, title="SAR Increment", type=input.float, step=0.001 , group="SAR") maximum = input(0.05, title="SAR Maximum", type=input.float, step=0.01 , group="SAR") width = input(1, title="SAR Point Width", type=input.integer, minval=1, group="SAR") //Trend Indicator----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- timeframe = input(13, title="Trend Timeframe", minval=3, group = "Trend Indicator") //Momentum------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ srcType = input("Price", title="Source Type", options=["Price", "VWAP"], group = "MOMENTUM") srcPrice = input(close, title="Momentum Source", group = "MOMENTUM") rsiLen = input(56, title="Rsi Lenght", minval=1, group = "MOMENTUM") sLen = input(40, title="Smooth Length", group = "MOMENTUM") //OBV------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ e1 = ema(obv, input(30, title="OBV line 1", group = "OBV")) e2 = ema(obv, input(12, title="OBV line 2", group = "OBV")) //MA---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- length = input(72, title="MA Length", minval=1, group="Fast MA" ) matype = input(5, title="AvgType", minval=1, maxval=5, group="Fast MA") //Range Filter-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- length0 = input(22, title="Range Filter lenght", group = "Range Filter") mult = input(3, title="Range Filter mult" , group = "Range Filter") //TP PLOTS----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- tp_long0 = input(1.1, title="TP Long", type = input.float, minval = 0, step = 0.1, group="TP") tp_short0 = input(1.1, title="TP Short", type = input.float, minval = 0, step = 0.1, group="TP") //Inputs---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ACT_SCLP = input(true, title="SCALPING", type = input.bool, group="Scalping") HiLoLen = input(6, title="Scalping Lenght", minval=2, group="Scalping") fastEMAlength = input(10, title="Fast EMA lenght", minval=2, group="Scalping") mediumEMAlength = input(120, title="Medium EMA lenght", minval=2, group="Scalping") slowEMAlength = input(500, title="Slow EMA lenght", minval=2, group="Scalping") filterBW = input(false, title="Filter") Lookback = input(5, title="Pullback Lookback") UseHAcandles = input(true, title="Use H.A Calculations") // Scalping Indicator ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- haClose = UseHAcandles ? security(heikinashi(syminfo.tickerid), timeframe.period, close) : close haOpen = UseHAcandles ? security(heikinashi(syminfo.tickerid), timeframe.period, open) : open haHigh = UseHAcandles ? security(heikinashi(syminfo.tickerid), timeframe.period, high) : high haLow = UseHAcandles ? security(heikinashi(syminfo.tickerid), timeframe.period, low) : low isRegularFractal(mode) => ret = mode == 1 ? high[4] < high[3] and high[3] < high[2] and high[2] > high[1] and high[1] > high[0] : mode == -1 ? low[4] > low[3] and low[3] > low[2] and low[2] < low[1] and low[1] < low[0] : false ret isBWFractal(mode) => ret = mode == 1 ? high[4] < high[2] and high[3] <= high[2] and high[2] >= high[1] and high[2] > high[0] : mode == -1 ? low[4] > low[2] and low[3] >= low[2] and low[2] <= low[1] and low[2] < low[0] : false ret fastEMA = ema(haClose, fastEMAlength) mediumEMA = ema(haClose, mediumEMAlength) slowEMA = ema(haClose, slowEMAlength) pacC = ema(haClose, HiLoLen) pacL = ema(haLow, HiLoLen) pacU = ema(haHigh, HiLoLen) TrendDirection = fastEMA > mediumEMA and pacL > mediumEMA ? 1 : fastEMA < mediumEMA and pacU < mediumEMA ? -1 : 0 filteredtopf = filterBW ? isRegularFractal(1) : isBWFractal(1) filteredbotf = filterBW ? isRegularFractal(-1) : isBWFractal(-1) valuewhen_H0 = valuewhen(filteredtopf == true, high[2], 0) valuewhen_H1 = valuewhen(filteredtopf == true, high[2], 1) valuewhen_H2 = valuewhen(filteredtopf == true, high[2], 2) higherhigh = filteredtopf == false ? false : valuewhen_H1 < valuewhen_H0 and valuewhen_H2 < valuewhen_H0 lowerhigh = filteredtopf == false ? false : valuewhen_H1 > valuewhen_H0 and valuewhen_H2 > valuewhen_H0 valuewhen_L0 = valuewhen(filteredbotf == true, low[2], 0) valuewhen_L1 = valuewhen(filteredbotf == true, low[2], 1) valuewhen_L2 = valuewhen(filteredbotf == true, low[2], 2) higherlow = filteredbotf == false ? false : valuewhen_L1 < valuewhen_L0 and valuewhen_L2 < valuewhen_L0 lowerlow = filteredbotf == false ? false : valuewhen_L1 > valuewhen_L0 and valuewhen_L2 > valuewhen_L0 TradeDirection = 0 TradeDirection := nz(TradeDirection[1]) pacExitU = haOpen < pacU and haClose > pacU and barssince(haClose<pacC)<=Lookback pacExitL = haOpen > pacL and haClose < pacL and barssince(haClose>pacC)<=Lookback Buy = TrendDirection == 1 and pacExitU Sell = TrendDirection == -1 and pacExitL TradeDirection := TradeDirection == 1 and haClose<pacC ? 0 : TradeDirection == -1 and haClose>pacC ? 0 : TradeDirection == 0 and Buy ? 1 : TradeDirection == 0 and Sell ? -1 : TradeDirection L_scalp = nz(TradeDirection[1]) == 0 and TradeDirection == 1 S_scalp = nz(TradeDirection[1]) == 0 and TradeDirection == -1 //INDICATORS ============================================================================================================================================================================================================================================================================================================= //ADX------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- calcADX(_len) => up = change(high) down = -change(low) plusDM = na(up) ? na : (up > down and up > 0 ? up : 0) minusDM = na(down) ? na : (down > up and down > 0 ? down : 0) truerange = rma(tr, _len) _plus = fixnan(100 * rma(plusDM, _len) / truerange) _minus = fixnan(100 * rma(minusDM, _len) / truerange) sum = _plus + _minus _adx = 100 * rma(abs(_plus - _minus) / (sum == 0 ? 1 : sum), _len) [_plus,_minus,_adx] calcADX_Masanakamura(_len) => SmoothedTrueRange = 0.0 SmoothedDirectionalMovementPlus = 0.0 SmoothedDirectionalMovementMinus = 0.0 TrueRange = max(max(high - low, abs(high - nz(close[1]))), abs(low - nz(close[1]))) DirectionalMovementPlus = high - nz(high[1]) > nz(low[1]) - low ? max(high - nz(high[1]), 0) : 0 DirectionalMovementMinus = nz(low[1]) - low > high - nz(high[1]) ? max(nz(low[1]) - low, 0) : 0 SmoothedTrueRange := nz(SmoothedTrueRange[1]) - (nz(SmoothedTrueRange[1]) /_len) + TrueRange SmoothedDirectionalMovementPlus := nz(SmoothedDirectionalMovementPlus[1]) - (nz(SmoothedDirectionalMovementPlus[1]) / _len) + DirectionalMovementPlus SmoothedDirectionalMovementMinus := nz(SmoothedDirectionalMovementMinus[1]) - (nz(SmoothedDirectionalMovementMinus[1]) / _len) + DirectionalMovementMinus DIP = SmoothedDirectionalMovementPlus / SmoothedTrueRange * 100 DIM = SmoothedDirectionalMovementMinus / SmoothedTrueRange * 100 DX = abs(DIP-DIM) / (DIP+DIM)*100 adx = sma(DX, _len) [DIP,DIM,adx] [DIPlusC,DIMinusC,ADXC] = calcADX(ADX_len) [DIPlusM,DIMinusM,ADXM] = calcADX_Masanakamura(ADX_len) DIPlus = ADX_options == "CLASSIC" ? DIPlusC : DIPlusM DIMinus = ADX_options == "CLASSIC" ? DIMinusC : DIMinusM ADX = ADX_options == "CLASSIC" ? ADXC : ADXM L_adx = DIPlus > DIMinus and ADX > th S_adx = DIPlus < DIMinus and ADX > th macol = L_adx ? color.lime : S_adx ? color.red : color.orange barcolor(color = macol) //RSI------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ up_3 = rma(max(change(src_3), 0), len_3) down_3 = rma(-min(change(src_3), 0), len_3) rsi_3 = down_3 == 0 ? 100 : up_3 == 0 ? 0 : 100 - (100 / (1 + up_3 / down_3)) L_rsi = (rsi_3 < 70) S_rsi = (rsi_3 > 30) //TREND STRENGHT--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ap = hlc3 esa = ema(ap, n1) d = ema(abs(ap - esa), n1) ci = (ap - esa) / (0.015 * d) tci = ema(ci, n2) wt1 = tci wt2 = sma(wt1,4) mfi_upper = sum(volume * (change(hlc3) <= 0 ? 0 : hlc3), 58) mfi_lower = sum(volume * (change(hlc3) >= 0 ? 0 : hlc3), 58) _mfi_rsi(mfi_upper, mfi_lower) => if mfi_lower == 0 100 if mfi_upper == 0 0 100.0 - (100.0 / (1.0 + mfi_upper / mfi_lower)) mf = _mfi_rsi(mfi_upper, mfi_lower) mfi = (mf - 50) * 3 L_mfi = mfi > 10 S_mfi = mfi < -10 //JMA------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ jsa = (src0 + src0[lengths]) / 2 sig = src0 > jsa ? 1 : src0 < jsa ? -1 : 0 L_jma = sig > 0 S_jma = sig < 0 //SAR------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ psar = sar(start, increment, maximum) dir = psar < close ? 1 : -1 psarColor = dir == 1 ? color.green : color.red psarPlot = plot(psar, title="PSAR", style=plot.style_circles, linewidth=width, color=macol, transp=0) var color longColor = color.green var color shortColor = color.red L_sar = dir ==1 S_sar = dir ==-1 //Trend Indicator------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ lower = lowest(timeframe) upper = highest(timeframe) basis = avg(upper, lower) orange_data = offset(basis, (timeframe -1)) purple_data = offset(basis, 1) purple = plot(basis, offset = 1, title = "Current", color = color.black) orange = plot(basis, offset = (timeframe -1), title = "Prev", color= color.black) fill(purple, orange, color=macol, title="Trend Indicator RED/Green") L_indicator = purple_data > orange_data S_indicator = purple_data < orange_data //Momentum--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- src_m = srcType=="Price"?srcPrice:security(syminfo.tickerid, timeframe.period, vwap[barstate.isrealtime ? 1 : 0])[barstate.isrealtime ? 0 : 1] f_dema(_src, _length) => _ema0 = ema( _src, _length) _ema1 = ema(_ema0, _length) _dema = 2 * _ema0 - _ema1 rsi1 = hma(rsi(src_m, rsiLen), sLen) rsi2 = rsi1-50 dema1 = f_dema(rsi2, 9) dema2 = f_dema(rsi2, 21) M_l1_cond = e1 > e1[1] or e2 > e2[1] M_s1_cond = e1 < e1[1] or e2 < e2[1] M_l2_cond = dema1>0 M_s2_cond = dema1<0 L_momentum = M_l1_cond and M_l2_cond S_momentum = M_s1_cond and M_s2_cond //MA------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ simplema = sma(src,length) exponentialma = ema(src,length) hullma = wma(2*wma(src, length/2)-wma(src, length), round(sqrt(length))) weightedma = wma(src, length) volweightedma = vwma(src, length) avgval = matype==1 ? simplema : matype==2 ? exponentialma : matype==3 ? hullma : matype==4 ? weightedma : matype==5 ? volweightedma : na MA_speed = (avgval / avgval[1] -1 ) *100 L_s_ma = MA_speed > 0 S_s_ma = MA_speed < 0 //Range Filter--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- out = 0., cma = 0., cts = 0. Var = variance(src,length0)*mult sma = sma(src,length0) secma = pow(nz(sma - cma[1]),2) sects = pow(nz(src - cts[1]),2) ka = Var < secma ? 1 - Var/secma : 0 kb = Var < sects ? 1 - Var/sects : 0 cma := ka*sma+(1-ka)*nz(cma[1],src) cts := kb*src+(1-kb)*nz(cts[1],src) css = cts > cma ? color.green : color.red a = plot(cts,"CTS",color=macol,linewidth=1,transp=0) b = plot(cma,"CMA",color=macol,linewidth=1,transp=0) fill(a,b,color=macol,transp=80) L_range = cts > cma S_range = cts < cma //STRATEGY ========================================================================================================================================================================================================================================================================================================== var bool longCond = na, var bool shortCond = na var int CondIni_long = 0, var int CondIni_short = 0 var bool _Final_longCondition = na, var bool _Final_shortCondition = na var float last_open_longCondition = na, var float last_open_shortCondition = na var int last_longCondition = na, var int last_shortCondition = na var int last_Final_longCondition = na, var int last_Final_shortCondition = na var int nLongs = na, var int nShorts = na L_scalp_condt = L_scalp and ACT_SCLP S_scalp_condt = S_scalp and ACT_SCLP L_basic_condt = L_adx and L_rsi and L_mfi and L_jma and L_sar and L_indicator and L_momentum and L_s_ma and L_range S_basic_condt = S_adx and S_rsi and S_mfi and S_jma and S_sar and S_indicator and S_momentum and S_s_ma and S_range L_second_condt = L_basic_condt or L_scalp_condt and L_adx S_second_condt = S_basic_condt or S_scalp_condt and S_adx longCond := L_second_condt shortCond:= S_second_condt CondIni_long := longCond[1] ? 1 : shortCond[1] ? -1 : nz(CondIni_long[1]) CondIni_short := longCond[1] ? 1 : shortCond[1] ? -1 : nz(CondIni_short[1]) longCondition = (longCond[1] and nz(CondIni_long[1]) == -1) shortCondition = (shortCond[1] and nz(CondIni_short[1]) == 1) //POSITION PRICE-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- var float sum_long = 0.0, var float sum_short = 0.0 var float Position_Price = 0.0 var bool Final_long_BB = na, var bool Final_short_BB = na var int last_long_BB = na, var int last_short_BB = na last_open_longCondition := longCondition or Final_long_BB[1] ? close[1] : nz(last_open_longCondition[1]) last_open_shortCondition := shortCondition or Final_short_BB[1] ? close[1] : nz(last_open_shortCondition[1]) last_longCondition := longCondition or Final_long_BB[1] ? time : nz(last_longCondition[1]) last_shortCondition := shortCondition or Final_short_BB[1] ? time : nz(last_shortCondition[1]) in_longCondition = last_longCondition > last_shortCondition in_shortCondition = last_shortCondition > last_longCondition last_Final_longCondition := longCondition ? time : nz(last_Final_longCondition[1]) last_Final_shortCondition := shortCondition ? time : nz(last_Final_shortCondition[1]) nLongs := nz(nLongs[1]) nShorts := nz(nShorts[1]) if longCondition or Final_long_BB nLongs := nLongs + 1 nShorts := 0 sum_long := nz(last_open_longCondition) + nz(sum_long[1]) sum_short := 0.0 if shortCondition or Final_short_BB nLongs := 0 nShorts := nShorts + 1 sum_short := nz(last_open_shortCondition) + nz(sum_short[1]) sum_long := 0.0 Position_Price := nz(Position_Price[1]) Position_Price := longCondition or Final_long_BB ? sum_long/nLongs : shortCondition or Final_short_BB ? sum_short/nShorts : na //TP------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- var bool long_tp = na, var bool short_tp = na var int last_long_tp = na, var int last_short_tp = na var bool Final_Long_tp = na, var bool Final_Short_tp = na var bool Final_Long_sl0 = na, var bool Final_Short_sl0 = na var bool Final_Long_sl = na, var bool Final_Short_sl = na var int last_long_sl = na, var int last_short_sl = na tp_long = ((nLongs > 1) ? tp_long0 / nLongs : tp_long0) / 100 tp_short = ((nShorts > 1) ? tp_short0 / nShorts : tp_short0) / 100 long_tp := high > (fixnan(Position_Price) * (1 + tp_long)) and in_longCondition short_tp := low < (fixnan(Position_Price) * (1 - tp_short)) and in_shortCondition last_long_tp := long_tp ? time : nz(last_long_tp[1]) last_short_tp := short_tp ? time : nz(last_short_tp[1]) Final_Long_tp := (long_tp and last_longCondition > nz(last_long_tp[1]) and last_longCondition > nz(last_long_sl[1])) Final_Short_tp := (short_tp and last_shortCondition > nz(last_short_tp[1]) and last_shortCondition > nz(last_short_sl[1])) //TP SIGNALS-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- tplLevel = (in_longCondition and (last_longCondition > nz(last_long_tp[1])) and (last_longCondition > nz(last_long_sl[1])) and not Final_Long_sl[1]) ? (nLongs > 1) ? (fixnan(Position_Price) * (1 + tp_long)) : (last_open_longCondition * (1 + tp_long)) : na tpsLevel = (in_shortCondition and (last_shortCondition > nz(last_short_tp[1])) and (last_shortCondition > nz(last_short_sl[1])) and not Final_Short_sl[1]) ? (nShorts > 1) ? (fixnan(Position_Price) * (1 - tp_short)) : (last_open_shortCondition * (1 - tp_short)) : na //RE-ENTRY ON TP-HIT----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- if Final_Long_tp CondIni_long := -1 sum_long := 0.0 nLongs := na if Final_Short_tp CondIni_short := 1 sum_short := 0.0 nShorts := na //PLOTS------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- plot((nLongs > 1) or (nShorts > 1) ? Position_Price : na, title = "Price", color = in_longCondition ? color.aqua : color.orange, linewidth = 2, style = plot.style_cross) plot(tplLevel, title = "Long TP ", style = plot.style_cross, color = color.green, linewidth = 1) plot(tpsLevel, title = "Short TP ", style = plot.style_cross, color = color.red, linewidth = 1) //PLOTSHAPES---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- plotshape(Final_Long_tp, title = "TP Long Signal", style = shape.flag, location = location.abovebar, color = color.red, size=size.small , transp = 0) plotshape(Final_Short_tp, title = "TP Short Signal", style = shape.flag, location = location.belowbar, color = color.green, size=size.small , transp = 0) plotshape(longCondition, title = "Long x1", style=shape.triangleup, location=location.belowbar, color=color.blue, size=size.small , transp=0) plotshape(shortCondition, title = "Short x1", style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small , transp=0) //ALERTS FOR AUTOVIEW -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- //LONG alertcondition(longCondition, title="LONG", message = "L | e=BINANCEFUTURES a=* s=BTCUSDT c=order | delay=1 | e=BINANCEFUTURES a=* s=BTCUSDT c=position b=short t=market ro=1 | delay=1 | e=BINANCEFUTURES a=* s=BTCUSDT b=long q=99% t=market l=1 | delay=1 | e=BINANCEFUTURES a=* s=BTCUSDT c=position b=long sl=-8.2% p=-8.2% t=limit") //SHORT alertcondition(shortCondition, title="Short x1", message = "S | e=BINANCEFUTURES a=* s=BTCUSDT c=order | delay=1 | e=BINANCEFUTURES a=* s=BTCUSDT c=position b=long t=market ro=1 | delay=1 | e=BINANCEFUTURES a=* s=BTCUSDT b=short q=99% t=market l=1 | delay=1 | e=BINANCEFUTURES a=* s=BTCUSDT c=position b=short sl=7.8% p=7.9% t=limit") //LONG TP alertcondition(Final_Long_tp, title="Long TP", message = "LONG TP | e=BINANCEFUTURES a=* s=BTCUSDT c=position b=long q=100% t=market ro=1 | delay=1 | e=BINANCEFUTURES a=* s=BTCUSDT c=order") alertcondition(Final_Short_tp, title="Short TP", message = "SHORT TP | e=BINANCEFUTURES a=* s=BTCUSDT c=position b=short q=100% t=market ro=1 | delay=1 | e=BINANCEFUTURES a=* s=BTCUSDT c=order") // By wielkieef
XABCD Harmonic Pattern Custom Range Interactive
https://www.tradingview.com/script/0x1Dgqjw-XABCD-Harmonic-Pattern-Custom-Range-Interactive/
RozaniGhani-RG
https://www.tradingview.com/u/RozaniGhani-RG/
2,016
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © RozaniGhani-RG // Credits to Scott M Carney, author of Harmonic Trading : Volume One, Two and Three //@version=5 indicator('XABCD Harmonic Pattern Custom Range Interactive', shorttitle = 'XABCD_HP_CRI', overlay = true, precision = 3) // —— Import { import RozaniGhani-RG/PriceTimeInteractive/2 as pti import RozaniGhani-RG/DeleteArrayObject/1 as obj import RozaniGhani-RG/HarmonicDB/1 as hdb import RozaniGhani-RG/HarmonicSwitches/1 as sw import RozaniGhani-RG/HarmonicCalculation/1 as calc // } // —— Content { // 0. Input // 1. Initialization // 2. TRADE IDENTIFICATION - Harmonic Trading System Part 1 // 3. TRADE EXECUTION - Harmonic Trading System Part 2 // 4. TRADE MANAGEMENT - Harmonic Trading System Part 3 // 5. Common Drawings Custom Functions // 6. Draw XABCD Pattern (Trade Identification) // 7. Draw zones // 8. Table // 9 Plot // 10. Construct // } // —— 0. Input { // ———— 1) TRADE IDENTIFICATION - TIME POINTS { int point_X = timestamp('2022-03') int point_A = timestamp('2022-04') int point_B = timestamp('2022-05') int point_C = timestamp('2022-06') int time_X = input.time(point_X, 'Point X', group = '1) TRADE IDENTIFICATION - TIME POINTS', inline = 'X', confirm = true, tooltip = 'Point X must BEFORE Point A') int time_A = input.time(point_A, 'Point A', group = '1) TRADE IDENTIFICATION - TIME POINTS', inline = 'A', confirm = true, tooltip = 'Point A must BEFORE Point B') int time_B = input.time(point_B, 'Point B', group = '1) TRADE IDENTIFICATION - TIME POINTS', inline = 'B', confirm = true, tooltip = 'Point B must BEFORE Point C') int time_C = input.time(point_C, 'Point C', group = '1) TRADE IDENTIFICATION - TIME POINTS', inline = 'C', confirm = true, tooltip = 'Point C must AFTER Point B') // } // ———— 2) TRADE EXECUTION - BC VALIDITY { i_s_valid_BC = input.string('Text', 'Valid BC Display', group = '2) TRADE EXECUTION - BC VALIDITY', options = ['Text', 'Emoji'], tooltip = 'Display style for BC Validity') // } // ———— 2) TRADE EXECUTION - SPECIAL SITUATION (D = XA) { G2 = '2) TRADE EXECUTION - SPECIAL SITUATION (D = XA)' T2 = 'Change value D = XA\n if' i_f_gart = input.float(0.786, 'Gartley', group = G2, options =[0.786, 0.886], tooltip = T2 + 'Gartley was found.\nDefault : 0.786\nSpecial : 0.886') i_f_crab = input.float(1.618, 'Crab / Deep Crab', group = G2, options =[1.618, 1.902], tooltip = T2 + 'Crab / Deep Crab was found.\nDefault : 1.618\nSpecial : 1.902') i_f_shark = input.float(0.886, 'Shark', group = G2, options =[0.886, 1.130], tooltip = T2 + 'Shark was found.\nDefault : 0.886\nSpecial : 1.130') // } // ———— 3) TRADE MANAGEMENT (AUTO) { T3 = 'To show, go to Chart setting\nGo to Status Line, tick Indicator Titles\nGo to Scales, tick Indicator Name Label\nExtend right will hide label' T4 = 'Execution Point :\nPoint D (Default)\nPoint C (Offset Point)' T5 = 'Full : Show all labels and lines\nCompact : Show important labels and lines' T6 = 'PRZ : Potential Reversal Zone (Trade Execution)\n PL : Profit & Loss (Trade Management)' i_extend = input.string( 'None', 'Extend lines', group = '3) TRADE MANAGEMENT (AUTO)', tooltip = T3, options = ['Right', 'None']) i_execute = input.string('Price D', 'Execution Point', group = '3) TRADE MANAGEMENT (AUTO)', tooltip = T4, options = ['Price C', 'Price D']) i_display = input.string( 'Full', 'Harmonic Pattern Display', group = '3) TRADE MANAGEMENT (AUTO)', tooltip = T5, options = ['Full', 'Compact']) i_PL = input.string( 'PL', 'Show Profit & Loss (PL)', group = '3) TRADE MANAGEMENT (AUTO)', tooltip = T6, options = ['None', 'PRZ', 'PL', 'Both']) // } // ———— 3) TRADE MANAGEMENT (MANUAL) { i_b_SL = input.bool(false, 'Stop Loss   ', group = '3) TRADE MANAGEMENT (MANUAL)', inline = 'SL') i_f_SL = input.float(0, '        ', group = '3) TRADE MANAGEMENT (MANUAL)', inline = 'SL', minval = 0, tooltip = 'Tick and input value') i_b_TP1 = input.bool(false, 'Take Profit 1', group = '3) TRADE MANAGEMENT (MANUAL)', inline = 'TP1') i_f_TP1 = input.float(0, '        ', group = '3) TRADE MANAGEMENT (MANUAL)', inline = 'TP1', minval = 0, tooltip = 'Tick and input value') i_b_TP2 = input.bool(false, 'Take Profit 2', group = '3) TRADE MANAGEMENT (MANUAL)', inline = 'TP2') i_f_TP2 = input.float(0, '        ', group = '3) TRADE MANAGEMENT (MANUAL)', inline = 'TP2', minval = 0, tooltip = 'Tick and input value') // } // ———— 4) TABLE DISPLAY { T8 = '1) Tick to show table\n2) Small font size recommended for mobile app or multiple layout' T9 = 'Table must be tick before change table position' i_b_table = input.bool(true, 'Show Table |', group = '4) TABLE DISPLAY', inline = 'Table1') i_s_font = input.string('normal', 'Font size', group = '4) TABLE DISPLAY', inline = 'Table1', options = ['tiny', 'small', 'normal', 'large', 'huge'], tooltip = T8) i_s_Y = input.string('bottom', 'Table Position', group = '4) TABLE DISPLAY', inline = 'Table2', options = ['top', 'middle', 'bottom']) i_s_X = input.string('left', '', group = '4) TABLE DISPLAY', inline = 'Table2', options = ['left', 'center', 'right'], tooltip = T9) // } // ———— 5) OTHERS { i_b_col = input.bool(true, 'Use trend color', group = '5) OTHERS', tooltip = 'Show Trend color if true\nTrue : Lime (Bullish), Red (Bearish)\n False : Blue') i_b_currency = input.bool(true, 'Show Currency', group = '5) OTHERS') // } // } // —— 1. Initialization { [animal_name, spec_B_XA_min, spec_B_XA_max, spec_C_AB_min, spec_C_AB_max, spec_D_BC_min, spec_D_BC_max, spec_D_XA_nom, spec_E_SL_nom] = hdb.animal_db(i_f_crab, i_f_gart, i_f_shark) // } // —— 2. TRADE IDENTIFICATION - Harmonic Trading System Part 1 { // ———— 2.1 Get Price from Point X to Point C { [high_X, low_X, close_X] = pti.hlc_time(time_X) [high_A, low_A, close_A] = pti.hlc_time(time_A) [high_B, low_B, _ ] = pti.hlc_time(time_B) [high_C, low_C, _ ] = pti.hlc_time(time_C) // } // ———— 2.2 Determine Point X is lower or higher than Point A { bool X_lower_A = close_X < close_A [pr_X, pr_A, pr_B, pr_C] = sw.TupleSwitchHL(X_lower_A, low_X, high_X, low_A, high_A, low_B, high_B, low_C, high_C) [style0, style1, col_dir] = sw.TupleSwitchStyleColor(X_lower_A) [str_dir, str_X, str_A] = sw.TupleSwitchString(X_lower_A) // } // ———— 2.3 Get ratio and difference for price and time { y_XA = calc.PriceDiff(pr_A, pr_X), time_XA = calc.TimeDiff(time_A, time_X) y_AB = calc.PriceDiff(pr_B, pr_A), time_AB = calc.TimeDiff(time_B, time_A), y_XAB = y_AB / y_XA, time_XAB = calc.TimeDiff(time_B, time_X) y_BC = calc.PriceDiff(pr_C, pr_B), time_BC = calc.TimeDiff(time_C, time_B), y_ABC = y_BC / y_AB // } // ———— 2.4 Variables for Point D { bool c_ret = math.abs(y_ABC) >= 0.382 and math.abs(y_ABC) <= 0.886 bool c_pro = math.abs(y_ABC) >= 1.130 and math.abs(y_ABC) <= 1.618 var bool_animal = array.new_bool(7), var string animal = na, var int animal_number = na // } // ———— 2.5 Get time for Point D { int time_D = na, time_D := time_C + time_XAB // } // ———— 2.6 Verify animal type { f_bool(int _index) => math.abs(y_XAB) >= array.get(spec_B_XA_min, _index) and math.abs(y_XAB) <= array.get(spec_B_XA_max, _index) for x = 0 to 5 array.set(bool_animal, x, f_bool(x) and c_ret) array.set(bool_animal, 6, f_bool(6) and c_pro) if array.includes(bool_animal, true) animal := array.get( animal_name, array.indexof( bool_animal, array.includes(bool_animal, true))) animal_number := array.indexof(bool_animal, array.includes(bool_animal, true)) // } // ———— 2.7 Calculations for Point D { [D_XA , D_BC1, D_BC2] = calc.ReturnIndexOf3Arrays(spec_D_XA_nom, spec_D_BC_min, spec_D_BC_max, animal_number) // } // ———— 2.8 Remove price from negative sign to compare with D = BC { pr_D = calc.AbsoluteRange(pr_A, y_XA, D_XA) y_CD = calc.PriceDiff(pr_D, pr_C), time_CD = calc.TimeDiff(time_D, time_C) y_AD = calc.PriceDiff(pr_D, pr_A), time_AD = calc.TimeDiff(time_D, time_A) // } // ———— 2.9 Check D = BC validity { [str_invalid, str_valid] = sw.TupleSwitchValid(i_s_valid_BC) y_BCD = y_CD / y_BC valid_BC = math.abs(y_BCD) > math.abs(D_BC2) ? str_invalid : math.abs(y_BCD) < math.abs(D_BC1) ? str_invalid : str_valid // } // ———— 2.10 Calculate average price and time { // To be used later in labels y_XB = calc.PriceAverage(pr_X, pr_B), x_XB = calc.TimeAverage(time_X, time_B) y_AC = calc.PriceAverage(pr_A, pr_C), x_AC = calc.TimeAverage(time_A, time_C) y_BD = calc.PriceAverage(pr_B, pr_D), x_BD = calc.TimeAverage(time_B, time_D) y_XD = calc.PriceAverage(pr_X, pr_D), x_XD = calc.TimeAverage(time_X, time_D) // } // } // —— 3. TRADE EXECUTION - Harmonic Trading System Part 2 { // ———— 3.1 D = BC variables { pr_BC1 = calc.AbsoluteRange(pr_C, y_BC, D_BC1) pr_BC2 = calc.AbsoluteRange(pr_C, y_BC, D_BC2) // } // ———— 3.2 Execution Points { // [E1, E2] = switch i_execute [E1, E2] = sw.TupleSwitchTime(i_execute, time_C, time_D, time_XA) x_DE = calc.TimeAverage(time_D, E2) // } // } // —— 4. TRADE MANAGEMENT - Harmonic Trading System Part 3 { F_SL = array.get(spec_E_SL_nom, animal_number) pr_SL = i_b_SL ? i_f_SL : calc.AbsoluteRange(pr_A, y_XA, F_SL) // Stop Loss pr_TP1 = i_b_TP1 ? i_f_TP1 : calc.AbsoluteRange(pr_D, y_AD, 0.382) // Take Profit 1 pr_TP2 = i_b_TP2 ? i_f_TP2 : calc.AbsoluteRange(pr_D, y_AD, 0.618) // Take Profit 2 // } // —— 5. Common Drawings Custom Functions { // ———— 5.1 String format format for price { f_str(float _value, bool _bool = false, string _text = '') => if _bool string str = ' ' + _text str.tostring(_value, '0.000') + str else str.tostring(_value, '0.000') // } // ———— 5.2 Get price difference from point D in percent format { // To be used during TRADE EXECUTION and TRADE MANAGEMENT f_pct(float _price) => string pct = na bear_bool = (_price - pr_D) / pr_D > 0 ? ' ▼' : (_price - pr_D) / pr_D > 0 ? ' ▲' : '' bull_bool = -(pr_D - _price) / pr_D > 0 ? ' ▲' : -(pr_D - _price) / pr_D < 0 ? ' ▼' : '' if str_dir == 'BEARISH' pct := str.tostring((_price - pr_D) / pr_D, '##.## %') + bear_bool else pct := str.tostring(-(pr_D - _price) / pr_D, '##.## %') + bull_bool pct // } // ———— 5.4 Shared variable and array values { // 0, 1, 2, 3, 4 str_XABCD = array.from( 'X', 'A', 'B', 'C', 'D') // To be used with f_label_XABCD() arr_pr = array.from( pr_X, pr_A, pr_B, pr_C, pr_D) // To be used with f_label_XABCD() arr_time = array.from(time_X, time_A, time_B, time_C, time_D) // To be used with f_label_XABCD(), f_line() y_ratio = array.from( y_XB, y_AC, y_BD, y_BD, y_XD) x_ratio = array.from( x_XB, x_AC, time_B, x_BD, x_XD) arr_ratio = array.from(f_str(math.abs(y_XAB), true, 'XA'), f_str(math.abs(y_ABC), true, 'AB'), '', f_str(math.abs(y_BCD), true, 'BC') + '\n' + valid_BC) // price, spec, ratio / percent price_X = calc.PriceCurrency(i_b_currency, pr_X) price_A = calc.PriceCurrency(i_b_currency, pr_A) price_B = calc.PriceCurrency(i_b_currency, pr_B), spec_B = calc.RangeText(spec_B_XA_min, spec_B_XA_max, animal_number, 'XA'), ratio_B = calc.RatioText(y_XAB, 'XA') price_C = calc.PriceCurrency(i_b_currency, pr_C), spec_C = calc.RangeText(spec_C_AB_min, spec_C_AB_max, animal_number, 'AB'), ratio_C = calc.RatioText(y_ABC, 'AB') price_D = calc.PriceCurrency(i_b_currency, pr_D), spec_D = calc.RatioText(D_XA, 'XA'), ratio_D = calc.RatioText(D_XA, 'XA') price_BC = calc.PriceCurrency(i_b_currency, pr_D), spec_BC = calc.RangeText(spec_D_BC_min, spec_D_BC_max, animal_number, 'BC'), ratio_BC = calc.RatioText(y_BCD, 'BC') price_BC1 = calc.PriceCurrency(i_b_currency, pr_BC1), spec_BC1 = calc.RatioText(D_BC1, 'BC'), pct_BC1 = f_pct(pr_BC1) price_BC2 = calc.PriceCurrency(i_b_currency, pr_BC2), spec_BC2 = calc.RatioText(D_BC2, 'BC'), pct_BC2 = f_pct(pr_BC2) price_SL = calc.PriceCurrency(i_b_currency, pr_SL), spec_SL = calc.RatioText(F_SL, 'XA'), ratio_SL = i_b_SL ? 'MANUAL' : '', pct_SL = f_pct(pr_SL) price_TP1 = calc.PriceCurrency(i_b_currency, pr_TP1), spec_TP1 = calc.RatioText(0.382, 'AD'), ratio_TP1 = i_b_TP1 ? 'MANUAL' : '', pct_TP1 = f_pct(pr_TP1) price_TP2 = calc.PriceCurrency(i_b_currency, pr_TP2), spec_TP2 = calc.RatioText(0.618, 'AD'), ratio_TP2 = i_b_TP2 ? 'MANUAL' : '', pct_TP2 = f_pct(pr_TP2) // 0, 1, 2, 3, 4 row_0 = array.from('POINT', 'RATIO', 'SPEC', 'PRICE', 'PERCENT') row_1 = array.from( 'X', '', str_X, price_X, '') row_2 = array.from( 'A', '', str_A, price_A, '') row_3 = array.from( 'B', ratio_B, spec_B, price_B, '') row_4 = array.from( 'C', ratio_C, spec_C, price_C, '') row_5 = array.from( 'D', ratio_D, spec_D, price_D, 'REF POINT') row_6 = array.from( 'PRZ', ratio_BC, spec_BC, price_BC, valid_BC) row_7 = array.from( 'BC1', '', spec_BC1, price_BC1, pct_BC1) row_8 = array.from( 'BC2', '', spec_BC2, price_BC2, pct_BC2) row_9 = array.from( 'SL', ratio_SL, spec_SL, price_SL, pct_SL) row_10 = array.from( 'TP1', ratio_TP1, spec_TP1, price_TP1, pct_TP1) row_11 = array.from( 'TP2', ratio_TP2, spec_TP2, price_TP2, pct_TP2) col_valid = sw.SwitchColor(valid_BC) _extend = sw.SwitchExtend(i_extend) str_special = i_f_gart == 0.886 or i_f_crab == 1.902 or i_f_shark == 1.130 ? '\nSPECIAL SITUATION' : '' // } // } // —— 6. Draw XABCD Pattern (Trade Identification) { // ———— 6.1 Initialize arrays { // 0, 1, 2, 3, 4, 5 var label_XABCD = array.new_label(6), obj.delete(label_XABCD) // Labels for X, A, B, C, D var ratio_XABCD = array.new_label(4), obj.delete(ratio_XABCD) // Labels for XA, AB, BC, XA var solid_XABCD = array.new_line(4), obj.delete(solid_XABCD) // Solid lines for XA, AB, BC, CD var dot_XABCD = array.new_line(4), obj.delete( dot_XABCD) // Dotted lines for XB, AC, BD, XD var fill_XABCD = array.new_linefill(2), obj.delete( fill_XABCD) // Line fill for XA-XB, BC-AC var box[] box_XA = array.new_box(1), obj.delete( box_XA) // Text box for XA // } // ———— 6.2 XABCD custom functions { f_label_XABCD(int _x, color _col = color.blue) => label.new( x = array.get(arr_time, _x), y = array.get(arr_pr, _x), text = array.get(str_XABCD, _x), xloc = xloc.bar_time, color = color.new(color.blue, 100), style = _x % 2 ? style1 : style0, textcolor = i_b_col ? col_dir : _col) f_ratio_XABCD(int _x, color _col = color.blue) => label.new( x = array.get(x_ratio, _x), y = array.get(y_ratio, _x), text = array.get(arr_ratio, _x), xloc = xloc.bar_time, style = label.style_label_center, textcolor = i_b_col ? color.black : color.white, color = i_b_col ? col_dir : _col) f_line(int _x1, int _y1, int _x2, int _y2, bool _bool = true, int _width = 1, int _transp = 0) => _style = switch _bool true => line.style_solid false => line.style_dotted line.new( x1 = array.get(arr_time, _x1), y1 = array.get(arr_pr, _y1), x2 = array.get(arr_time, _x2), y2 = array.get(arr_pr, _y2), xloc = xloc.bar_time, color = i_b_col ? color.new(col_dir, _transp) : color.new(color.blue, _transp), style = _style, width = _width) f_fill_XABCD(int _x1 = 0, int _x2 = 0, color _col = color.blue) => linefill.new(array.get(solid_XABCD, _x1), array.get(dot_XABCD, _x2), i_b_col ? color.new(col_dir, 80) : color.new(_col, 80)) f_box() => box.new( left = time_X, top = pr_X, right = time_D, bottom = pr_SL, xloc = xloc.bar_time, bgcolor = color.new(color.blue, 100), border_color = color.new(color.blue, 100), text = str_dir + ' ' + animal + ' ' + f_str(math.abs(D_XA), true, 'XA') + str_special, text_color = color.blue, text_wrap = text.wrap_auto, text_size = size.normal) // } // ———— 6.3 Finalized Drawing For Trade Identification { f_dwg_identification() => array.set(ratio_XABCD, 3, f_ratio_XABCD(3, col_valid)) if i_display == 'Full' for x = 0 to 4 array.set(label_XABCD, x, f_label_XABCD(x)) array.set(label_XABCD, 4, f_label_XABCD(4, col_valid)) for x = 0 to 1 array.set(ratio_XABCD, x, f_ratio_XABCD(x)) for x = 0 to 3 array.set(solid_XABCD, x, f_line(x, x, x + 1, x + 1, true, 4)) for x = 0 to 2 array.set(dot_XABCD, x, f_line(x, x, x + 2, x + 2, false)) else if i_display == 'Compact' for x = 0 to 3 array.set(solid_XABCD, x, f_line(x, x, x + 1, x + 1, true, 4, 100)) for x = 0 to 2 array.set(dot_XABCD, x, f_line(x, x, x + 2, x + 2, false, 1, x % 2 ? 0 : 100)) array.set(dot_XABCD, 3, f_line(0, 0, 4, 4, false)) f_fill_XABCD(), f_fill_XABCD(2, 2, col_valid) array.set(box_XA, 0, f_box()) // } // } // —— 7. Draw zones { // ———— 7.1 Zone arrays { var line_zone = array.new_line(6), obj.delete(line_zone) var fill_zone = array.new_linefill(5), obj.delete(fill_zone) // } // ———— 7.2 Zones custom functions { f_label_zone(float _y, string _text, string _price, string _percent, color _col = color.blue) => var label id = na label.delete(id) id := label.new(x = E2, y = _y, text = _text + ' : ' + _price + ' , ' + _percent, xloc = xloc.bar_time, style = label.style_label_left, color = color.new(color.blue, 100), textcolor = _col) f_line_zone(float _pr, color _color = color.orange) => line.new(x1 = E1, y1 = _pr, x2 = E2, y2 = _pr, xloc = xloc.bar_time, extend = _extend, color = color.new(_color, 0)) f_fill_zone(int _x1 = 0, int _x2 = 1, color _col = color.orange) => linefill.new(array.get(line_zone, _x1), array.get(line_zone, _x2), color.new(_col, 80)) // } // ———— 7.3 Finalized Drawing For Trade Execution { f_dwg_execution() => array.set(line_zone, 1, f_line_zone(pr_BC1)), array.set(fill_zone, 0, f_fill_zone()) array.set(line_zone, 2, f_line_zone(pr_BC2)), array.set(fill_zone, 1, f_fill_zone(0, 2, color.orange)) if i_extend == 'None' f_label_zone(pr_BC1, 'BC1', price_BC1, pct_BC1, color.orange), f_label_zone(pr_BC2, 'BC2', price_BC2, pct_BC2, color.orange) // } // ———— 7.4 Finalized Drawing For Trade Management { f_dwg_management() => array.set(line_zone, 3, f_line_zone(pr_SL, color.red)) array.set(line_zone, 4, f_line_zone(pr_TP1, color.lime)) array.set(line_zone, 5, f_line_zone(pr_TP2, color.lime)), array.set(fill_zone, 4, f_fill_zone(4, 5, color.lime)) if i_extend == 'None' f_label_zone(pr_SL, 'SL' , price_SL , pct_SL, color.red) f_label_zone(pr_TP1, 'TP1', price_TP1, pct_TP1, color.lime), f_label_zone(pr_TP2, 'TP2', price_TP2, pct_TP2, color.lime) if i_PL == 'Both' array.set(fill_zone, 2, f_fill_zone(2, 3, color.red)), array.set(fill_zone, 3, f_fill_zone(1, 4, color.lime)) else if i_PL == 'PL' array.set(fill_zone, 2, f_fill_zone(0, 3, color.red)), array.set(fill_zone, 3, f_fill_zone(0, 4, color.lime)) // } // } // —— 8. Table { // ———— 8.1 Table variable { var table_XABCD = table.new(position = i_s_Y + '_' + i_s_X, columns =7, rows = 16, bgcolor = color.black, border_color = color.gray, border_width = 1) // } // ———— 8.2 Table custom functions { f_cell(int _column, int _row, _id, color _col1 = color.black, color _col2 = color.white, bool halign = true) => table.cell(table_XABCD, _column, _row, array.get(_id, _column), text_color = _col1, text_size = i_s_font, text_halign = halign ? text.align_right : text.align_center, bgcolor = _col2) f_row_title() => for _row = 0 to 2 f_cell(_row, 0, row_0, color.white, col_valid, false) if i_extend == 'Right' for _row = 3 to 4 f_cell(_row, 0, row_0, color.white, col_valid, false) f_row(int _row, _id, color _col1 = color.black, color _col2 = color.white) => f_cell(0, _row, _id, _col1, _col2, false), f_cell(1, _row, _id, _col1, _col2), f_cell(2, _row, _id, _col1, _col2) if i_extend == 'Right' f_cell(3, _row, _id, _col1, _col2) f_cell(4, _row, _id, _col1, _col2) f_row_twin(int _row1, _id1, int _row2, _id2, color _col1, color _col2) => f_row(_row1, _id1, _col1, _col2), f_row(_row2, _id2, _col1, _col2) // } // ———— 8.3 Finalized table { f_table_array() => if i_b_table if i_display != 'Full' or i_PL != 'None' f_row_title() if i_display == 'Compact' f_row_twin(1, row_1, 2, row_2, color.blue, color.white), f_row_twin(3, row_3, 4, row_4, color.blue, color.white), f_row(5, row_5, color.white, col_valid) if i_PL == 'PRZ' or i_PL == 'Both' f_row(6, row_6, color.white, col_valid), f_row_twin(7, row_7, 8, row_8, color.black, color.orange) if i_PL == 'PL' or i_PL == 'Both' f_row( 9, row_9, color.white, color.red), f_row_twin(10, row_10, 11, row_11, color.black, color.lime) // } // ———— 8.4 Invalid table { f_table_invalid() => if i_b_table f_row_title() f_row_twin(1, row_1, 2, row_2, color.blue, color.white) f_row_twin(3, row_3, 4, row_4, color.blue, color.white) f_row(5, row_5, color.white, col_valid) f_row(6, row_6, color.white, col_valid) // } // } // —— 9 Plot { // ———— 9.1 Plot custom functions { f_plot(float _float) => (valid_BC == 'VALID' or valid_BC == '✅') and i_extend == 'Right' ? _float : na f_plot_exe(float _float) => (valid_BC == 'VALID' or valid_BC == '✅') and i_extend == 'Right' and i_PL != 'PL' and i_PL != 'None' ? _float : na f_plot_mgt(float _float) => (valid_BC == 'VALID' or valid_BC == '✅') and i_extend == 'Right' and i_PL != 'PRZ' and i_PL != 'None' ? _float : na f_col(color _color) => color.new(_color, 100) // } // ———— 9.2 Plot Trade Execution { plot(f_plot(pr_D), 'PRZ', f_col(color.blue), editable = false) plot(f_plot_exe(pr_BC1), 'BC1', f_col(color.orange), editable = false) plot(f_plot_exe(pr_BC2), 'BC2', f_col(color.orange), editable = false) // } // ———— 9.3 Plot Trade Management { plot(f_plot_mgt(pr_SL), 'SL', f_col(color.red), editable = false) plot(f_plot_mgt(pr_TP1), 'TP1', f_col(color.lime), editable = false) plot(f_plot_mgt(pr_TP2), 'TP2', f_col(color.lime), editable = false) // } // } // —— 10. Construct { if barstate.islast f_dwg_identification() if time_A < time_B and time_B < time_C if valid_BC == 'VALID' or valid_BC == '✅' array.set(line_zone, 0, f_line_zone(pr_D, color.blue)) if i_extend == 'None' f_label_zone(pr_D, 'PRZ', price_D, 'REF POINT', color.blue) if i_PL == 'Both' f_dwg_execution() f_dwg_management() else if i_PL == 'PRZ' f_dwg_execution() else if i_PL == 'PL' f_dwg_management() f_table_array() else if valid_BC == 'INVALID' or valid_BC == '❌' f_table_invalid() // }
Volume Zone Oscillator (VZO)
https://www.tradingview.com/script/P6bSDkjh-Volume-Zone-Oscillator-VZO/
Beardy_Fred
https://www.tradingview.com/u/Beardy_Fred/
232
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Beardy_Fred //@version=5 indicator('Beardy VZO', shorttitle='VZO', precision=0, overlay=false) // INPUTS VZO_length = input.int(14, 'VZO Length', minval=2, group = 'VZO') VZO_zone_lower = input.int(40, 'Overbought/sold Lower Limit', minval=0, group = 'VZO') VZO_zone_upper = input.int(60, 'Overbought/sold Upper Limit', minval=0, group = 'VZO') VZO_zone_chop = input.int(15, 'Chop Zone', minval=0, group = 'VZO') VZO_Intraday = input.bool(true, 'Enable Plot Smoothing for Intraday', group = 'VZO Intraday Setting') VZO_noise = input.int(4, 'Noise Filter', minval=2, group = 'VZO Intraday Setting') // VZO CALCULATIONS //Detailed explanation of Volume Zone Oscillator (see pages 18-25 of Journal): https://ifta.org/public/files/journal/d_ifta_journal_09.pdf VZO(length) => Volume_Direction = close > close[1] ? volume : -volume VZO_volume = ta.ema(Volume_Direction, length) Total_volume = ta.ema(volume, length) 100 * VZO_volume / Total_volume VZO = VZO(VZO_length) if VZO_Intraday VZO := ta.ema(VZO, VZO_noise) //ZONE COLORS OB_Zone = color.new(color.red, 75) Chop_Zone = color.new(color.yellow, 75) OS_Zone = color.new(color.green, 75) //ZONES LEVELS Red_1 = hline(VZO_zone_upper, linestyle=hline.style_dotted, color=OB_Zone, title = 'Overbought Upper Limit') Red_2 = hline(VZO_zone_lower, linestyle=hline.style_dotted, color=OB_Zone, title = 'Overbought Lower Limit') fill(Red_1, Red_2, color = OB_Zone, title = 'Overbought Zone') Yell_1 = hline(VZO_zone_chop, linestyle=hline.style_dotted, color=Chop_Zone, title = 'Chop Zone Upper Limit') Yell_2 = hline(-VZO_zone_chop, linestyle=hline.style_dotted, color=Chop_Zone, title = 'Chop Zone Lower Limit') fill(Yell_1, Yell_2, color = Chop_Zone, title = 'Chop Zone') Green_1 = hline(-VZO_zone_lower, linestyle=hline.style_dotted, color=OS_Zone, title = 'Oversold Lower Limit') Green_2 = hline(-VZO_zone_upper, linestyle=hline.style_dotted, color=OS_Zone, title = 'Oversold Upper Limit') fill(Green_1, Green_2, color = OS_Zone, title = 'Oversold Zone') hline(0, linestyle=hline.style_dashed, color=color.new(color.white, 50), title = 'Zero Line') // VZO PLOT Plot_color = VZO > VZO_zone_chop ? color.new(color.green, 0) : VZO < -VZO_zone_chop ? color.new(color.red, 0) : color.new(color.yellow, 0) plot(VZO, color=Plot_color, style=plot.style_line, linewidth=1)
Intrabar Price/Volume Change (experimental)
https://www.tradingview.com/script/9IaI9gGC-Intrabar-Price-Volume-Change-experimental/
fikira
https://www.tradingview.com/u/fikira/
286
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © fikira //@version=5 indicator('Intrabar Price/Volume Change', shorttitle='iPVc', max_lines_count=500, max_boxes_count=500, max_labels_count=500, overlay=false) bool i_sameSide = input.bool (false , title='same side' , inline='1' ) bool i_reverse = input.bool (false , title='reverse' , inline='2' ) int i_width = input.int (100 , title='width' , tooltip='maximum width of lines (bars)', maxval=500) int i_size = input.int (100 , title='max drawings', minval=1, maxval=500) int i_barOffset = input.int ( 0 , title='center line offset' ) color i_colUp = input.color(color.new(color.lime , 0), title='' , group='color Price up/down' , inline='pud' ) color i_colDn = input.color(color.new(#FF0000 , 0), title='' , group='color Price up/down' , inline='pud' ) color i_colUpV = input.color(color.new(color.green , 80), title='' , group='color Volume up/down', inline='vud' ) color i_colDnV = input.color(color.new(color.orange, 80), title='' , group='color Volume up/down', inline='vud' ) color i_newBar1 = input.color(color.new(color.yellow, 50), title='' , group='color (new bar)' , inline='cc' , tooltip='when there is a new bar -> color changes \n(only on seconds/minutes timeframe)') color i_newBar2 = input.color(color.new(color.blue , 50), title='' , group='color (new bar)' , inline='cc' , tooltip='when there is a new bar -> color changes \n(only on seconds/minutes timeframe)') varip float[] a_clo = array.new_float() varip float[] a_vol = array.new_float() varip int[] a_bix = array.new_int () var float[] a_diffP = array.new_float() var float[] a_diffV = array.new_float() var line[] a_lineP = array.new_line () var label[] a_label = array.new_label() var box[] a_boxV = array.new_box () var line vLine = na var float maxP = 0., var float maxV = 0. var float minP = 0., var float minV = 0. var float maxMinP = 0., var float maxMinV = 0. var int change = 0, change := nz(change[1]) == 0 and ta.change(bar_index) ? 1 : 0 if barstate.islastconfirmedhistory // for i = 0 to i_size array.unshift(a_lineP, line.new(bar_index, 0, bar_index, 0, color=color.new(color.blue, 100))) array.unshift(a_boxV , box.new(bar_index, 0, bar_index, 0, bgcolor=color.new(color.blue, 100), border_color=color.new(color.blue, 100))) array.unshift(a_diffP, 0) array.unshift(a_clo , close) array.unshift(a_vol , volume) array.unshift(a_bix , 2) array.unshift(a_label,label.new(bar_index, 0, text='_' , textcolor=color.new(color.blue, 100), style=label.style_none, size=size.huge)) if barstate.islast // // -------[ center line ]------- vLine := line.new(bar_index + i_barOffset, 0, bar_index + i_barOffset, 0.001, extend=extend.both, style=line.style_dotted, color=color.new(color.blue, 50)), line.delete(vLine[1]) // // -------[ every tick -> close, volume, bar_index is added to array, the last one in every array gets removed {IN -> OUT} ]------- array.unshift(a_clo, close ), array.pop(a_clo) array.unshift(a_vol, volume), array.pop(a_vol) array.unshift(a_bix, change), array.pop(a_bix) // for i = 0 to i_size -2 // -------[ difference price/volume ~ last one ]------- diffP = (array.get(a_clo, i) - array.get(a_clo, i +1)), array.unshift(a_diffP, diffP) diffV = (array.get(a_vol, i) - array.get(a_vol, i +1)), array.unshift(a_diffV, diffV) // // -------[ calculate maximum/minimum of each array ]------- maxP := array.max(a_diffP), minP := array.min(a_diffP), maxMinP := math.max(maxP, math.abs(minP)) maxV := array.max(a_diffV), minV := array.min(a_diffV), maxMinV := math.max(maxV, math.abs(minV)) // l_col = diffP > 0 ? i_colUp : i_colDn bgcol = diffP > 0 ? i_colUpV : i_colDnV b_col = color.new(bgcol, 90) // colBix = array.get(a_bix, i) == 0 ? i_newBar1: array.get(a_bix, i) == 1 ? i_newBar2 : color.new(color.blue, 100) // // -------[ maximum/minimum of each array is now used as a limit -> this ensures the lines won't go further then max allowed ]------- int yP = math.max(-500, math.min(500, i_sameSide ? math.round(i_width / maxMinP * math.abs(diffP)) : math.round(i_width / maxMinP * diffP))) * (i_reverse ? -1 : 1) // -------[ if no difference in price, the volume won't be drawn -> * 0 ]------- int yV = math.max(-500, math.min(500, math.round(i_width / maxMinV * math.abs(diffV)))) * (yP < 0 ? -1 : yP > 0 ? 1 : 0) // // -------[ on each tick -> all lines/boxes, labels are updated and redrawn ]------- line.set_xy1 (array.get(a_lineP, i), bar_index + i_barOffset, i) line.set_xy2 (array.get(a_lineP, i), bar_index + i_barOffset + math.round(yP), i) line.set_color (array.get(a_lineP, i), l_col) // box.set_left (array.get(a_boxV , i), bar_index + i_barOffset) box.set_top (array.get(a_boxV , i), i + 0.4) box.set_right (array.get(a_boxV , i), bar_index + i_barOffset + math.round(yV)) box.set_bottom (array.get(a_boxV , i), i - 0.4) // box.set_bgcolor (array.get(a_boxV , i), bgcol) box.set_border_color(array.get(a_boxV , i), b_col) // // -------[ gives an indication of bar progress, every time there is a new bar the color at the center line changes ]------- if timeframe.isseconds or (timeframe.isminutes and timeframe.multiplier < 60) label.set_xy (array.get(a_label, i), bar_index + i_barOffset, i) label.set_textcolor (array.get(a_label, i), colBix ) // if array.size(a_diffP) > i_size array.pop(a_diffP)
Trendlines with Breaks [LuxAlgo]
https://www.tradingview.com/script/IYL88A1N-Trendlines-with-Breaks-LuxAlgo/
LuxAlgo
https://www.tradingview.com/u/LuxAlgo/
17,159
study
5
CC-BY-NC-SA-4.0
// This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/ // © LuxAlgo //@version=5 indicator("Trendlines with Breaks [LuxAlgo]", "LuxAlgo - Trendlines with Breaks", overlay = true) //------------------------------------------------------------------------------ //Settings //-----------------------------------------------------------------------------{ length = input.int(14, 'Swing Detection Lookback') mult = input.float(1., 'Slope', minval = 0, step = .1) calcMethod = input.string('Atr', 'Slope Calculation Method', options = ['Atr','Stdev','Linreg']) backpaint = input(true, tooltip = 'Backpainting offset displayed elements in the past. Disable backpainting to see real time information returned by the indicator.') //Style upCss = input.color(color.teal, 'Up Trendline Color', group = 'Style') dnCss = input.color(color.red, 'Down Trendline Color', group = 'Style') showExt = input(true, 'Show Extended Lines') //-----------------------------------------------------------------------------} //Calculations //-----------------------------------------------------------------------------{ var upper = 0. var lower = 0. var slope_ph = 0. var slope_pl = 0. var offset = backpaint ? length : 0 n = bar_index src = close ph = ta.pivothigh(length, length) pl = ta.pivotlow(length, length) //Slope Calculation Method slope = switch calcMethod 'Atr' => ta.atr(length) / length * mult 'Stdev' => ta.stdev(src,length) / length * mult 'Linreg' => math.abs(ta.sma(src * n, length) - ta.sma(src, length) * ta.sma(n, length)) / ta.variance(n, length) / 2 * mult //Get slopes and calculate trendlines slope_ph := ph ? slope : slope_ph slope_pl := pl ? slope : slope_pl upper := ph ? ph : upper - slope_ph lower := pl ? pl : lower + slope_pl var upos = 0 var dnos = 0 upos := ph ? 0 : close > upper - slope_ph * length ? 1 : upos dnos := pl ? 0 : close < lower + slope_pl * length ? 1 : dnos //-----------------------------------------------------------------------------} //Extended Lines //-----------------------------------------------------------------------------{ var uptl = line.new(na,na,na,na, color = upCss, style = line.style_dashed, extend = extend.right) var dntl = line.new(na,na,na,na, color = dnCss, style = line.style_dashed, extend = extend.right) if ph and showExt uptl.set_xy1(n-offset, backpaint ? ph : upper - slope_ph * length) uptl.set_xy2(n-offset+1, backpaint ? ph - slope : upper - slope_ph * (length+1)) if pl and showExt dntl.set_xy1(n-offset, backpaint ? pl : lower + slope_pl * length) dntl.set_xy2(n-offset+1, backpaint ? pl + slope : lower + slope_pl * (length+1)) //-----------------------------------------------------------------------------} //Plots //-----------------------------------------------------------------------------{ plot(backpaint ? upper : upper - slope_ph * length, 'Upper', color = ph ? na : upCss, offset = -offset) plot(backpaint ? lower : lower + slope_pl * length, 'Lower', color = pl ? na : dnCss, offset = -offset) //Breakouts plotshape(upos > upos[1] ? low : na, "Upper Break" , shape.labelup , location.absolute , upCss , text = "B" , textcolor = color.white , size = size.tiny) plotshape(dnos > dnos[1] ? high : na, "Lower Break" , shape.labeldown , location.absolute , dnCss , text = "B" , textcolor = color.white , size = size.tiny) //-----------------------------------------------------------------------------} //Alerts //-----------------------------------------------------------------------------{ alertcondition(upos > upos[1], 'Upward Breakout', 'Price broke the down-trendline upward') alertcondition(dnos > dnos[1], 'Downward Breakout', 'Price broke the up-trendline downward') //-----------------------------------------------------------------------------}
Per Volume Price Impact
https://www.tradingview.com/script/5V9MbCEG-Per-Volume-Price-Impact/
Yuhui_w
https://www.tradingview.com/u/Yuhui_w/
41
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Yuhui_w //@version=5 // This indicator measures the impact of volume on the absolute // (high-low)/volume indicator("Per Volume Price Impact") log = input(true, title = "Use Log") price_impact = (high-low)/volume plt = log ? math.log(price_impact): price_impact plot(plt, style = plot.style_stepline)
Value-at-Risk
https://www.tradingview.com/script/snDNJcmd-Value-at-Risk/
Yuhui_w
https://www.tradingview.com/u/Yuhui_w/
30
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Yuhui_w //@version=5 indicator("VaR", timeframe = "D") percentile = input(1.0 , title = "Percentile Threashold") length = input(250, title = "Length") in_percent = input(true, title = "Result in Percentage") rt_formula = close/close[1] - 1 return_ = in_percent ? rt_formula * 100 : rt_formula VaR = ta.percentile_linear_interpolation(return_, length, percentile) plot(return_, style = plot.style_histogram, title = "Return") plot(VaR, style = plot.style_stepline, title = "VaR")
Buy alert [Crypto_BCT]
https://www.tradingview.com/script/i46GrRfN-buy-alert-crypto-bct/
Crypto_BitCoinTrader
https://www.tradingview.com/u/Crypto_BitCoinTrader/
57
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Crypto_BitCoinTrader //@version=5 indicator(title="Buy alert [Crypto_BCT]", overlay=true, max_labels_count = 500) rsi = ta.rsi(close,14) RSI_Bottom = input(36, "RSI low") rsibuy = rsi<RSI_Bottom mfi = ta.mfi(close,14) MFI_Bottom = input(30, "MFI low") mfibuy = mfi<MFI_Bottom cci = ta.cci(hlc3, 20) CCI_Bottom = input(-200, "CCI Low") ccibuy = cci<CCI_Bottom atrinput = input(6, "ATR") atr = ta.atr(atrinput) emainput = input(150, "EMA") ema = ta.ema(close, emainput) lowbar = input(36, "Lowest bar from") lowclosebar = ta.lowestbars(close, lowbar) color labelbuy = color(color.green) resultema = 0 int emalow = input.int(30, minval=2, title="Lowest EMA bar ago") for i = 1 to emalow if ema[i-1]<ema[i] resultema += 1 buy = lowclosebar == 0 and rsibuy and mfibuy and ccibuy and open<ema and resultema == emalow and (high-low>atr or low-high>atr) plot(ema, "EMA") if buy label.new(bar_index, low, yloc = yloc.belowbar, color=labelbuy, style=label.style_triangleup, size=size.tiny) bgcolor(buy ? color.new(color.green,70) : na) alertcondition(buy, title="Low Price Detected", message="Low Price Detected")
Tenkan Higher Time Frame by TheSocialCryptoClub
https://www.tradingview.com/script/1edDthCw-Tenkan-Higher-Time-Frame-by-TheSocialCryptoClub/
TheSocialCryptoClub
https://www.tradingview.com/u/TheSocialCryptoClub/
73
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © TheSocialCryptoClub //@version=5 indicator("Tenkan Higher Time Frame", shorttitle="Tenkan HTF", overlay=true) // input declarations tenkan_len = input.int(9, title="Length") tenkan_timeframe = input.timeframe("W", "Higher Timeframe") donchian(len) => math.avg(ta.lowest(tenkan_len), ta.highest(tenkan_len)) tenkan = donchian(tenkan_len) tenkan_high = request.security(syminfo.tickerid,tenkan_timeframe,donchian(tenkan_len)) tenkan_strenght = tenkan > tenkan[1] and high[tenkan_len] <= high[tenkan_len+1] ? color.lime : tenkan < tenkan[1] and low[tenkan_len] >= low[tenkan_len+1] ? color.red : color.blue plot(tenkan, color=tenkan_strenght, title="Tenkan Current Time Frame", linewidth=2) plot(tenkan_high, color=color.aqua, title="Tenkan Higher Time Frame", linewidth=2)
Auto Hosoda Waves by TheSocialCryptoClub
https://www.tradingview.com/script/XlHQ9MYT-Auto-Hosoda-Waves-by-TheSocialCryptoClub/
TheSocialCryptoClub
https://www.tradingview.com/u/TheSocialCryptoClub/
306
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © TheSocialCryptoClub. Used Zig-Zag indicator from TV and Hosoda Waves by Rexio and modificated by PawTar_ //@version=5 indicator("Auto Hosoda Waves", overlay=true, max_lines_count=500, max_labels_count=500) dev_threshold = input.float(title="Zig-Zag Deviation (%)", defval=5.0, minval=0.00001, maxval=100.0) depth = input.int(title="Zig-Zag Depth", defval=10, minval=1) line_color = input(title="Zig-Zag Line Color", defval=#2962FF) extend_to_last_bar = input(title="Zig-Zag Extend to Last Bar", defval=false) display_reversal_price = input(title="Display Reversal Price", defval=false) display_cumulative_volume = input(title="Display Cumulative Volume", defval=false) display_reversal_price_change = input(title="Display Reversal Price Change", defval=false, inline="price rev") difference_price = input.string("Absolute", "", options=["Absolute", "Percent"], inline="price rev") pivots(src, length, isHigh) => p = nz(src[length]) if length == 0 [bar_index, p] else isFound = true for i = 0 to length - 1 if isHigh and src[i] > p isFound := false if not isHigh and src[i] < p isFound := false for i = length + 1 to 2 * length if isHigh and src[i] >= p isFound := false if not isHigh and src[i] <= p isFound := false if isFound and length * 2 <= bar_index [bar_index[length], p] else [int(na), float(na)] [iH, pH] = pivots(high, math.floor(depth / 2), true) [iL, pL] = pivots(low, math.floor(depth / 2), false) calc_dev(base_price, price) => 100 * (price - base_price) / base_price price_rotation_aggregate(price_rotation, pLast, cum_volume) => str = "" if display_reversal_price str += str.tostring(pLast, format.mintick) + " " if display_reversal_price_change str += price_rotation + " " if display_cumulative_volume str += "\n" + cum_volume str caption(isHigh, iLast, pLast, price_rotation, cum_volume) => price_rotation_str = price_rotation_aggregate(price_rotation, pLast, cum_volume) if display_reversal_price or display_reversal_price_change or display_cumulative_volume if not isHigh label.new(iLast, pLast, text=price_rotation_str, style=label.style_none, yloc=yloc.belowbar, textcolor=color.red) else label.new(iLast, pLast, text=price_rotation_str, style=label.style_none, yloc=yloc.abovebar, textcolor=color.green) price_rotation_diff(pLast, price) => if display_reversal_price_change tmp_calc = price - pLast str = difference_price == "Absolute"? (math.sign(tmp_calc) > 0? "+" : "") + str.tostring(tmp_calc, format.mintick) : (math.sign(tmp_calc) > 0? "+" : "-") + str.tostring((math.abs(tmp_calc) * 100)/pLast, format.percent) str := "(" + str + ")" str else "" volume_sum(index1, index2) => float CVI = 0 for i = index1 + 1 to index2 CVI += volume[bar_index - i] str.tostring(CVI, format.volume) var line lineLast = na var label labelLast = na var int iLast = 0 var float pLast = 0 var bool isHighLast = true // otherwise the last pivot is a low pivot var int linesCount = 0 pivotFound(dev, isHigh, index, price) => if isHighLast == isHigh and not na(lineLast) // same direction if isHighLast ? price > pLast : price < pLast if linesCount <= 1 line.set_xy1(lineLast, index, price) line.set_xy2(lineLast, index, price) label.set_xy(labelLast, index, price) label.set_text(labelLast, price_rotation_aggregate(price_rotation_diff(line.get_y1(lineLast), price), price, volume_sum(line.get_x1(lineLast), index))) [lineLast, labelLast, isHighLast, false] else [line(na), label(na), bool(na), false] else // reverse the direction (or create the very first line) if na(lineLast) id = line.new(index, price, index, price, color=line_color, width=2) lb = caption(isHigh, index, price, price_rotation_diff(pLast, price), volume_sum(index, index)) [id, lb, isHigh, true] else // price move is significant if math.abs(dev) >= dev_threshold id = line.new(iLast, pLast, index, price, color=line_color, width=2) lb = caption(isHigh, index, price, price_rotation_diff(pLast, price), volume_sum(iLast, index)) [id, lb, isHigh, true] else [line(na), label(na), bool(na), false] if not na(iH) and not na(iL) and iH == iL dev1 = calc_dev(pLast, pH) [id2, lb2, isHigh2, isNew2] = pivotFound(dev1, true, iH, pH) if isNew2 linesCount := linesCount + 1 if not na(id2) lineLast := id2 labelLast := lb2 isHighLast := isHigh2 iLast := iH pLast := pH dev2 = calc_dev(pLast, pL) [id1, lb1, isHigh1, isNew1] = pivotFound(dev2, false, iL, pL) if isNew1 linesCount := linesCount + 1 if not na(id1) lineLast := id1 labelLast := lb1 isHighLast := isHigh1 iLast := iL pLast := pL else if not na(iH) dev1 = calc_dev(pLast, pH) [id, lb, isHigh, isNew] = pivotFound(dev1, true, iH, pH) if isNew linesCount := linesCount + 1 if not na(id) lineLast := id labelLast := lb isHighLast := isHigh iLast := iH pLast := pH else if not na(iL) dev2 = calc_dev(pLast, pL) [id, lb, isHigh, isNew] = pivotFound(dev2, false, iL, pL) if isNew linesCount := linesCount + 1 if not na(id) lineLast := id labelLast := lb isHighLast := isHigh iLast := iL pLast := pL var line extend_line = na var label extend_label = na if extend_to_last_bar == true and barstate.islast == true isHighLastPoint = not isHighLast curSeries = isHighLastPoint ? high : low if na(extend_line) and na(extend_label) extend_line := line.new(line.get_x2(lineLast), line.get_y2(lineLast), bar_index, curSeries, color=line_color, width=2, style=line.style_dashed) extend_label := caption(not isHighLast, bar_index, curSeries, price_rotation_diff(line.get_y2(lineLast), curSeries), volume_sum(line.get_x2(lineLast), bar_index)) line.set_xy1(extend_line, line.get_x2(lineLast), line.get_y2(lineLast)) line.set_xy2(extend_line, bar_index, curSeries) label.set_xy(extend_label, bar_index, curSeries) price_rotation = price_rotation_diff(line.get_y1(extend_line), curSeries) volume_cum = volume_sum(line.get_x1(extend_line), bar_index) label.set_text(extend_label, price_rotation_aggregate(price_rotation, curSeries, volume_cum)) label.set_textcolor(extend_label, isHighLastPoint? color.green : color.red) label.set_yloc(extend_label, yloc= isHighLastPoint? yloc.abovebar : yloc.belowbar) // Store lines for Waves Calculation var hosoda_lines = array.new_line(10,line.new(0, low, bar_index, high)) // Push the last line into the array if lineLast != array.get(hosoda_lines, array.size(hosoda_lines)-1) array.push(hosoda_lines, lineLast) // Input to visualize the Waves show_label = input(true, title="Show Hosoda Waves") previous_wave = input.int(0, title="Use the backward zig-zag lines for wave calculation (0 actual, 1 the previous one..)") if barstate.islast A = line.get_y2(array.get(hosoda_lines, array.size(hosoda_lines)-3-previous_wave)) // input.float(0, minval=0, title="Price at A point: ") B = line.get_y2(array.get(hosoda_lines, array.size(hosoda_lines)-2-previous_wave)) //input.float(0, minval=0, title="Price at B point: ") C = line.get_y2(array.get(hosoda_lines, array.size(hosoda_lines)-1-previous_wave)) // input.float(0, minval=0, title="Price at C point: ") A_x = line.get_x2(array.get(hosoda_lines, array.size(hosoda_lines)-3-previous_wave)) B_x = line.get_x2(array.get(hosoda_lines, array.size(hosoda_lines)-2-previous_wave)) C_x = line.get_x2(array.get(hosoda_lines, array.size(hosoda_lines)-1-previous_wave)) label.new(A_x, A, text="A", style=label.style_circle, color=line_color, size=size.tiny) label.new(B_x, B, text="B", style=label.style_circle, color=line_color, size=size.tiny) label.new(C_x, C, text="C", style=label.style_circle, color=line_color, size=size.tiny) float V = na float N = na float E = na float NT = na if (A > 0 and B > 0 and C > 0) if A<B V := B+(B-C) N := C+(B-A) E := B+(B-A) NT := C+(C-A) if A>B V := B-(C-B) N := C-(A-B) E := B-(A-B) NT := C-(A-C) lNT = show_label ? line.new(bar_index[5], NT, bar_index[0], NT, color=color.yellow, width = 2,extend=extend.right) :na lN = show_label ? line.new(bar_index[5], N, bar_index[0], N, color=color.orange, width = 2,extend=extend.right) :na lV = show_label ? line.new(bar_index[5], V, bar_index[0], V, color=color.red, width = 2,extend=extend.right) :na lE = show_label ? line.new(bar_index[5], E, bar_index[0], E, color=color.blue, width = 2,extend=extend.right) :na var label NTtarget = show_label ? label.new(na,na,na, textcolor=color.yellow, color=color.new(color.white,50), style=label.style_none, xloc=xloc.bar_time, yloc=yloc.price) :na label.set_xy(NTtarget, time + 1 , NT) label.set_text(NTtarget, "NT " + str.tostring(NT)) var label Ntarget = show_label ? label.new(na,na,na, textcolor=color.orange, color=color.new(color.white,50), style=label.style_none, xloc=xloc.bar_time, yloc=yloc.price) :na label.set_xy(Ntarget, time + 1, N) label.set_text(Ntarget, "N " + str.tostring(N)) var label Vtarget = show_label ? label.new(na,na,na, textcolor=color.red, color=color.new(color.white,50), style=label.style_none, xloc=xloc.bar_time, yloc=yloc.price) :na label.set_xy(Vtarget, time + 1, V) label.set_text(Vtarget, "V " + str.tostring(V)) var label Etarget = show_label ? label.new(na,na,na, textcolor=color.blue, color=color.new(color.white,50), style=label.style_none, xloc=xloc.bar_time, yloc=yloc.price) :na label.set_xy(Etarget, time + 1, E) label.set_text(Etarget, "E " + str.tostring(E))
FII and DII Data
https://www.tradingview.com/script/pw3iBpKz-FII-and-DII-Data/
nanujogi
https://www.tradingview.com/u/nanujogi/
194
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © nanujogi //@version=5 indicator("FII and DII Data", overlay=true, max_bars_back = 500, max_labels_count = 500) showAll = input.bool(false, "Show All Months Activity") var netFII = +2625+256-306-456-646-478+957+650-1244-190-262-1712-85-497-549-12-1261-696-1762-1500-7702-4237+252+456-1093-1832+264-593+317-1863-422-1005-998-90-1864-4424-2934-1685-3364-1686-354-693-2333-1327-3007-3110-1237+164+295-1632-1047+1473-224-759-3246-1725-3368+488-2973-495+62-1393-2973-495+62-1393-4638+1525+614-495-1901-267-1511+723-2324-3073+331+644-711-1893-556-317-1878-93-702-1024-3979+923+1089-83-1999+3371+1166+2116+73+2636+2238-1242+1469+1059+871+2833+2290+2134+1996+6398+12350+2024-409-344-693+4013-1943-1031+181+3282+1863+2200-594-309+613+1446+1111-701+643+2652+3406+2086+2290+350+2512+1498+183+923-113+1805+149+1407+1685+1014+990+1833+1942+3163+778+1415+1389+2992+3304+3936-1257-362-336-2117-968+170-522+422+222+2152+1030+1383+476+822+322+2366+1245+1947-623-1457-995-1044-1455-1906-1767+167-1247-2209-1547-2061-561+3672+866+246+12771-425-4559-2023-1470-1417-580+526-159-625+1571+432+1305+1322+1458-145-737-2560-1218-932-3065+2543-4568-5693-5978-257-114+224-2002+588+55+211+1571-3739-1347-3405-2109+57-2676-1256-2621-256-213-2951+469-428+162-498-707+1158-499+1218-138-1975+1538+331+669+3615-158-779-1382-257-894+215-1475+8913+1279+2615+369+4234-1803-237-1221+272+1583+39-126+2993+3958-388+546+1942+1436+778+1392+6913+6916+1578+2818+331+576+439+1687-381+858-184-1011-1107-357-4613-2139-2251+749+1345+1278-1522-3873-2096-3040-5101-2900-2227-278+1196+732-3260-679-1375+1957+1696+2275+2836+111+1705-812-9-2297+4166-561-51+2361+168+1058-346+1111+3457+4308+1377+3040+2249+2455+1606+1728+3968+1663+5347+1470+6451-94-1278-855-615+1875+7012+1059+220-1653+363-2721-1457+359+119-925-795+2133-1434-2857-261-309-853-1278-2109-2010-2921-1177+342-8593-3123-3358-4313-3566-3182-1401-2408-2242-1854-3771-571-722-1004+2281-3137-1598-1667-1990-1285+1456-4900-1255-2192-1789-3780-3810-3004-3476-2891-4618-1560-2867+1335-3648+1890-2791+104-2644-2462-714-2340-5090-6483-2061-2660-1464-575-4495-1143+3487+1451+8677+3089+2383-177-319-1507-1347+895+725-2863+3120+541-1105-177-1319-1981-4476-8143-7482-7499-6531-4056-3948-4434-6687-3828-2262-2530-710-367-1391-4254+109-1733-893-1968-1157-2268-2096-184-96-3624-5045-6267-7094-3899-3149-4680+49-1669-2415-2785-1899-2280-1819-2436-5476-278+1171-401-520-1044+632-2942+3764+2448+922+14240+1135+2345-2110-4660-8054-172-3702-3643-5241-2757-302-2955-2990-2111+947+7948-923-1919-31-2651-484-840-3064-303-463+315-233-719+1630-747-1132+634+2317+1357+592-1697+493-145+403-725-1371-1598-855-1525-2705 var netDII = +134+457+721+722+78-565+706+610+830+95+823+1512+524+700+596+403+1380+340+1328+313+6558+3569+1112+9+736+1470+113+1184-103+1532+1032+1963+2661+783+521+1769+1361+2751+2711+386+714+1579+801+1158-573+553+1939-51+850+260+366+1150+28-247+1078+2563+2295+4383+1323+305+1264+1414+5797+125+534+626+339-314+2406+1461+500+704-598+537+1081+367+1729-2+1036+2488+1634+2528+470-334+934+1291-193-2135-1317+64-772-1197+437-7+288-2964-2352-439-785-338+1198-1021-1991+250-684+219+550+1973-365+681-298-655-203+1794+1246-405+392-489+1196+582+489-2529-439+854+1841+338+301+397+605+1071-850-204-886+191-922-200-790+405+245-2199+442-584-394+264+97-228+564+1177+1633+833-110+402+270-274-225-264+352-997-947-328+2480+1669-156+1809+2556+1660+384+1946+2877+1817+2051+1824+2124+1419+1350+42-938+757+2090+2129+1499+4610+2232+1401+1586+372-235+86-85+1577+517+205+522-291-205+941+640+1203+1265+2371+529+4506+5513+4252+1378+1145+435+1510-129+1226+91+686+1953+2128+2431+1807+1724+1083-194+774+351+743+2266+516+373+622+1286+3399+2207+1757+495+687+1543+261+926+37+696+502+772+389-559+2608+712+2665-4056-744+88-296-236+414+636+1263+890+449+1437-549+47+616-967-1060-844-549-732-1378-730-1107-613-1580+873+80-119-887+908+2085+1582+1624+753+85+2431+2137+545-44+946-423+3245+3162+2544+3505+3532+299+263+539+132-95-37-929+188-1268-891-1168-213-139+633+534-669+951-657+144+454-334-322-215-85-1633+471-510-136-839-730-768-496-47-518+118-822-1+600+712+999-72+735-312-230-101+844+1059-556+1719+141-297+35+981+1464-258+1688+1311+1378+847+1206+1164+2213+2438+1859+3066+2093+6087+1929+2588+3808+2815+2831+1625+1904+1311+1940+2361+131+984+1845+1524+2727+2906+2230+1948+1445+2149+3226+376+2294+1428+3170+4816+4181+2958+3077+3015+2229+1338+1951+3490+781+1918+1644+1870+1602+2823+2646+3981+3342+1411+870-486-17+1775+623+105+1647-184+1145+1216+1713+1162+1373+2091-294-602+253-678+773+98+1099+1687+946+3276+6499+5331+4739+4799+3062+4143+4318+7668+3024+2393+1929+901+1180+4412+2170-697+2727+1793+1115-1376+622-371+426+1598+3649+3359+2281+4535+75+269+769-2578-1681+428+1030+2390+1385+472+837+4373+116-6+196+38+1912+1418+767+446+851+1525+577-61+1886+2051+1412+3810+1368+2294+4611+5350+3467+1373+1649+1702+2606+1736+783+387+387+425+1553+1533+1479+2784+1405+1593+1196-43+956+567+1007+578+1166+803+533+1272+801-116+482+379+1332+1065+371-115-220-195 var nov23FII = +2625+256-306-456-646-478+957+650-1244-190-262-1712-85-497-549-12-1261-1817-696-1762-1500 var nov23DII = +134+457+721+722+78-565+706+610+830+95+823+1512+524+700+596+403+1380+1622+340+1328+313 var oct23FII = -7702-4237+252+456-1093-1832+264-593+317-1863-422-1005-998-90-1864-4424-2934-1685 var oct23DII = 6558+3569+1112+9+736+1470+113+1184-103+1532+1032+1963+2661+783+521+1769+1361+2751 var sep23FII = -3364-354-693-2333-1327-3007-3110-1237+164+295-1632-1047+1473-224-759-3246-1725-3368+488 var sep23DII = 2711+386+714+1579+801+1158-573+553+1939-51+850+260+366+1150+28-247+1078+2563+2295 var aug23FII = -2973-495+62-1393-4638+1525+614-495-1901-267-1511+723-2324-3073+331+644-711-1893-556-317-1878-93-702-1024 var aug23DII = +4383+1323+305+1264+1414+5797+125+534+626+339-314+2406+1461+500+704-598+537+1081+367+1729-2+1036+2488+1634 var july23DII = 2528+470-334+934+1291-193-2135-1317+64-772-1197+437-7+288-2964-2352-439-785-338+1198 var july23FII = -3979+923+1089-83-1999+3371+1166+2116+73+2636+2238-1242+1469+1059+871+2833+2290+2134+1996+6398 var june23FII = 12350+2024-409-344-693+4013-1943-1031+181+3282+1863+2200-594-309+613+1446+1111-701+643+2652+3406+2086+2290+350 var june23DII = -1021-1991+250-684+219+550+1973-365+681-298-655-203+1794+1246-405+392-489+1196+582+489-2529-439+854+1841 var may23FII = 2512+1498+183+923-113+1805+149+1407+1685+1014+990+1833+1942+3163+778+1415+1389+2992+3304 var may23DII = 338+301+397+605+1071-850-204-886+191-922-200-790+405+245-2199+442-584-394+264 var apr23FII = 3936+1257-362-336-2117-968+170-522+422+222+2152+1030+1383+476+822+322+2366 var apr23DII = 97-228+564+1177+1633+833-110+402+270-274-225-264+352-997-947-328+2480 var mar23FII = 1245+1947-623-1457-995-1044-1455-1906-1767+167-1247-2209-1547-2061-561+3672+866+246+12771-425-4559-2023-1470 var mar23DII = 1669-156+1809+2556+1660+384+1946+2877+1817+2051+1824+2124+1419+1350+42-938+757+2090+2129+1499+4610+2232+1401 var feb23FII = -1417-580+526-159-625+1571+432+1305+1322+1458-145-737-2560-1218-932-3065+2543-4568-5693-5978 var feb23DII = 1586+372-235+86-85+1577+517+205+522-291-205+941+640+1203+1265+2371+529+4506+5513+4252 var jan23FII = -257-114+224-2002+588+55+211+1571-3739-1347-3405-2109+57-2676-1256-2621-256-213-2951 var jan23DII = 1378+1145+435+1510-129+1226+91+686+1953+2128+2431+1807+1724+1083-194+774+351+743+2266 var decFII = 469-428+162-498-707+1158-499+1218-138-1975+1538+331+669+3615-158-779-1382-257-894+215-1475+8913+1279+2615+369 var decDII = 516+373+622+1286+3399+2207+1757+495+687+1543+261+926+37+696+502+772+389-559+2608+712+2665-4056-744+88-296 var novFII = 369+4234-1803-237-1221+272+1583+39-126+2993+3958-388+546+1942+1436+778+1392+6913+6916+1578 var novDII = -296-236+414+636+1263+890+449+1437-549+47+616-967-1060-844-549-732-1378-730-1107-613 var octFII = 2818+331+576+439+1687-381+858-184-1011-1107-357-4613-2139-2251+749+1345+1278-1522 var octDII = -1580+873+80-119-887+908+2085+1582+1624+753+85+2431+2137+545-44+946-423+3245 var sepFII = -3873-2096-3040-5101-2900-2227-278+1196+732-3260-679-1375+1957+1696+2275+2836+111+1705-812-9-2297+4166-561-51 var sepDII = 3162+2544+3505+3532+299+263+539+132-95-37-929+188-1268-891-1168-213-139+633+534-669+951-657+144+454 strnetFII = str.tostring(netFII) strnetDII = str.tostring(netDII) // percentage_calculation = ((netDII * 100 ) / math.abs(netFII)) - 100 // User Table Position is now flexible string tableYposInput = input.string("top", "Table position", inline = "11", options = ["top", "middle", "bottom"]) string tableXposInput = input.string("right", "", inline = "11", options = ["left", "center", "right"]) var mySize = size.small var myTextAlign = text.align_center var myTextColor = color.rgb(245,166,35) var bothSelling = color.yellow var bothBuying = color.lime var downArrow = #990000 // Crimson red // STEP 1. Make an input with drop-down menu sizeOption = input.string(title="Font Size", options=["Auto", "Huge", "Large", "Normal", "Small", "Tiny"], defval="Small", tooltip = "Select your font size") // STEP 2. Convert the input to valid label sizes labelSize = (sizeOption == "Huge") ? size.huge : (sizeOption == "Large") ? size.large : (sizeOption == "Small") ? size.small : (sizeOption == "Tiny") ? size.tiny : (sizeOption == "Auto") ? size.auto : size.normal // Make the color-type input selectedColor = input.color(title="Color", defval=color.orange, tooltip = "Choose your own favourite text color") //// Implemented Day Time Frame checks. Now will show an Yello Box in Middle if user is in One Hour Time Frame. /// Thanks flies out to BobRivera990 for shareing source code of Weekly Volume Heatmap. var string show_user_correct_timeframe = "Please use Day Time Frame on Nifty 50 Spot !!!" var bool correct_TimeFrame = timeframe.multiplier == 1 var table dialogBox = table.new(position.middle_center, 1, 1, bgcolor = color.yellow) showDialog(_dialogBox, _msg) => table.cell(_dialogBox, 0, 0, _msg, text_color = color.red, text_size = size.large) if not correct_TimeFrame showDialog(dialogBox, show_user_correct_timeframe) // runtime.error(str.format("FII & DII data is available only in Day Time Frame", syminfo.prefix)) //// Implementation Ends // // pdata1 = if bar_index == 7548 // // label.new(bar_index, na, color = selectedColor, style=label.style_none,text="Start 19h October 2021\nFII + 49" + "\nDII -- 2578\n\n", textcolor = color.lime, textalign = text.align_center, size = size.normal) // // pdata2 = if bar_index == 7549 // // label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1669" + "\nDII -- 1681", textcolor = bothSelling, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) // // pdata3 = if bar_index == 7550 // // label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 2415" + "\nDII + 428", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) // pdata4 = if bar_index == 7551 // label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 2785" + "\nDII + 1030", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) // pdata5 = if bar_index == 7552 // label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1899" + "\nDII + 2390", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) // pdata6 = if bar_index == 7553 // label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 2280" + "\nDII + 1385", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) // pdata7 = if bar_index == 7554 // label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1819" + "\nDII + 472", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) // pdata8 = if bar_index == 7555 // label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 2436" + "\nDII + 837", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) // pdata9 = if bar_index == 7556 // label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 5476" + "\nDII + 4373", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) // pdata10 = if bar_index == 7557 // label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 278" + "\nDII + 116", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) // pdata11 = if bar_index == 7558 // label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 1171" + "\nDII -- 6", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) // pdata12 = if bar_index == 7559 // label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 401" + "\nDII + 196", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) // pdata13 = if bar_index == 7560 // label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 520" + "\nDII + 38", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) // pdata14 = if bar_index == 7561 // label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1044" + "\nDII + 1912", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) // pdata15 = if bar_index == 7562 // label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 632" + "\nDII + 1418", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) // pdata16 = if bar_index == 7563 // label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 2942" + "\nDII + 767", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) // pdata17 = if bar_index == 7564 // label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 3764" + "\nDII + 446", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) // pdata18 = if bar_index == 7565 // label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 2448" + "\nDII + 851", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) // pdata19 = if bar_index == 7566 // label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 922" + "\nDII + 1525", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) // data1 = if bar_index == 7567 // label.new(bar_index, na, color = selectedColor, style=label.style_none,text="\nFII + 14240" + "\nDII + 577\n\n", textcolor = color.lime, textalign = text.align_right, size = size.normal) // data2 = if bar_index == 7568 // label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 1135" + "\nDII - 61", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) // data3 = if bar_index == 7569 // label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 2385" + "\nDII + 1846", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) // data4 = if bar_index == 7570 // label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 2110" + "\nDII + 2051", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) // data5 = if bar_index == 7571 // label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 4660" + "\nDII + 1412", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) // data6 = if bar_index == 7572 // label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 8054" + "\nDII + 3810", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) // data7 = if bar_index == 7573 // label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 172" + "\nDII + 1368", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) // data8 = if bar_index == 7574 // label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 3702" + "\nDII + 2294", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) // data9 = if bar_index == 7575 // label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 3643" + "\nDII + 4611", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) // data10 = if bar_index == 7576 // label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 5241" + "\nDII + 5350", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) // data11 = if bar_index == 7577 // label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 2757" + "\nDII + 3467", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) // data12 = if bar_index == 7578 // label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 302" + "\nDII + 1373", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) // data13 = if bar_index == 7579 // label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 2955" + "\nDII + 1649", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) // data14 = if bar_index == 7580 // label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 2990" + "\nDII + 1702", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) // data15 = if bar_index == 7581 // label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 2111" + "\nDII + 2606", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data16 = if bar_index == 7582 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 947" + "\nDII + 1736", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data17 = if bar_index == 7583 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 7948" + "\nDII + 783", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data18 = if bar_index == 7584 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 923" + "\nDII + 387", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data19 = if bar_index == 7585 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1919" + "\nDII + 1351", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data20 = if bar_index == 7586 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 31" + "\nDII + 425", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data21 = if bar_index == 7587 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 2651" + "\nDII + 1553", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data22 = if bar_index == 7588 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 484" + "\nDII + 1533", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data23 = if bar_index == 7589 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 840" + "\nDII + 1479", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) // Just trying to understand how different style in labels. data24 = if bar_index == 7590 label.new(bar_index, low, color = color.black, style=label.style_label_up, text="FII -- 3064" + "\nDII + 2784", textcolor = selectedColor, textalign = myTextAlign, size = size.normal) data25 = if bar_index == 7591 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 303" + "\nDII + 1405", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data26 = if bar_index == 7592 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 463" + "\nDII + 1593", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data27 = if bar_index == 7593 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 315" + "\nDII + 1196", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data28 = if bar_index == 7594 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 233" + "\nDII -- 43", textcolor = bothSelling, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data29 = if bar_index == 7595 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 719" + "\nDII + 956", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data30 = if bar_index == 7596 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 1630" + "\nDII + 567", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data31 = if bar_index == 7597 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 747" + "\nDII + 1007", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data32 = if bar_index == 7598 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1132" + "\nDII + 578", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data33 = if bar_index == 7599 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 634" + "\nDII + 1166", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data34 = if bar_index == 7600 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 2317" + "\nDII + 803", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data35 = if bar_index == 7601 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 1357" + "\nDII + 533", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data36 = if bar_index == 7602 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 592" + "\nDII + 1272", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data37 = if bar_index == 7603 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1697" + "\nDII + 801", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data38 = if bar_index == 7604 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 493" + "\nDII --116", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data39 = if bar_index == 7605 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 145" + "\nDII + 482", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data40 = if bar_index == 7606 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 403" + "\nDII + 309", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data41 = if bar_index == 7607 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 725" + "\nDII + 1332", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data42 = if bar_index == 7608 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1371" + "\nDII + 1065", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data43 = if bar_index == 7609 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1598" + "\nDII + 371", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) // date: 17-01-2022 data44 = if bar_index == 7610 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 855" + "\nDII -- 115", textcolor = bothSelling, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data45 = if bar_index == 7611 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1254" + "\nDII -- 220", textcolor = bothSelling, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data46 = if bar_index == 7612 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 2705" + "\nDII -- 195", textcolor = bothSelling, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data47 = if bar_index == 7613 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 4680" + "\nDII + 769", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data48 = if bar_index == 7614 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 3149" + "\nDII + 269", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data49 = if bar_index == 7615 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 3899" + "\nDII + 75", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data50 = if bar_index == 7616 // label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 7094" + "\nDII + 4535", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) label.new(bar_index, low, color = color.black, style=label.style_label_up, text="FII -- 7094" + "\nDII + 4535", textcolor = selectedColor, textalign = myTextAlign, size = size.normal) data51 = if bar_index == 7617 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 6267" + "\nDII + 2881", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data52 = if bar_index == 7618 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 5045" + "\nDII + 3359", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data53 = if bar_index == 7619 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 3624" + "\nDII + 3649", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data54 = if bar_index == 7620 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 96" + "\nDII + 1598", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data55 = if bar_index == 7621 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 184" + "\nDII + 426", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data56 = if bar_index == 7622 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 2096" + "\nDII -- 371", textcolor = bothSelling, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data57 = if bar_index == 7623 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 2268" + "\nDII + 426", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data58 = if bar_index == 7624 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1157" + "\nDII -- 1376", textcolor = bothSelling, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data59 = if bar_index == 7625 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1968" + "\nDII + 1115", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data60 = if bar_index == 7626 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 893" + "\nDII + 1793", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data61 = if bar_index == 7627 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1733" + "\nDII + 2727", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data62 = if bar_index == 7628 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 109" + "\nDII -- 697", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data63 = if bar_index == 7629 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 4254" + "\nDII + 2170", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data64 = if bar_index == 7630 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1391" + "\nDII + 4412", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data65 = if bar_index == 7631 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 367" + "\nDII + 1180", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data66 = if bar_index == 7632 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 710" + "\nDII + 901", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data67 = if bar_index == 7633 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 3058" + "\nDII + 1929", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data68 = if bar_index == 7634 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 774" + "\nDII + 2393", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data69 = if bar_index == 7635 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 3246" + "\nDII + 4109", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data70 = if bar_index == 7636 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 2838" + "\nDII + 3024", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data71 = if bar_index == 7637 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 6687" + "\nDII + 7668", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data72 = if bar_index == 7638 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 4434" + "\nDII + 4318", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data73 = if bar_index == 7639 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 3948" + "\nDII + 4143", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data74 = if bar_index == 7640 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 4056" + "\nDII + 3062", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data75 = if bar_index == 7641 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 6531" + "\nDII + 4799", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data76 = if bar_index == 7642 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 7499" + "\nDII + 4739", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data77 = if bar_index == 7643 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 7482" + "\nDII + 5331", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data78 = if bar_index == 7644 label.new(bar_index, low, color = color.black, style=label.style_label_up,text="FII -- 8143" + "\nDII + 6490", textcolor = selectedColor, textalign = myTextAlign, size = size.normal) data79 = if bar_index == 7645 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 4476" + "\nDII + 3276", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data80 = if bar_index == 7646 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1981" + "\nDII + 946", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data81 = if bar_index == 7647 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1319" + "\nDII + 1687", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data82 = if bar_index == 7648 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 177" + "\nDII + 1099", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data83 = if bar_index == 7649 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1105" + "\nDII + 98", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data84 = if bar_index == 7650 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 541" + "\nDII + 773", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data85 = if bar_index == 7651 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 3120" + "\nDII + 678", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data86 = if bar_index == 7652 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 2863" + "\nDII + 253", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data87 = if bar_index == 7653 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 725" + "\nDII -- 602", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data88 = if bar_index == 7654 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 895" + "\nDII -- 294", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data89 = if bar_index == 7655 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1347" + "\nDII + 2091", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data90 = if bar_index == 7656 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1507" + "\nDII + 1373", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data91 = if bar_index == 7657 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 319" + "\nDII + 1162", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data92 = if bar_index == 7658 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 177" + "\nDII + 1713", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data93 = if bar_index == 7659 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 2383" + "\nDII + 1216", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data94 = if bar_index == 7660 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 3089" + "\nDII + 1145", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data95 = if bar_index == 7661 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 8677" + "\nDII -- 184", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data96 = if bar_index == 7662 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 1451" + "\nDII + 1647", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data97 = if bar_index == 7663 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 3487" + "\nDII + 105", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data98 = if bar_index == 7664 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1413" + "\nDII + 623", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data99 = if bar_index == 7665 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 4495" + "\nDII + 1775", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data100 = if bar_index == 7666 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 575" + "\nDII -- 17", textcolor = bothSelling, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data101 = if bar_index == 7667 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1464" + "\nDII -- 486", textcolor = bothSelling, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data102 = if bar_index == 7668 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 2660" + "\nDII + 870", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data103 = if bar_index == 7669 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 2061" + "\nDII + 1411", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data104 = if bar_index == 7670 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 6483" + "\nDII + 3342", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data105 = if bar_index == 7671 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 5090" + "\nDII + 3981", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data106 = if bar_index == 7672 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 2340" + "\nDII + 2646", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data107 = if bar_index == 7673 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 714" + "\nDII + 2823", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data108 = if bar_index == 7674 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 2462" + "\nDII + 1602", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data109 = if bar_index == 7675 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 2644" + "\nDII + 1870", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data110 = if bar_index == 7676 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 104" + "\nDII + 1644", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data111 = if bar_index == 7677 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 2791" + "\nDII + 1918", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data112 = if bar_index == 7678 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 1890" + "\nDII + 781", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data113 = if bar_index == 7679 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 3648" + "\nDII + 3490", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data114 = if bar_index == 7680 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 1335" + "\nDII + 1951", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data115 = if bar_index == 7681 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 2867" + "\nDII + 1338", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data116 = if bar_index == 7682 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1560" + "\nDII + 2229", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data117 = if bar_index == 7683 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 4618" + "\nDII + 3015", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) // data118 = if bar_index == 7684 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 2891" + "\nDII + 3077", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data119 = if bar_index == 7685 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 3476" + "\nDII + 2958", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data120 = if bar_index == 7686 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 3004" + "\nDII + 4181", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data121 = if bar_index == 7687 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 4810" + "\nDII + 4816", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data122 = if bar_index == 7688 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 3780" + "\nDII + 3170", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data123 = if bar_index == 7689 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1789" + "\nDII + 1428", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data124 = if bar_index == 7690 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 2192" + "\nDII + 2294", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data125 = if bar_index == 7691 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1255" + "\nDII + 376", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data126 = if bar_index == 7692 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 4900" + "\nDII + 3226", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data127 = if bar_index == 7693 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 1456" + "\nDII + 2149", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data128 = if bar_index == 7694 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1285" + "\nDII + 1445", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data129 = if bar_index == 7695 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1990" + "\nDII + 1948", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data130 = if bar_index == 7696 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1617" + "\nDII + 2230", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data131 = if bar_index == 7697 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1598" + "\nDII + 2906", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data132 = if bar_index == 7698 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 3137" + "\nDII + 2727", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data133 = if bar_index == 7699 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 2281" + "\nDII + 1524", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data134 = if bar_index == 7700 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1004" + "\nDII + 1845", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data135 = if bar_index == 7701 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 722" + "\nDII + 984", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data136 = if bar_index == 7702 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 571" + "\nDII + 131", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data137 = if bar_index == 7703 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 3771" + "\nDII + 2361", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data138 = if bar_index == 7704 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1854" + "\nDII + 1940", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data139 = if bar_index == 7705 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 2242" + "\nDII + 1311", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data140 = if bar_index == 7706 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 2408" + "\nDII + 1904", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data141 = if bar_index == 7707 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1401" + "\nDII + 1625", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data142 = if bar_index == 7708 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 3182" + "\nDII + 2831", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) //---- data143 = if bar_index == 7709 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 3566" + "\nDII + 2815", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data144 = if bar_index == 7710 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 4313" + "\nDII + 3808", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data145 = if bar_index == 7711 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 3358" + "\nDII + 2588", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data146 = if bar_index == 7712 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 3123" + "\nDII + 1929", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data147 = if bar_index == 7713 // label.new(bar_index, na, color = selectedColor, style=label.style_label_up, text="FII -- 7819" + "\nDII + 6087\n March also they sold & then market went up", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) label.new(bar_index, low, color = color.black, style=label.style_label_up,text="FII -- 8593" + "\nDII + 6097\n\n8th March also FII sold worth -8143\n&\nthen market went up", textcolor = selectedColor, textalign = myTextAlign, size = size.normal) data148 = if bar_index == 7714 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 342" + "\nDII + 2093", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data149 = if bar_index == 7715 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1177" + "\nDII + 3066", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data150 = if bar_index == 7716 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 2921" + "\nDII + 1859", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data151 = if bar_index == 7717 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 2010" + "\nDII + 2438", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data152 = if bar_index == 7718 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 2109" + "\nDII + 2213", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data153 = if bar_index == 7719 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1278" + "\nDII + 1184", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data154 = if bar_index == 7720 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 853" + "\nDII + 1206", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data155 = if bar_index == 7721 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 309" + "\nDII + 847", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data156 = if bar_index == 7722 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 261" + "\nDII + 1378", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data157 = if bar_index == 7723 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 2857" + "\nDII + 1311", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data158 = if bar_index == 7724 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1434" + "\nDII + 1688", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data159 = if bar_index == 7725 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 2133" + "\nDII -- 258", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data160 = if bar_index == 7726 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 795" + "\nDII + 1464", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data161 = if bar_index == 7727 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 925" + "\nDII + 981", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data162 = if bar_index == 7728 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 119" + "\nDII + 35", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data163 = if bar_index == 7729 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 359" + "\nDII -- 297", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data164 = if bar_index == 7730 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1457" + "\nDII + 141", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data165 = if bar_index == 7731 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 2721" + "\nDII + 1799", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data166 = if bar_index == 7732 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 363" + "\nDII -- 556", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) // data167 = if bar_index == 7733 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1653" + "\nDII + 1059", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data168 = if bar_index == 7734 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 220" + "\nDII + 844", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data169 = if bar_index == 7735 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 1059" + "\nDII - 101", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data170 = if bar_index == 7736 label.new(bar_index, na, color = selectedColor, style=label.style_diamond, text="FII + 7012" + "\nDII - 230", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data171 = if bar_index == 7737 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 1875" + "\nDII - 312", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data172 = if bar_index == 7738 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 615" + "\nDII + 735", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data173 = if bar_index == 7739 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 855" + "\nDII -- 72", textcolor = bothSelling, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data174 = if bar_index == 7740 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1278" + "\nDII + 999", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data175 = if bar_index == 7741 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 94" + "\nDII + 712", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data176 = if bar_index == 7742 label.new(bar_index, na, color = selectedColor, style=label.style_diamond,text="FII + 6451" + "\nDII + 600", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data177 = if bar_index == 7743 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 1470" + "\nDII -- 1", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data178 = if bar_index == 7744 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 5347" + "\nDII -- 822", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data179 = if bar_index == 7745 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 1663" + "\nDII + 118", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data180 = if bar_index == 7746 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 3968" + "\nDII -- 518", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data181 = if bar_index == 7747 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 1728" + "\nDII -- 47", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data182 = if bar_index == 7748 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 1606" + "\nDII -- 496", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data183 = if bar_index == 7749 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 1574" + "\nDII -- 141", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data184 = if bar_index == 7750 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 2455" + "\nDII -- 768", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data185 = if bar_index == 7751 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 2249" + "\nDII -- 730", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data186 = if bar_index == 7752 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 3040" + "\nDII -- 839", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data187 = if bar_index == 7753 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 1377" + "\nDII -- 136", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data188 = if bar_index == 7754 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 4308" + "\nDII -- 510", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data189 = if bar_index == 7755 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 3457" + "\nDII + 471", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data190 = if bar_index == 7756 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 1111" + "\nDII -- 1633", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data191 = if bar_index == 7757 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 346" + "\nDII -- 85", textcolor = bothSelling, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data192 = if bar_index == 7758 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 1058" + "\nDII -- 215", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data193 = if bar_index == 7759 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 168" + "\nDII -- 322", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data194 = if bar_index == 7760 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 2361" + "\nDII -- 334", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data195 = if bar_index == 7761 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 51" + "\nDII + 454", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data196 = if bar_index == 7762 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 561" + "\nDII + 144", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data197 = if bar_index == 7763 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 4166" + "\nDII -- 657", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data198 = if bar_index == 7764 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 2297" + "\nDII -- 951", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data199 = if bar_index == 7765 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 9" + "\nDII -- 669", textcolor = bothSelling, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data200 = if bar_index == 7766 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 812" + "\nDII + 534", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data201 = if bar_index == 7767 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 1705" + "\nDII + 633", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data202 = if bar_index == 7768 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 111" + "\nDII -- 139", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data203 = if bar_index == 7769 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 2836" + "\nDII -- 213", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data204 = if bar_index == 7770 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 2275" + "\nDII -- 1168", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data205 = if bar_index == 7771 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 1696" + "\nDII -- 891", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data206 = if bar_index == 7772 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 1957" + "\nDII -- 1268", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data207 = if bar_index == 7773 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1375" + "\nDII + 188", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data208 = if bar_index == 7774 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 679" + "\nDII -- 929", textcolor = bothSelling, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data209 = if bar_index == 7775 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 3260" + "\nDII -- 37", textcolor = bothSelling, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data210 = if bar_index == 7776 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 732" + "\nDII -- 95", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data211 = if bar_index == 7777 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 1196" + "\nDII + 132", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data212 = if bar_index == 7778 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 278" + "\nDII + 539", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data213 = if bar_index == 7779 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 2227" + "\nDII + 263", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data214 = if bar_index == 7780 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 2900" + "\nDII + 299", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data215 = if bar_index == 7781 label.new(bar_index, na, color = downArrow, style=label.style_triangledown,text="FII -- 5101" + "\nDII + 3532", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data216 = if bar_index == 7782 label.new(bar_index, na, color = downArrow, style=label.style_none,text="FII -- 3040" + "\nDII + 3505", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data217 = if bar_index == 7783 label.new(bar_index, na, color = downArrow, style=label.style_none,text="FII -- 2096" + "\nDII + 2544", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data218 = if bar_index == 7784 label.new(bar_index, na, color = downArrow, style=label.style_none,text="FII -- 3873" + "\nDII + 3162", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data219 = if bar_index == 7785 label.new(bar_index, na, color = downArrow, style=label.style_none,text="FII -- 1522" + "\nDII + 3245", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data220 = if bar_index == 7786 label.new(bar_index, na, color = downArrow, style=label.style_none,text="FII + 1278" + "\nDII -- 423", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data221 = if bar_index == 7787 label.new(bar_index, na, color = downArrow, style=label.style_none,text="FII + 1345" + "\nDII + 946", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data222 = if bar_index == 7788 label.new(bar_index, na, color = downArrow, style=label.style_none,text="FII + 749" + "\nDII -- 44", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data223 = if bar_index == 7789 label.new(bar_index, na, color = downArrow, style=label.style_none,text="FII -- 2251" + "\nDII + 545", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data224 = if bar_index == 7790 label.new(bar_index, na, color = downArrow, style=label.style_none,text="FII -- 2139" + "\nDII + 2137", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data225 = if bar_index == 7791 label.new(bar_index, na, color = downArrow, style=label.style_triangledown,text="FII -- 4613" + "\nDII + 2431", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data226 = if bar_index == 7792 label.new(bar_index, na, color = downArrow, style=label.style_none,text="FII -- 357" + "\nDII + 85", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data227 = if bar_index == 7793 label.new(bar_index, na, color = downArrow, style=label.style_none,text="FII -- 1107" + "\nDII + 753", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data228 = if bar_index == 7794 label.new(bar_index, na, color = downArrow, style=label.style_none,text="FII -- 1011" + "\nDII + 1624", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data229 = if bar_index == 7795 label.new(bar_index, na, color = downArrow, style=label.style_none,text="FII -- 184" + "\nDII + 1582", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data230 = if bar_index == 7796 label.new(bar_index, na, color = downArrow, style=label.style_none,text="FII + 858" + "\nDII + 2085", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data231 = if bar_index == 7797 label.new(bar_index, na, color = downArrow, style=label.style_none,text="FII -- 381" + "\nDII + 908", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data232 = if bar_index == 7798 label.new(bar_index, na, color = downArrow, style=label.style_none,text="FII + 1687" + "\nDII -- 887", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data233 = if bar_index == 7799 label.new(bar_index, na, color = downArrow, style=label.style_none,text="FII + 439" + "\nDII -- 119", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data234 = if bar_index == 7800 label.new(bar_index, na, color = downArrow, style=label.style_none,text="FII + 576" + "\nDII + 80 ", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data235 = if bar_index == 7801 label.new(bar_index, na, color = downArrow, style=label.style_none,text="FII + 331" + "\nDII + 873 ", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data236 = if bar_index == 7802 label.new(bar_index, na, color = downArrow, style=label.style_none,text="FII + 2818" + "\nDII -- 1580", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data237 = if bar_index == 7803 label.new(bar_index, na, color = downArrow, style=label.style_none,text="FII + 1578" + "\nDII -- 613", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data238 = if bar_index == 7804 label.new(bar_index, na, color = selectedColor, style=label.style_diamond,text="FII + 6916" + "\nDII -- 1107", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data239 = if bar_index == 7805 label.new(bar_index, na, color = selectedColor, style=label.style_diamond,text="FII + 6913" + "\nDII -- 730", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data240 = if bar_index == 7806 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 1392" + "\nDII -- 1378", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data241 = if bar_index == 7807 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 778" + "\nDII -- 732", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data242 = if bar_index == 7808 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 1436" + "\nDII -- 549", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data243 = if bar_index == 7809 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 1942" + "\nDII -- 844", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data244 = if bar_index == 7810 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 546" + "\nDII -- 1060", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data245 = if bar_index == 7811 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 388" + "\nDII -- 967", textcolor = bothSelling, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data246 = if bar_index == 7812 label.new(bar_index, na, color = selectedColor, style=label.style_diamond, text="FII + 3958" + "\nDII + 616", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data247 = if bar_index == 7813 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 2993" + "\nDII + 47", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data248 = if bar_index == 7814 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 126" + "\nDII -- 549", textcolor = bothSelling, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data249 = if bar_index == 7815 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 39" + "\nDII + 1437", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data250 = if bar_index == 7816 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 1583" + "\nDII + 449", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data251 = if bar_index == 7817 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 272" + "\nDII + 890", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) //////////// data252 = if bar_index == 7818 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1221" + "\nDII + 1263", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data253 = if bar_index == 7819 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 237" + "\nDII + 636", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data254 = if bar_index == 7820 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII -- 1803" + "\nDII + 414", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data255 = if bar_index == 7821 label.new(bar_index, na, color = selectedColor, style=label.style_diamond,text="FII + 4234" + "\nDII -- 236", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data256 = if bar_index == 7822 label.new(bar_index, na, color = selectedColor, style=label.style_none,text="FII + 369" + "\nDII -- 296", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) // data257 = if bar_index == 7823 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 2615" + "\nDII +88", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data258 = if bar_index == 7824 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 129" + "\nDII -- 744", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data259 = if bar_index == 7825 label.new(bar_index, na, color = color.black, style=label.style_label_down, text="FII + 8913 Huge" + "\nDII -- 4056", textcolor = selectedColor, textalign = myTextAlign, size = size.normal, yloc = yloc.abovebar) data260 = if bar_index == 7826 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1475" + "\nDII + 2665", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data261 = if bar_index == 7827 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 215" + "\nDII + 712", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data262 = if bar_index == 7828 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 894" + "\nDII + 2608", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data263 = if bar_index == 7829 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 257" + "\nDII -- 559", textcolor = bothSelling, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data264 = if bar_index == 7830 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1382" + "\nDII + 389", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data265 = if bar_index == 7831 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 779" + "\nDII + 772", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data266 = if bar_index == 7832 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 158" + "\nDII + 502", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data267 = if bar_index == 7833 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 3615" + "\nDII + 696", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data268 = if bar_index == 7834 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 669" + "\nDII + 37", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data269 = if bar_index == 7835 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 331" + "\nDII + 926", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data270 = if bar_index == 7836 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 1538" + "\nDII + 261", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data271 = if bar_index == 7837 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1975" + "\nDII + 1543", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data272 = if bar_index == 7838 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 138" + "\nDII + 687", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data273 = if bar_index == 7839 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 1218" + "\nDII + 495", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data274 = if bar_index == 7840 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 499" + "\nDII + 1757", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data275 = if bar_index == 7841 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 1158" + "\nDII + 2207", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data276 = if bar_index == 7842 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 707" + "\nDII + 3399", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data277 = if bar_index == 7843 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 498" + "\nDII + 1286", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data278 = if bar_index == 7844 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 162" + "\nDII + 622", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data279 = if bar_index == 7845 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 428" + "\nDII + 373", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data280 = if bar_index == 7846 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 469" + "\nDII + 516", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data281 = if bar_index == 7847 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII --2951" + "\nDII + 2266", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data282 = if bar_index == 7848 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII --213" + "\nDII + 743", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data283 = if bar_index == 7849 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII --256" + "\nDII + 351", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data284 = if bar_index == 7850 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII --2621" + "\nDII + 774", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data285 = if bar_index == 7851 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII --1256" + "\nDII -- -194", textcolor = bothSelling, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data286 = if bar_index == 7852 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII --2676" + "\nDII + 1083", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data287 = if bar_index == 7853 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 57" + "\nDII + 1724", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data288 = if bar_index == 7854 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 2109" + "\nDII + 1807", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data289 = if bar_index == 7855 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 3405" + "\nDII + 2431", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data290 = if bar_index == 7856 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1347" + "\nDII + 2128", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data291 = if bar_index == 7857 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 3739" + "\nDII + 1953", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data292 = if bar_index == 7858 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 1571" + "\nDII + 686", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data293 = if bar_index == 7859 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 211" + "\nDII + 91", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data294 = if bar_index == 7860 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 55" + "\nDII + 1226", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data295 = if bar_index == 7861 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 588" + "\nDII -- 129", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data296 = if bar_index == 7862 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 2002" + "\nDII + 1510", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data297 = if bar_index == 7863 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 224" + "\nDII + 435", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data298 = if bar_index == 7864 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 114" + "\nDII + 1145", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data299 = if bar_index == 7865 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 257" + "\nDII + 1378", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data300 = if bar_index == 7866 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 5978" + "\nDII + 4252", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data301 = if bar_index == 7867 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 5693" + "\nDII + 4568", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data302 = if bar_index == 7868 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 4658" + "\nDII + 4506", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data303 = if bar_index == 7869 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 2543" + "\nDII + 529", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data304 = if bar_index == 7870 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 3065" + "\nDII + 2371", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data305 = if bar_index == 7871 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 932" + "\nDII + 1265", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data306 = if bar_index == 7872 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1218" + "\nDII + 1203", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data307 = if bar_index == 7873 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 2560" + "\nDII + 640", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data308 = if bar_index == 7874 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 737" + "\nDII + 941", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data309 = if bar_index == 7875 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 145" + "\nDII -- 205", textcolor = bothSelling, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data310 = if bar_index == 7876 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 1458" + "\nDII -- 291", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data311 = if bar_index == 7877 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 1322" + "\nDII + 522", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data312 = if bar_index == 7878 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 1305" + "\nDII + 205", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data313 = if bar_index == 7879 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 432" + "\nDII + 517", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data314 = if bar_index == 7880 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 1571" + "\nDII + 1577", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data315 = if bar_index == 7881 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 625" + "\nDII -- 85", textcolor = bothSelling, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data316 = if bar_index == 7882 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 159" + "\nDII + 86", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data317 = if bar_index == 7883 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 526" + "\nDII -- 235", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data318 = if bar_index == 7884 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 580" + "\nDII + 372", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data319 = if bar_index == 7885 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1417" + "\nDII + 1586", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data320 = if bar_index == 7886 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1470" + "\nDII + 1401", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data321 = if bar_index == 7887 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 2023" + "\nDII + 2232", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data322 = if bar_index == 7888 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 4559" + "\nDII + 4610", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data323 = if bar_index == 7889 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 425" + "\nDII + 1499", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data324 = if bar_index == 7890 label.new(bar_index, na, color = selectedColor, style=label.style_triangleup, text="FII + 12771" + "\nDII + 2129", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data325 = if bar_index == 7891 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 246" + "\nDII + 2090", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data326 = if bar_index == 7892 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 866" + "\nDII + 757", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data327 = if bar_index == 7893 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 3672" + "\nDII -- 938", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data328 = if bar_index == 7894 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 561" + "\nDII + 42", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data329 = if bar_index == 7895 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 2061" + "\nDII + 1350", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data330 = if bar_index == 7896 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1547" + "\nDII + 1419", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data331 = if bar_index == 7897 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 2209" + "\nDII + 2124", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data332 = if bar_index == 7898 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1247" + "\nDII + 1824", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data333 = if bar_index == 7899 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 167" + "\nDII + 2051", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data334 = if bar_index == 7900 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1767" + "\nDII + 1817", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data335 = if bar_index == 7901 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1906" + "\nDII + 2877", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data336 = if bar_index == 7902 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1455" + "\nDII + 1946", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data337 = if bar_index == 7903 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1044" + "\nDII + 384", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data338 = if bar_index == 7904 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 995" + "\nDII + 1669", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data339 = if bar_index == 7905 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1457" + "\nDII + 2556", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data340 = if bar_index == 7906 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 623" + "\nDII + 1809", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data341 = if bar_index == 7907 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 1947" + "\nDII -- 156", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data342 = if bar_index == 7908 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 1245" + "\nDII + 823", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data343 = if bar_index == 7909 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 2366" + "\nDII + 2480", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data344 = if bar_index == 7910 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 322" + "\nDII -- 328", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data345 = if bar_index == 7911 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 822" + "\nDII -- 947", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data346 = if bar_index == 7912 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 476" + "\nDII -- 997", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data347 = if bar_index == 7913 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 1383" + "\nDII + 352", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data348 = if bar_index == 7914 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 1030" + "\nDII -- 264", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data349 = if bar_index == 7915 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 2152" + "\nDII -- 225", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data350 = if bar_index == 7916 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 222" + "\nDII -- 274", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data351 = if bar_index == 7917 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 422" + "\nDII + 270", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data352 = if bar_index == 7918 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 522" + "\nDII + 402", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data353 = if bar_index == 7919 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 170" + "\nDII -- 110", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data354 = if bar_index == 7920 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 968" + "\nDII + 833", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data355 = if bar_index == 7921 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 2117" + "\nDII + 1633", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data356 = if bar_index == 7922 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 336" + "\nDII + 1177", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data357 = if bar_index == 7923 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 362" + "\nDII + 564", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data358 = if bar_index == 7924 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 1257" + "\nDII -- 228", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data359 = if bar_index == 7925 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 3936" + "\nDII + 97", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data360 = if bar_index == 7926 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 3304" + "\nDII + 264", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data361 = if bar_index == 7927 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 2992" + "\nDII -- 384", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data362 = if bar_index == 7928 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 1389" + "\nDII -- 584", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data363 = if bar_index == 7929 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 1415" + "\nDII + 442", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data364 = if bar_index == 7930 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 778" + "\nDII -- 2199", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data365 = if bar_index == 7931 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 3163" + "\nDII + 245", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data366 = if bar_index == 7932 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 1942" + "\nDII + 405", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data367 = if bar_index == 7933 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 1833" + "\nDII -- 790", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data368 = if bar_index == 7934 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 990" + "\nDII -- 200", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data369 = if bar_index == 7935 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 1014" + "\nDII -- 922", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data370 = if bar_index == 7936 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 1685" + "\nDII + 191", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data371 = if bar_index == 7937 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 1407" + "\nDII -- 886", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data372 = if bar_index == 7938 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 149" + "\nDII -- 204", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data373 = if bar_index == 7939 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 1805" + "\nDII - 850", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data374 = if bar_index == 7940 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 113" + "\nDII + 1071", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data375 = if bar_index == 7941 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 923" + "\nDII + 605", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data376 = if bar_index == 7942 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 183" + "\nDII + 397", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data377 = if bar_index == 7943 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 1498" + "\nDII + 301", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data378 = if bar_index == 7944 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 2512" + "\nDII + 338", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data379 = if bar_index == 7945 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 350" + "\nDII + 1841", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data380 = if bar_index == 7946 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 2290" + "\nDII + 854", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data381 = if bar_index == 7947 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 2086" + "\nDII -- 439", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data382 = if bar_index == 7948 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 3406" + "\nDII -- 2529", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data383 = if bar_index == 7949 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 2652" + "\nDII + 489", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data384 = if bar_index == 7950 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 643" + "\nDII + 582", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data385 = if bar_index == 7951 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 701" + "\nDII + 1196", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data386 = if bar_index == 7952 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 111" + "\nDII -- 489", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data387 = if bar_index == 7953 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 1446" + "\nDII + 392", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data388 = if bar_index == 7954 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 613" + "\nDII -- 405", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data389 = if bar_index == 7955 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 309" + "\nDII + 1246", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data390 = if bar_index == 7956 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 594" + "\nDII + 1794", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data391 = if bar_index == 7957 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 2200" + "\nDII -- 203", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data392 = if bar_index == 7958 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 1863" + "\nDII -- 655", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data393 = if bar_index == 7959 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 3282" + "\nDII -- 298", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data394 = if bar_index == 7960 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 181" + "\nDII + 681", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data395 = if bar_index == 7961 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1031" + "\nDII -- 365", textcolor = bothSelling, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data396 = if bar_index == 7962 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1943" + "\nDII + 1973", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data397 = if bar_index == 7963 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 4013" + "\nDII + 550", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data398 = if bar_index == 7964 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 693" + "\nDII + 219", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data399 = if bar_index == 7965 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 344" + "\nDII -- 684", textcolor = bothSelling, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data400 = if bar_index == 7966 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 409" + "\nDII + 250", textcolor = bothSelling, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data401 = if bar_index == 7967 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 2024" + "\nDII -- 1991", textcolor = bothSelling, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data402 = if bar_index == 7968 label.new(bar_index, na, color = selectedColor, style=label.style_triangleup, text="𝗙𝗜𝗜 + 𝟭𝟮,𝟯𝟱𝟬 𝗠𝗮𝘀𝘀𝗶𝘃𝗲\n2nd March also above\n12K buying done" + "\n\nDII -- 1021", textcolor = bothSelling, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data403 = if bar_index == 7969 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 6398" + "\nDII + 1198", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data404 = if bar_index == 7970 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 1196" + "\nDII -- 338", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data405 = if bar_index == 7971 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 2134" + "\nDII -- 785", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data406 = if bar_index == 7972 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 2290" + "\nDII -- 439", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data407 = if bar_index == 7973 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 2833" + "\nDII -- 2352", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data408 = if bar_index == 7974 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 871" + "\nDII -- 2964", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data409 = if bar_index == 7975 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 1059" + "\nDII + 288", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data410 = if bar_index == 7976 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 1469" + "\nDII -- 7", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data411 = if bar_index == 7977 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1242" + "\nDII + 437", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) // data412 = if bar_index == 7978 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 2238" + "\nDII -- 1197", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data413 = if bar_index == 7979 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 2636" + "\nDII -- 772", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data414 = if bar_index == 7980 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 73" + "\nDII + 64", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data415 = if bar_index == 7981 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 2116" + "\nDII -- 1317", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data416 = if bar_index == 7982 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 1166" + "\nDII -- 2135", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data417 = if bar_index == 7983 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 3371" + "\nDII -- 193", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data418 = if bar_index == 7984 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1999" + "\nDII + 1291", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data419 = if bar_index == 7985 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 83" + "\nDII + 934", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data420 = if bar_index == 7986 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 1089" + "\nDII -- 334", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data421 = if bar_index == 7987 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 923" + "\nDII + 470", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data422 = if bar_index == 7988 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 3979" + "\nDII + 2528", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data423 = if bar_index == 7989 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1024" + "\nDII + 1634", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data424 = if bar_index == 7990 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 702" + "\nDII + 2488", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data425 = if bar_index == 7991 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 93" + "\nDII + 1036", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data426 = if bar_index == 7992 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1878" + "\nDII -- 2", textcolor = bothSelling, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data427 = if bar_index == 7993 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 317" + "\nDII + 1729", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data428 = if bar_index == 7994 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 556" + "\nDII + 367", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data429 = if bar_index == 7995 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1893" + "\nDII + 1081", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data430 = if bar_index == 7996 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 711" + "\nDII + 537", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data431 = if bar_index == 7997 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 644" + "\nDII -- 598", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data432 = if bar_index == 7998 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 331" + "\nDII + 704", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data433 = if bar_index == 7999 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 3073" + "\nDII + 500", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data434 = if bar_index == 8000 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 2324" + "\nDII + 1461", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data435 = if bar_index == 8001 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 723" + "\nDII + 2406", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data436 = if bar_index == 8002 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1511" + "\nDII -- 314", textcolor = bothSelling, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data437 = if bar_index == 8003 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 267" + "\nDII + 339", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data438 = if bar_index == 8004 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1901" + "\nDII + 626", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data439 = if bar_index == 8005 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 495" + "\nDII + 534", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data440 = if bar_index == 8006 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 624" + "\nDII + 125", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data441 = if bar_index == 8007 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 1525" + "\nDII + 5797", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data442 = if bar_index == 8008 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 4638" + "\nDII + 1414", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data443 = if bar_index == 8009 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1393" + "\nDII + 1264", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data444 = if bar_index == 8010 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 62" + "\nDII + 305", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data445 = if bar_index == 8011 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 495" + "\nDII + 1323", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data446 = if bar_index == 8012 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 2973" + "\nDII + 4383", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data447 = if bar_index == 8013 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 488" + "\nDII + 2295", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data448 = if bar_index == 8014 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 3368" + "\nDII + 2563", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data449 = if bar_index == 8015 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1725" + "\nDII + 1078", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data450 = if bar_index == 8016 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 3246" + "\nDII -- 247", textcolor = bothSelling, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data451 = if bar_index == 8017 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 759" + "\nDII + 28", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data452 = if bar_index == 8018 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 224" + "\nDII + 1150", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data453 = if bar_index == 8019 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 1473" + "\nDII + 366", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data454 = if bar_index == 8020 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1047" + "\nDII + 260", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data455 = if bar_index == 8021 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1632" + "\nDII + 850", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data456 = if bar_index == 8022 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 295" + "\nDII -- 51", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data457 = if bar_index == 8023 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 164" + "\nDII + 1939", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data458 = if bar_index == 8024 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1237" + "\nDII + 553", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data459 = if bar_index == 8025 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 3110" + "\nDII -- 573", textcolor = bothSelling, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data460 = if bar_index == 8026 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 3007" + "\nDII + 1158", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data461 = if bar_index == 8027 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1327" + "\nDII + 801", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data462 = if bar_index == 8028 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 2333" + "\nDII + 1579", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data463 = if bar_index == 8029 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 693" + "\nDII + 714", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data464 = if bar_index == 8030 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 354" + "\nDII + 386", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data465 = if bar_index == 8031 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 3364" + "\nDII + 2711", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data466 = if bar_index == 8032 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1686" + "\nDII + 2751", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data467 = if bar_index == 8033 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 2034" + "\nDII + 1361", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data468 = if bar_index == 8034 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 4424" + "\nDII + 1769", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data469 = if bar_index == 8035 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1864" + "\nDII + 521", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data470 = if bar_index == 8036 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 90" + "\nDII + 783", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data471 = if bar_index == 8037 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 998" + "\nDII + 2661", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data472 = if bar_index == 8038 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1005" + "\nDII + 1963", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data473 = if bar_index == 8039 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 422" + "\nDII + 1032", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data474 = if bar_index == 8040 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1863" + "\nDII + 1532", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data475 = if bar_index == 8041 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 317" + "\nDII -- 103", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data476 = if bar_index == 8042 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 593" + "\nDII + 1184", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data477 = if bar_index == 8043 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 264" + "\nDII + 113", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data478 = if bar_index == 8044 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1832" + "\nDII + 1470", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data479 = if bar_index == 8045 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1093" + "\nDII + 736", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data480 = if bar_index == 8046 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 456" + "\nDII + 9", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data481 = if bar_index == 8047 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 252" + "\nDII + 1112", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data482 = if bar_index == 8048 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 4237" + "\nDII + 3569", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) str_data_Analysis = "Previous data analysis:\n25th Jan 2022 FII Sold worth 7K market went up ↑.\n 8th March 2022 FII Sold worth 8K market went up ↑.\n 17th June 2022 FII Sold worth 8K+ market went up ↑.\n\n 30th Nov 2022 FII Bought worth 8K market went down nicely ↓\n\n 26th Oct 2023 FII Sold worth 7K guess it & play well. \n" data483 = if bar_index == 8049 // label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 7702" + "\nDII + 6558", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) label.new(bar_index, low, color = color.black, style=label.style_label_up,text="FII -- 7702" + "\nDII + 6558\n", tooltip = str_data_Analysis, textcolor = selectedColor, textalign = myTextAlign, size = size.normal) data484 = if bar_index == 8050 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1500" + "\nDII + 313", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data485 = if bar_index == 8051 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1762" + "\nDII + 1328", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data486 = if bar_index == 8052 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 696" + "\nDII + 340", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data487 = if bar_index == 8053 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1817" + "\nDII + 1622", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data488 = if bar_index == 8054 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1251" + "\nDII + 1380", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data489 = if bar_index == 8055 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 12" + "\nDII + 403", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data490 = if bar_index == 8056 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 549" + "\nDII + 596", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data491 = if bar_index == 8057 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 497" + "\nDII + 700", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data492 = if bar_index == 8058 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 85" + "\nDII + 524", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data493 = if bar_index == 8059 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1712" + "\nDII + 1512", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data494 = if bar_index == 8060 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 262" + "\nDII + 823", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data495 = if bar_index == 8061 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 190" + "\nDII + 95", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data496 = if bar_index == 8062 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 1244" + "\nDII + 830", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data497 = if bar_index == 8063 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 550" + "\nDII + 610", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data498 = if bar_index == 8064 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII +957" + "\nDII + 706", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data499 = if bar_index == 8065 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 478" + "\nDII -- 565", textcolor = bothSelling, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data500 = if bar_index == 8066 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 646" + "\nDII + 78", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data501 = if bar_index == 8067 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 456" + "\nDII + 722", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data502 = if bar_index == 8068 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII -- 306" + "\nDII + 721", textcolor = selectedColor, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data503 = if bar_index == 8069 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 256" + "\nDII + 457", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) data504 = if bar_index == 8070 label.new(bar_index, na, color = selectedColor, style=label.style_none, text="FII + 2625" + "\nDII + 134", textcolor = bothBuying, textalign = myTextAlign, size = labelSize, yloc = yloc.abovebar) var table atrDisplay = table.new(tableYposInput + "_" + tableXposInput, 1, 1) // {0, number, #.####} myStr = " Net FII " + str.format("{0}", netFII) + " crores" + "\nDII +" + str.format("{0}", netDII) + " crores\n\n" + "Nov FII " + str.format("{0}", nov23FII) + " crores" + "\n" + "Nov DII " + str.format("{0}", nov23DII) + " crores" + "\n\n" + "Oct FII " + str.format("{0}", oct23FII) + " crores" + "\n" + "Oct DII " + str.format("{0}", oct23DII) + " crores" + "\n\n" + "Sep FII " + str.format("{0}", sep23FII) + " crores" + "\n" + "Sep DII " + str.format("{0}", sep23DII) + " crores" + "\n\n" + "Aug FII " + str.format("{0}", aug23FII) + " crores" + "\n" + "Aug DII " + str.format("{0}", aug23DII) + " crores" + "\n\n" // "July FII " + str.format("{0}", july23FII) + " crores" + "\n" + "July DII " + str.format("{0}", july23DII) + " crores" + "\n\n" // "June FII " + str.format("{0}", june23FII) + " crores" + "\n" + "June DII " + str.format("{0}", june23DII) + " crores" + "\n\n" // "May FII " + str.format("{0}", may23FII) + " crores" + "\n" + "May DII " + str.format("{0}", may23DII) + " crores" + "\n\n" // "April FII " + str.format("{0}", apr23FII) + " crores" + "\n" + "April DII " + str.format("{0}", apr23DII) + " crores" + "\n\n" // "March FII " + str.format("{0}", mar23FII) + " crores" + "\n" + "March DII " + str.format("{0}", mar23DII) + " crores" + "\n\n" // "Feb FII " + str.format("{0}", feb23FII) + " crores" + "\n" + "Feb DII " + str.format("{0}", feb23DII) + " crores" + "\n\n" // "Jan FII " + str.format("{0}", jan23FII) + " crores" + "\n" + "Jan DII " + str.format("{0}", jan23DII) + " crores" + "\n\n" // "Dec FII " + str.format("{0}", decFII) + " crores" + "\n" + "Dec DII " + str.format("{0}", decDII) + " crores" + "\n\n" // "Nov FII " + str.format("{0}", novFII) + " crores" + "\n" + "Nov DII " + str.format("{0}", novDII) + " crores" // + // "Oct FII " + str.format("{0}", octFII) + " crores" + "\n" + "Oct DII " + str.format("{0}", octDII) + " crores" showAllStr = " Net FII " + str.format("{0}", netFII) + " crores" + "\nDII +" + str.format("{0}", netDII) + " crores\n\n" + "Nov FII " + str.format("{0}", nov23FII) + " crores" + "\n" + "Nov DII " + str.format("{0}", nov23DII) + " crores" + "\n\n" + "Oct FII " + str.format("{0}", oct23FII) + " crores" + "\n" + "Oct DII " + str.format("{0}", oct23DII) + " crores" + "\n\n" + "Sep FII " + str.format("{0}", sep23FII) + " crores" + "\n" + "Sep DII " + str.format("{0}", sep23DII) + " crores" + "\n\n" + "Aug FII " + str.format("{0}", aug23FII) + " crores" + "\n" + "Aug DII " + str.format("{0}", aug23DII) + " crores" + "\n\n" + "July FII " + str.format("{0}", july23FII) + " crores" + "\n" + "July DII " + str.format("{0}", july23DII) + " crores" + "\n\n" + "June FII " + str.format("{0}", june23FII) + " crores" + "\n" + "June DII " + str.format("{0}", june23DII) + " crores" + "\n\n" + "May FII " + str.format("{0}", may23FII) + " crores" + "\n" + "May DII " + str.format("{0}", may23DII) + " crores" + "\n\n" + "April FII " + str.format("{0}", apr23FII) + " crores" + "\n" + "April DII " + str.format("{0}", apr23DII) + " crores" + "\n\n" + "March FII " + str.format("{0}", mar23FII) + " crores" + "\n" + "March DII " + str.format("{0}", mar23DII) + " crores" + "\n\n" + "Feb FII " + str.format("{0}", feb23FII) + " crores" + "\n" + "Feb DII " + str.format("{0}", feb23DII) + " crores" + "\n\n" + "Jan FII " + str.format("{0}", jan23FII) + " crores" + "\n" + "Jan DII " + str.format("{0}", jan23DII) + " crores" + "\n\n" + "Dec22 FII " + str.format("{0}", decFII) + " crores" + "\n" + "Dec22 DII " + str.format("{0}", decDII) + " crores" + "\n\n" + "Nov22 FII " + str.format("{0}", novFII) + " crores" + "\n" + "Nov22 DII " + str.format("{0}", novDII) + " crores" // + // "Oct FII " + str.format("{0}", octFII) + " crores" + "\n" + "Oct DII " + str.format("{0}", octDII) + " crores" if barstate.islast // We only populate the table on the last bar. if showAll == false table.cell(atrDisplay, 0, 0, myStr, text_color = color.rgb(210,219,35), text_halign = text.align_right, text_size = size.normal, bgcolor = color.black, text_font_family = font.family_monospace) else if showAll == true table.cell(atrDisplay, 0, 0, showAllStr, text_color = color.rgb(210,219,35), text_halign = text.align_right, text_size = size.normal, bgcolor = color.black, text_font_family = font.family_monospace)
Ichimoku Support and Resistance by TheSocialCryptoClub
https://www.tradingview.com/script/H4FHpkxi-Ichimoku-Support-and-Resistance-by-TheSocialCryptoClub/
TheSocialCryptoClub
https://www.tradingview.com/u/TheSocialCryptoClub/
102
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © TheSocialCryptoClub //@version=5 indicator("Ichimoku Support and Resistance", shorttitle="Ichimoku SR", overlay=true) // functions donchian(len) => math.avg(ta.lowest(len), ta.highest(len)) fromDay = input.int(defval = 2, title = "From Day") fromMonth = input.int(defval = 1, title = "From Month") fromYear = input.int(defval = 2019, title = "From Year") thruDay = input.int(defval = 1, title = "To Day") thruMonth = input.int(defval = 1, title = "To Month") thruYear = input.int(defval = 2112, title = "To Year") start = timestamp(fromYear, fromMonth, fromDay, 00, 00) // backtest start window finish = timestamp(thruYear, thruMonth, thruDay, 23, 59) // backtest finish window window() => time >= start and time <= finish ? true : false // create function "within window of time" // input declarations tenkan_len = input.int(9, title="Tenkan Length") kijun_len = input.int(26, title="Kijun Length") senkou_b_len = input.int(52, title="Seknou Span B Lenght") higher_timeframe = input.timeframe("W", "Higher Timeframe") tenkan_show = input.bool(true, title="Show Tenkan SR") kijun_show = input.bool(true, title="Show Kijun SR") senkou_a_show = input.bool(true, title="Show Senkou Span A SR") senkou_b_show = input.bool(true, title="Show Senkou Span B SR") tenkan = donchian(tenkan_len) kijun = donchian(kijun_len) senkou_a = math.avg(tenkan, kijun) senkou_b = donchian(senkou_b_len) chikou = close tenkan_high = request.security(syminfo.tickerid,higher_timeframe,donchian(tenkan_len)) kijun_high = request.security(syminfo.tickerid,higher_timeframe,donchian(kijun_len)) senkou_a_high = request.security(syminfo.tickerid,higher_timeframe,math.avg(tenkan_high, kijun_high)) senkou_b_high = request.security(syminfo.tickerid,higher_timeframe, donchian(senkou_b_len)) chikou_high = request.security(syminfo.tickerid,higher_timeframe,close) var sr = array.new_float(0) array.push(sr, 0.0) // initialization if tenkan_high == tenkan_high[1] and window() and not array.includes(sr, tenkan_high) and tenkan_show array.push(sr, tenkan_high) if kijun_high == kijun_high[1] and window() and not array.includes(sr, kijun_high) and kijun_show array.push(sr, kijun_high) if senkou_a_high == senkou_a_high[1] and window() and not array.includes(sr, senkou_a_high) and senkou_a_show array.push(sr, senkou_a_high) if senkou_b_high == senkou_b_high[1] and window() and not array.includes(sr, senkou_b_high) and senkou_b_show array.push(sr, senkou_b_high) if barstate.islast for i = 0 to array.size(sr)-1 sr_lines = line.new(bar_index, array.get(sr, i), bar_index-1, array.get(sr, i), extend=extend.both)
Chikou Support and Resistance by TheSocialCryptoClub
https://www.tradingview.com/script/Rw0v91VL-Chikou-Support-and-Resistance-by-TheSocialCryptoClub/
TheSocialCryptoClub
https://www.tradingview.com/u/TheSocialCryptoClub/
151
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © TheSocialCryptoClub //@version=5 indicator("Chikou Support and Resistance", shorttitle="Chikou SR", overlay=true, max_lines_count=500, max_labels_count=500) dev_threshold = input.float(title="Zig-Zag Deviation (%)", defval=5.0, minval=0.00001, maxval=100.0) depth = input.int(title="Zig-Zag Depth", defval=10, minval=1) line_color = #2962FF extend_to_last_bar = false display_reversal_price = false display_cumulative_volume = false display_reversal_price_change = false difference_price = input.string("Absolute", "", options=["Absolute", "Percent"], inline="price rev") pivots(src, length, isHigh) => p = nz(src[length]) if length == 0 [bar_index, p] else isFound = true for i = 0 to length - 1 if isHigh and src[i] > p isFound := false if not isHigh and src[i] < p isFound := false for i = length + 1 to 2 * length if isHigh and src[i] >= p isFound := false if not isHigh and src[i] <= p isFound := false if isFound and length * 2 <= bar_index [bar_index[length], p] else [int(na), float(na)] [iH, pH] = pivots(close, math.floor(depth / 2), true) [iL, pL] = pivots(close, math.floor(depth / 2), false) calc_dev(base_price, price) => 100 * (price - base_price) / base_price price_rotation_aggregate(price_rotation, pLast, cum_volume) => str = "" if display_reversal_price str += str.tostring(pLast, format.mintick) + " " if display_reversal_price_change str += price_rotation + " " if display_cumulative_volume str += "\n" + cum_volume str caption(isHigh, iLast, pLast, price_rotation, cum_volume) => price_rotation_str = price_rotation_aggregate(price_rotation, pLast, cum_volume) if display_reversal_price or display_reversal_price_change or display_cumulative_volume if not isHigh label.new(iLast, pLast, text=price_rotation_str, style=label.style_none, yloc=yloc.belowbar, textcolor=color.red) else label.new(iLast, pLast, text=price_rotation_str, style=label.style_none, yloc=yloc.abovebar, textcolor=color.green) price_rotation_diff(pLast, price) => if display_reversal_price_change tmp_calc = price - pLast str = difference_price == "Absolute"? (math.sign(tmp_calc) > 0? "+" : "") + str.tostring(tmp_calc, format.mintick) : (math.sign(tmp_calc) > 0? "+" : "-") + str.tostring((math.abs(tmp_calc) * 100)/pLast, format.percent) str := "(" + str + ")" str else "" volume_sum(index1, index2) => float CVI = 0 for i = index1 + 1 to index2 CVI += volume[bar_index - i] str.tostring(CVI, format.volume) var line lineLast = na var label labelLast = na var int iLast = 0 var float pLast = 0 var bool isHighLast = true // otherwise the last pivot is a low pivot var int linesCount = 0 pivotFound(dev, isHigh, index, price) => if isHighLast == isHigh and not na(lineLast) // same direction if isHighLast ? price > pLast : price < pLast if linesCount <= 1 line.set_xy1(lineLast, index, price) line.set_xy2(lineLast, index, price) label.set_xy(labelLast, index, price) label.set_text(labelLast, price_rotation_aggregate(price_rotation_diff(line.get_y1(lineLast), price), price, volume_sum(line.get_x1(lineLast), index))) [lineLast, labelLast, isHighLast, false] else [line(na), label(na), bool(na), false] else // reverse the direction (or create the very first line) if na(lineLast) id = line.new(index, price, index, price, color=na, width=2) lb = caption(isHigh, index, price, price_rotation_diff(pLast, price), volume_sum(index, index)) [id, lb, isHigh, true] else // price move is significant if math.abs(dev) >= dev_threshold id = line.new(iLast, pLast, index, price, color=na, width=2) lb = caption(isHigh, index, price, price_rotation_diff(pLast, price), volume_sum(iLast, index)) [id, lb, isHigh, true] else [line(na), label(na), bool(na), false] if not na(iH) and not na(iL) and iH == iL dev1 = calc_dev(pLast, pH) [id2, lb2, isHigh2, isNew2] = pivotFound(dev1, true, iH, pH) if isNew2 linesCount := linesCount + 1 if not na(id2) lineLast := id2 labelLast := lb2 isHighLast := isHigh2 iLast := iH pLast := pH dev2 = calc_dev(pLast, pL) [id1, lb1, isHigh1, isNew1] = pivotFound(dev2, false, iL, pL) if isNew1 linesCount := linesCount + 1 if not na(id1) lineLast := id1 labelLast := lb1 isHighLast := isHigh1 iLast := iL pLast := pL else if not na(iH) dev1 = calc_dev(pLast, pH) [id, lb, isHigh, isNew] = pivotFound(dev1, true, iH, pH) if isNew linesCount := linesCount + 1 if not na(id) lineLast := id labelLast := lb isHighLast := isHigh iLast := iH pLast := pH else if not na(iL) dev2 = calc_dev(pLast, pL) [id, lb, isHigh, isNew] = pivotFound(dev2, false, iL, pL) if isNew linesCount := linesCount + 1 if not na(id) lineLast := id labelLast := lb isHighLast := isHigh iLast := iL pLast := pL var line extend_line = na var label extend_label = na if extend_to_last_bar == true and barstate.islast == true isHighLastPoint = not isHighLast curSeries = isHighLastPoint ? high : low if na(extend_line) and na(extend_label) extend_line := line.new(line.get_x2(lineLast), line.get_y2(lineLast), bar_index, curSeries, color=na, width=2, style=line.style_dashed) extend_label := caption(not isHighLast, bar_index, curSeries, price_rotation_diff(line.get_y2(lineLast), curSeries), volume_sum(line.get_x2(lineLast), bar_index)) line.set_xy1(extend_line, line.get_x2(lineLast), line.get_y2(lineLast)) line.set_xy2(extend_line, bar_index, curSeries) label.set_xy(extend_label, bar_index, curSeries) price_rotation = price_rotation_diff(line.get_y1(extend_line), curSeries) volume_cum = volume_sum(line.get_x1(extend_line), bar_index) label.set_text(extend_label, price_rotation_aggregate(price_rotation, curSeries, volume_cum)) label.set_textcolor(extend_label, isHighLastPoint? color.green : color.red) label.set_yloc(extend_label, yloc= isHighLastPoint? yloc.abovebar : yloc.belowbar) var hosoda_lines = array.new_line(10,line.new(0, low, bar_index, high)) if lineLast != array.get(hosoda_lines, array.size(hosoda_lines)-1) array.push(hosoda_lines, lineLast) if barstate.islast for i = 0 to array.size(hosoda_lines)-1 line.new(bar_index, line.get_y2(array.get(hosoda_lines, i)), bar_index-1,line.get_y2(array.get(hosoda_lines, i)), extend=extend.both)
Ganancias y pérdidas
https://www.tradingview.com/script/dRaGYv8D/
abotello
https://www.tradingview.com/u/abotello/
2
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © abotello //@version=5 indicator("Ganancias",overlay=true) comision = input(0.00464) compra_neta = close*(1+comision) //fast = ema(close, 5) //compra_neta = fast*(1+comision) pm2 = compra_neta*(1-0.02)/(1-comision) p0 = compra_neta*(1)/(1-comision) p1 = compra_neta*(1+0.01)/(1-comision) now = close plot(pm2, title="StopLoss", color=color.red, linewidth=2) plot(p0, title="P0", color=color.blue, linewidth=2) plot(p1, title="P1", color=color.green, linewidth=2)
[kai]Keltner&Bolinger
https://www.tradingview.com/script/rT8eaX66/
xinolia
https://www.tradingview.com/u/xinolia/
170
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © xinolia(sakura kai) //@version=5 indicator(title='[kai]Keltner&Bolinger', shorttitle='[kai]Keltner&Bolinger', format=format.price, precision=5, timeframe='', timeframe_gaps=true, overlay=true) volType = input.session('*ochl', title='* volume type 出来高の種別', options=['none', '*source', '*ochl', '*log ohcl'], tooltip = "ex. BTCUSD none=BTCvolume, source * volume,USD volume, vertual volume") logmodefg = input.bool(true, title='* log mode log計算', inline = "logmode", tooltip = "Use geometric mean. 幾何平均を使う") vwfg = input.bool(false, title='* Volume weighted 出来高加重', tooltip = "Use volume weighted average. 出来高加重平均を使う") more0fg = true basislength = input.int(20, title='basis Length', minval=1) multBB = input.float(2, title='BB StdDev MultFactor', minval=0, step=0.1) mATRlength = input.int(14, minval=0, title='* mATR length 区間') multKC = input.float(2.0, title='KC MultFactor', minval=0, step=0.1) multipler = input.int(1, minval=1, title='* multipler 倍率', tooltip = "Multiply length by n. For analysis of pseudo-upper leg. lengthをn倍する。疑似上位足の分析用") cvtlogmode(srcVal) => logmodefg ? math.log(srcVal) : srcVal showexp(srcVal) => srcVal2 = logmodefg ? math.exp(srcVal) : srcVal more0fg ? math.max(srcVal2, 0) : srcVal2 showexp2(srcVal) => logmodefg ? math.exp(srcVal) : srcVal source = cvtlogmode(close) noneColor = color.new(color.white, 100) vol = vwfg ? volume : 1.0 //mATR mtr_func(muletiplelen, logfg) => //mTR © sakura kai mhigh = logfg ? math.log(ta.highest(muletiplelen)) : ta.highest(muletiplelen) mlow = logfg ? math.log(ta.lowest(muletiplelen)) : ta.lowest(muletiplelen) mclose = logfg ? math.log(close) : close mtr = math.max(mhigh - mlow, math.abs(mhigh - mclose[muletiplelen]), math.abs(mlow - mclose[muletiplelen])) mtr matr(length, muletiplelen, logfg) => //mdATR © sakura kai mclose = logfg ? math.log(close) : close mTR = mtr_func(multipler, logfg) mAtr = ta.rma(mTR * vol, length * muletiplelen) / ta.rma(vol, length * muletiplelen) //RvMA mAtr = matr(mATRlength, multipler, logmodefg) pine_vwma(x, y) => ta.sma(x * vol, y) / ta.sma(vol, y) stdv(src, len, avg, vol) => std = math.pow(src - avg, 2) * vol for i = 1 to len - 1 by 1 std += math.pow(src[i] - avg, 2) * vol[i] std std := math.sqrt(std / (ta.sma(vol, len) * len)) std // Calculate BB basis = vwfg ? pine_vwma(source, basislength * multipler) : ta.sma(source, basislength * multipler) dev = stdv(source, basislength * multipler, basis, vwfg ? nz(volume, 1.0) : 1.0) upperBB = basis + dev * multBB lowerBB = basis - dev * multBB // Calculate KC upperKC = basis + multKC * mAtr lowerKC = basis - multKC * mAtr //bbw count bbw = nz(dev / mAtr, 1.0) // Calculate squeeze sqzOn = bbw < 0.75 scolorBB = sqzOn ? color.new(color.red, 80) : color.new(color.green, 80) p2 = plot(showexp(upperBB), color=color.red, linewidth=1, title='upperBB') p1 = plot(showexp(upperKC), color=color.blue, linewidth=1, title='upperKC') p0 = plot(showexp(basis), color=color.blue, title='Basis') p3 = plot(showexp(lowerKC), color=color.blue, linewidth=1, title='lowerKC') p4 = plot(showexp(lowerBB), color=color.red, linewidth=1, title='lowerBB') fill(p0, p1, color=upperBB >= upperKC ? (sqzOn? scolorBB : color.new(color.blue,75)) : na) fill(p0, p2, color=upperBB >= upperKC ? na : scolorBB) fill(p1, p2, color=upperBB >= upperKC ? scolorBB : color.new(color.blue,75)) fill(p0, p3, color=lowerBB <= lowerKC ? (sqzOn? scolorBB : color.new(color.blue,75)) : na) fill(p0, p4, color=lowerBB <= lowerKC ? na : scolorBB) fill(p3, p4, color=lowerBB <= lowerKC ? scolorBB : color.new(color.blue,75)) alertcondition(ta.crossover(bbw, 1.0), title='break', message='break!') alertcondition(ta.crossunder(bbw, 1.0), title='close', message='close!')
Margin Zones[kryptodude]
https://www.tradingview.com/script/Of89Iaun-margin-zones-kryptodude/
kryptodude
https://www.tradingview.com/u/kryptodude/
103
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ //@version=4 study(title="Margin Zones[kryptodude]", shorttitle="MultiZones", overlay=true) margin0 = 0 tickCost0 = 0 max0 = 0 min0 = 0 NumberOfDaysAgo=input(defval=1,type=input.integer, minval=0,title="Number of Days Ago") ShwU = input(defval=true, type=input.bool, title="ShowZonesUp") ShwD = input(defval=true, type=input.bool, title="ShowZonesDwn") Show_25 =input(defval=true, type=input.bool, title="+25      ", inline = "2") Show_50 =input(defval=true, type=input.bool, title="+50      ", inline = "2") Show_100=input(defval=true, type=input.bool, title="+100", inline = "2") Show25 = input(defval=true, type=input.bool, title="-25      ", inline = "3") Show50 = input(defval=true, type=input.bool, title="-50      ", inline = "3") Show100= input(defval=true, type=input.bool, title="-100", inline = "3") ticker1 = input(type=input.symbol, defval = "", title = "#1") margin1 = input(defval=0.0,type=input.float, title="Margin") tickCost1 = input(defval=0.0,type=input.float, title="Tick cost") max1 = input(defval=0.0,type=input.float, title="Price max") min1 = input(defval=0.0,type=input.float, title="Price min") ticker2 = input(type=input.symbol, defval = "", title = "#2") margin2 = input(defval=0.0,type=input.float, title="Margin") tickCost2 = input(defval=0.0,type=input.float, title="Tick cost") max2 = input(defval=0.0,type=input.float, title="Price max") min2 = input(defval=0.0,type=input.float, title="Price min") ticker3 = input(type=input.symbol, defval = "", title = "#3") margin3 = input(defval=0.0,type=input.float, title="Margin") tickCost3 = input(defval=0.0,type=input.float, title="Tick cost") max3 = input(defval=0.0,type=input.float, title="Price max") min3 = input(defval=0.0,type=input.float, title="Price min") ticker4 = input(type=input.symbol, defval = "", title = "#4") margin4 = input(defval=0.0,type=input.float, title="Margin") tickCost4 = input(defval=0.0,type=input.float, title="Tick cost") max4 = input(defval=0.0,type=input.float, title="Price max") min4 = input(defval=0.0,type=input.float, title="Price min") ticker5 = input(type=input.symbol, defval = "", title = "#5") margin5 = input(defval=0.0,type=input.float, title="Margin") tickCost5 = input(defval=0.0,type=input.float, title="Tick cost") max5 = input(defval=0.0,type=input.float, title="Price max") min5 = input(defval=0.0,type=input.float, title="Price min") cur_ticker=syminfo.prefix+":"+syminfo.ticker id = iff(cur_ticker==ticker1, 1, iff(cur_ticker==ticker2, 2, iff(cur_ticker==ticker3,3, iff(cur_ticker==ticker4,4, iff(cur_ticker==ticker5,5,0))))) isMached = id==0 ? false: true margin = iff(id==1, margin1, iff(id==2, margin2, iff(id==3,margin3, iff(id==4,margin4, iff(id==5,margin5, margin0))))) tickCost = iff(id==1, tickCost1, iff(id==2, tickCost2, iff(id==3,tickCost3, iff(id==4,tickCost4, iff(id==5,tickCost5, tickCost0))))) max = iff(id==1, max1, iff(id==2, max2, iff(id==3,max3, iff(id==4,max4, iff(id==5,max5, max0))))) min = iff(id==1, min1, iff(id==2, min2, iff(id==3,min3, iff(id==4,min4, iff(id==5,min5, min0))))) DaysAgo(t) => floor(timenow/1000/60/60/24)-floor(time_close/1000/60/60/24)<=t?floor(timenow/1000/60/60/24)-floor(time_close/1000/60/60/24):0 DateNow = floor(timenow/1000/60/60/24) DateStart=(DateNow-NumberOfDaysAgo-DaysAgo(2))*1000*60*60*24 ShowAgo=(time>DateStart)?true:false //calculation of margin zones pMarg = margin / tickCost //100 m100_1Up = min + pMarg * 0.95 m100_2Up = min + pMarg * 1.05 m100_1Dwn = max - pMarg * 0.95 m100_2Dwn = max - pMarg * 1.05 //50 m50_1Up = min + pMarg / 2 * 0.95 m50_2Up = min + pMarg / 2 * 1.05 m50_1Dwn = max - pMarg / 2 * 0.95 m50_2Dwn = max - pMarg / 2 * 1.05 //25 m25_1Up = min + pMarg / 4 * 0.95 m25_2Up = min + pMarg / 4 * 1.05 m25_1Dwn = max - pMarg / 4 * 0.95 m25_2Dwn = max - pMarg / 4 * 1.05 //the coordinates of the lines for the labels. l100 = (m100_1Up + m100_2Up) / 2 l101 = (m100_1Dwn + m100_2Dwn) / 2 l50 = (m50_1Up + m50_2Up) / 2 l51 = (m50_1Dwn + m50_2Dwn) / 2 l25 = (m25_1Up + m25_2Up) / 2 l251 = (m25_1Dwn + m25_2Dwn) / 2 linelabel = l100 and l101 and l50 and l51 and l25 and l251, color = #00000000, linewidth=1 //display of margin zones //zones up //+100 line100Up1 = plot(ShowAgo and ShwU and Show_100?m100_1Up:na, color = #FF0000, title="+100_1up") line100Up2 = plot(ShowAgo and ShwU and Show_100?m100_2Up:na, color = #FF0000, title="+100_2up") fill(line100Up1, line100Up2, color = #FF0000, transp=90, title="+100") var label100Up = label.new(x=0,y=l100[0], text="                 +100",color = #00000000, style=label.style_label_center, size=size.normal) label.set_xloc(Show_100 and ShwU?label100Up:na, time, xloc.bar_time) label.set_textcolor(id=label100Up, textcolor = #FF0000) //+50 line50Up1 = plot(ShowAgo and ShwU and Show_50?m50_1Up:na, color = #FF0000, title="+50_1up") line50Up2 = plot(ShowAgo and ShwU and Show_50?m50_2Up:na, color = #FF0000, title="+50_2up") fill(line50Up1, line50Up2, color = #FF0000, transp=90, title="+50") var label50Up = label.new(x=0,y=l50[0], text="                +50",color = #00000000, style=label.style_label_center, size=size.normal) label.set_xloc(Show_50 and ShwU?label50Up:na, time, xloc.bar_time) label.set_textcolor(id=label50Up, textcolor = #FF0000) //+25 line25Up1 = plot(ShowAgo and ShwU and Show_25?m25_1Up:na, color = #FF0000, title="+25_1up") line25Up2 = plot(ShowAgo and ShwU and Show_25?m25_2Up:na, color = #FF0000, title="+25_2up") fill(line25Up1, line25Up2, color = #FF0000, transp=90, title="+25") var label25Up = label.new(x=0,y=l25[0], text="                +25",color = #00000000, style=label.style_label_center, size=size.normal) label.set_xloc(Show_25 and ShwU?label25Up:na, time, xloc.bar_time) label.set_textcolor(id=label25Up, textcolor = #FF0000) //zones dwn //-100 line100Dwn1 = plot(ShowAgo and ShwD and Show100?m100_1Dwn:na, color = #00FF00, title="-100_1Dwn") line100Dwn2 = plot(ShowAgo and ShwD and Show100?m100_2Dwn:na, color = #00FF00, title="-100_2Dwn") fill(line100Dwn1, line100Dwn2, color = #00FF00, transp=90, title="-100") var label100Dwn = label.new(x=0,y=l101[0], text="                 -100",color = #00000000, style=label.style_label_center, size=size.normal) label.set_xloc(Show100 and ShwD?label100Dwn:na, time, xloc.bar_time) label.set_textcolor(id=label100Dwn, textcolor = #00FF00) //-50 line50Dwn1 = plot(ShowAgo and ShwD and Show50?m50_1Dwn:na, color = #00FF00, title="-50_1Dwn") line50Dwn2 = plot(ShowAgo and ShwD and Show50?m50_2Dwn:na, color = #00FF00, title="-50_2Dwn") fill(line50Dwn1, line50Dwn2, color = #00FF00, transp=90, title="-50") var label50Dwn = label.new(x=0,y=l51[0], text="                -50",color = #00000000, style=label.style_label_center, size=size.normal) label.set_xloc(Show50 and ShwD?label50Dwn:na, time, xloc.bar_time) label.set_textcolor(id=label50Dwn, textcolor = #00FF00) //-25 line25Dwn1 = plot(ShowAgo and ShwD and Show25?m25_1Dwn:na, color = #00FF00, title="-25_1Dwn") line25Dwn2 = plot(ShowAgo and ShwD and Show25?m25_2Dwn:na, color = #00FF00, title="-25_2Dwn") fill(line25Dwn1, line25Dwn2, color = #00FF00, transp=90, title="-25") var label25Dwn = label.new(x=0,y=l251[0], text="                -25",color = #00000000, style=label.style_label_center, size=size.normal) label.set_xloc(Show25 and ShwD?label25Dwn:na, time, xloc.bar_time) label.set_textcolor(id=label25Dwn, textcolor = #00FF00)
Logarithmic Bollinger Bands
https://www.tradingview.com/script/vakjaaRd-Logarithmic-Bollinger-Bands/
kingthies
https://www.tradingview.com/u/kingthies/
108
study
5
MPL-2.0
// © 2022 KINGTHIES THIS SOURCE CODE IS SUBJECT TO TERMS OF MOZILLA PUBLIC LICENSE 2.0 (MOZILLA.ORG/MPL/2.0) //@version=5 //## !<---------------- © KINGTHIES ---------------------> indicator('Logarithmic Bollinger Bands (kingthies)',shorttitle='LogBands_KT',overlay=true) // { BBANDS src = math.log(input(close,title="Source")) lenX = input(20,title='Length') highlights = input(false,title="Highlight Bear and Bull Expansions?") mult = 2 bbandBasis = ta.sma(src,lenX) dev = 2 * ta.stdev(src, 20) upperBB = bbandBasis + dev lowerBB = bbandBasis - dev bbw = (upperBB-lowerBB)/bbandBasis bbr = (src - lowerBB)/(upperBB - lowerBB) // } // { BBAND EXPANSIONS bullExp= ta.rising(upperBB,1) and ta.falling(lowerBB,1) and ta.rising(bbandBasis,1) and ta.rising(bbw,1) and ta.rising(bbr,1) bearExp= ta.rising(upperBB,1) and ta.falling(lowerBB,1) and ta.falling(bbandBasis,1) and ta.rising(bbw,1) and ta.falling(bbr,1) // } // { COLORS greenBG = color.rgb(9,121,105,75), redBG = color.rgb(136,8,8,75) bullCol = highlights and bullExp ? greenBG : na, bearCol = highlights and bearExp ? redBG : na // } // { INDICATOR PLOTTING lowBB=plot(math.exp(lowerBB),title='Low Band',color=color.aqua),plot(math.exp(bbandBasis),title='BBand Basis',color=color.red), highBB=plot(math.exp(upperBB),title='High Band',color=color.aqua),fill(lowBB,highBB,title='Band Fill Color',color=color.rgb(0,128,128,75)) bgcolor(bullCol,title='Bullish Expansion Highlights'),bgcolor(bearCol,title='Bearish Expansion Highlights') // } // { Alerts alertcondition(bullExp,title='Bullish Expansion Alert',message='Bullish Expansion on {{ticker}}') alertcondition(bearExp,title='Bearish Expansio Alert',message='Bearish Expansion on {{ticker}}')
Share market aasan hai
https://www.tradingview.com/script/Xnu1Tk9p-Share-market-aasan-hai/
bsbrn0111
https://www.tradingview.com/u/bsbrn0111/
30
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © bsbrn0111 //@version=4 study(title = "share market aasan hai", shorttitle = " SARLA-CPR", overlay=true) trackprice_bool = input(true, "trackprice") daily_open = security(syminfo.tickerid, "D", open[0]) daily_high = security(syminfo.tickerid, "D", high[0]) daily_low = security(syminfo.tickerid, "D", low[0]) daily_close = security(syminfo.tickerid, "D", close[0]) prev_day_high = security(syminfo.tickerid, "D", high[0]) prev_day_low = security(syminfo.tickerid, "D", low[0]) daily_pivot = (daily_high + daily_low + daily_close)/3 daily_bc = (daily_high + daily_low)/2 daily_tc = 2 * daily_pivot - daily_bc daily_r1 = 2 * daily_pivot - daily_low daily_r2 = daily_pivot + daily_high - daily_low daily_r3 = daily_r1 + daily_high - daily_low daily_r4 = daily_r3 + daily_r2 - daily_r1 daily_s1 = 2 * daily_pivot - daily_high daily_s2 = daily_pivot - daily_high + daily_low daily_s3 = daily_s1 - daily_high + daily_low daily_s4 = daily_s3 + daily_s2 - daily_s1 plot(daily_pivot, "daily_pivot", color.purple, linewidth = 2, style = plot.style_circles, trackprice = trackprice_bool) plot(daily_bc, "daily_bc", color.purple, linewidth = 2, style = plot.style_circles, trackprice = trackprice_bool) plot(daily_tc, "daily_tc", color.purple, linewidth = 2, style = plot.style_circles, trackprice = trackprice_bool) plot(prev_day_high, "prev_day_high", color.black, linewidth = 2, style = plot.style_line, trackprice = trackprice_bool) plot(prev_day_low, "prev_day_low", color.black, linewidth = 2, style = plot.style_line, trackprice = trackprice_bool) plot(daily_r1, "daily_r1", color.green, linewidth = 2, style = plot.style_line, trackprice = trackprice_bool) plot(daily_r2, "daily_r2", color.green, linewidth = 2, style = plot.style_line, trackprice = trackprice_bool) plot(daily_r3, "daily_r3", color.green, linewidth = 2, style = plot.style_line, trackprice = trackprice_bool) plot(daily_r4, "daily_r4", color.green, linewidth = 2, style = plot.style_line, trackprice = trackprice_bool) plot(daily_s1, "daily_s1", color.red, linewidth = 2, style = plot.style_line, trackprice = trackprice_bool) plot(daily_s2, "daily_s2", color.red, linewidth = 2, style = plot.style_line, trackprice = trackprice_bool) plot(daily_s3, "daily_s3", color.red, linewidth = 2, style = plot.style_line, trackprice = trackprice_bool) plot(daily_s4, "daily_s4", color.red, linewidth = 2, style = plot.style_line, trackprice = trackprice_bool)
Share market aasan hai CPR with MA & VWAP
https://www.tradingview.com/script/vxVKpaeS-Share-market-aasan-hai-CPR-with-MA-VWAP/
bsbrn0111
https://www.tradingview.com/u/bsbrn0111/
44
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ //@version=4 //***************GUIDE*********************************** //CPR - Applicable only for daily pivots //CPR - All 3 lines display enabled by default //CPR - Central Pivot line display cannot changed //CPR - Central Pivot is a blue line by default and can be changed from settings //CPR - Top Range & Bottom Ranage display can be changed from settings //CPR - Top Range & Bottom Ranage are Yellow lines by default and can be chaned from settings //Daily pivots - Pivot line and CPR Central line are same //Daily pivots - level 1 & 2 (S1, R1, S2 R2) display enabled by default and can be changed from settings //Daily pivots - level 3 (S3 & R3) is availale and can be seleted from settings //Daily pivots - Resistance(R) lines are Red lines and can be changed from settings //Daily pivots - Support(S) lines are Green lines and can be changed from settings //Weekly pivots - Pivot is a blue line by default and can be changed from settings //Weekly pivots - 3 levels (S1, R1, S2, R2, S3 & R3) availale and can be seleted from settings //Weekly pivots - Resistance(R) lines are crossed (+) Red lines and can be changed from settings //Weekly pivots - Support(S) lines are crossed (+) Green lines and can be changed from settings //Monthly pivots - Pivot is a blue line by default and can be changed from settings //Monthly pivots - 3 levels (S1, R1, S2, R2, S3 & R3) availale and can be seleted from settings //Monthly pivots - Resistance(R) lines are circled (o) Red lines and can be changed from settings //Monthly pivots - Support(S) lines are circled (o) Green lines and can be changed from settings study("CPR with MAs, Super Trend & VWAP by GuruprasadMeduri", overlay = true, shorttitle="CPR",precision=1) //******************LOGICS************************** //cenral pivot range pivot = (high + low + close) /3 //Central Povit BC = (high + low) / 2 //Below Central povit TC = (pivot - BC) + pivot //Top Central povot //3 support levels S1 = (pivot * 2) - high S2 = pivot - (high - low) S3 = low - 2 * (high - pivot) //3 resistance levels R1 = (pivot * 2) - low R2 = pivot + (high - low) R3 = high + 2 * (pivot-low) //Checkbox inputs CPRPlot = input(title = "Plot CPR?", type=input.bool, defval=true) DayS1R1 = input(title = "Plot Daiy S1/R1?", type=input.bool, defval=true) DayS2R2 = input(title = "Plot Daiy S2/R2?", type=input.bool, defval=false) DayS3R3 = input(title = "Plot Daiy S3/R3?", type=input.bool, defval=false) WeeklyPivotInclude = input(title = "Plot Weekly Pivot?", type=input.bool, defval=false) WeeklyS1R1 = input(title = "Plot weekly S1/R1?", type=input.bool, defval=false) WeeklyS2R2 = input(title = "Plot weekly S2/R2?", type=input.bool, defval=false) WeeklyS3R3 = input(title = "Plot weekly S3/R3?", type=input.bool, defval=false) MonthlyPivotInclude = input(title = "Plot Montly Pivot?", type=input.bool, defval=false) MonthlyS1R1 = input(title = "Plot Monthly S1/R1?", type=input.bool, defval=false) MonthlyS2R2 = input(title = "Plot Monthly S2/R2?", type=input.bool, defval=false) MonthlyS3R3 = input(title = "Plot Montly S3/R3?", type=input.bool, defval=false) //******************DAYWISE CPR & PIVOTS************************** // Getting daywise CPR DayPivot = security(syminfo.tickerid, "D", pivot[1], barmerge.gaps_off, barmerge.lookahead_on) DayBC = security(syminfo.tickerid, "D", BC[1], barmerge.gaps_off, barmerge.lookahead_on) DayTC = security(syminfo.tickerid, "D", TC[1], barmerge.gaps_off, barmerge.lookahead_on) //Adding linebreaks daywse for CPR CPColour = DayPivot != DayPivot[1] ? na : color.blue BCColour = DayBC != DayBC[1] ? na : color.blue TCColour = DayTC != DayTC[1] ? na : color.blue //Plotting daywise CPR plot(DayPivot, title = "CP" , color = CPColour, style = plot.style_linebr, linewidth =2) plot(CPRPlot ? DayBC : na , title = "BC" , color = BCColour, style = plot.style_line, linewidth =1) plot(CPRPlot ? DayTC : na , title = "TC" , color = TCColour, style = plot.style_line, linewidth =1) // Getting daywise Support levels DayS1 = security(syminfo.tickerid, "D", S1[1], barmerge.gaps_off, barmerge.lookahead_on) DayS2 = security(syminfo.tickerid, "D", S2[1], barmerge.gaps_off, barmerge.lookahead_on) DayS3 = security(syminfo.tickerid, "D", S3[1], barmerge.gaps_off, barmerge.lookahead_on) //Adding linebreaks for daywise Support levels DayS1Color =DayS1 != DayS1[1] ? na : color.green DayS2Color =DayS2 != DayS2[1] ? na : color.green DayS3Color =DayS3 != DayS3[1] ? na : color.green //Plotting daywise Support levels plot(DayS1R1 ? DayS1 : na, title = "D-S1" , color = DayS1Color, style = plot.style_line, linewidth =1) plot(DayS2R2 ? DayS2 : na, title = "D-S2" , color = DayS2Color, style = plot.style_line, linewidth =1) plot(DayS3R3 ? DayS3 : na, title = "D-S3" , color = DayS3Color, style = plot.style_line, linewidth =1) // Getting daywise Resistance levels DayR1 = security(syminfo.tickerid, "D", R1[1], barmerge.gaps_off, barmerge.lookahead_on) DayR2 = security(syminfo.tickerid, "D", R2[1], barmerge.gaps_off, barmerge.lookahead_on) DayR3 = security(syminfo.tickerid, "D", R3[1], barmerge.gaps_off, barmerge.lookahead_on) //Adding linebreaks for daywise Support levels DayR1Color =DayR1 != DayR1[1] ? na : color.red DayR2Color =DayR2 != DayR2[1] ? na : color.red DayR3Color =DayR3 != DayR3[1] ? na : color.red //Plotting daywise Resistance levels plot(DayS1R1 ? DayR1 : na, title = "D-R1" , color = DayR1Color, style = plot.style_line, linewidth =1) plot(DayS2R2 ? DayR2 : na, title = "D-R2" , color = DayR2Color, style = plot.style_line, linewidth =1) plot(DayS3R3 ? DayR3 : na, title = "D-R3" , color = DayR3Color, style = plot.style_line, linewidth =1) //******************WEEKLY PIVOTS************************** // Getting Weely Pivot WPivot = security(syminfo.tickerid, "W", pivot[1], barmerge.gaps_off, barmerge.lookahead_on) //Adding linebreaks for Weely Pivot WeeklyPivotColor =WPivot != WPivot[1] ? na : color.blue //Plotting Weely Pivot plot(WeeklyPivotInclude ? WPivot:na, title = "W-P" , color = WeeklyPivotColor, style = plot.style_circles, linewidth =1) // Getting Weely Support levels WS1 = security(syminfo.tickerid, "W", S1[1],barmerge.gaps_off, barmerge.lookahead_on) WS2 = security(syminfo.tickerid, "W", S2[1],barmerge.gaps_off, barmerge.lookahead_on) WS3 = security(syminfo.tickerid, "W", S3[1],barmerge.gaps_off, barmerge.lookahead_on) //Adding linebreaks for weekly Support levels WS1Color =WS1 != WS1[1] ? na : color.green WS2Color =WS2 != WS2[1] ? na : color.green WS3Color =WS3 != WS3[1] ? na : color.green //Plotting Weely Support levels plot(WeeklyS1R1 ? WS1 : na, title = "W-S1" , color = WS1Color, style = plot.style_cross, linewidth =1) plot(WeeklyS2R2 ? WS2 : na, title = "W-S2" , color = WS2Color, style = plot.style_cross, linewidth =1) plot(WeeklyS3R3 ? WS3 : na, title = "W-S3" , color = WS3Color, style = plot.style_cross, linewidth =1) // Getting Weely Resistance levels WR1 = security(syminfo.tickerid, "W", R1[1], barmerge.gaps_off, barmerge.lookahead_on) WR2 = security(syminfo.tickerid, "W", R2[1], barmerge.gaps_off, barmerge.lookahead_on) WR3 = security(syminfo.tickerid, "W", R3[1], barmerge.gaps_off, barmerge.lookahead_on) //Adding linebreaks for weekly Resistance levels WR1Color = WR1 != WR1[1] ? na : color.red WR2Color = WR2 != WR2[1] ? na : color.red WR3Color = WR3 != WR3[1] ? na : color.red //Plotting Weely Resistance levels plot(WeeklyS1R1 ? WR1 : na , title = "W-R1" , color = WR1Color, style = plot.style_cross, linewidth =1) plot(WeeklyS2R2 ? WR2 : na , title = "W-R2" , color = WR2Color, style = plot.style_cross, linewidth =1) plot(WeeklyS3R3 ? WR3 : na , title = "W-R3" , color = WR3Color, style = plot.style_cross, linewidth =1) //******************MONTHLY PIVOTS************************** // Getting Monhly Pivot MPivot = security(syminfo.tickerid, "M", pivot[1],barmerge.gaps_off, barmerge.lookahead_on) //Adding linebreaks for Monthly Support levels MonthlyPivotColor =MPivot != MPivot[1] ? na : color.blue //Plotting Monhly Pivot plot(MonthlyPivotInclude? MPivot:na, title = " M-P" , color = MonthlyPivotColor, style = plot.style_line, linewidth =1) // Getting Monhly Support levels MS1 = security(syminfo.tickerid, "M", S1[1],barmerge.gaps_off, barmerge.lookahead_on) MS2 = security(syminfo.tickerid, "M", S2[1],barmerge.gaps_off, barmerge.lookahead_on) MS3 = security(syminfo.tickerid, "M", S3[1],barmerge.gaps_off, barmerge.lookahead_on) //Adding linebreaks for Montly Support levels MS1Color =MS1 != MS1[1] ? na : color.green MS2Color =MS2 != MS2[1] ? na : color.green MS3Color =MS3 != MS3[1] ? na : color.green //Plotting Monhly Support levels plot(MonthlyS1R1 ? MS1 : na, title = "M-S1" , color = MS1Color, style = plot.style_circles, linewidth =1) plot(MonthlyS2R2 ? MS2 : na, title = "M-S2" , color = MS2Color, style = plot.style_circles, linewidth =1) plot(MonthlyS3R3 ? MS3 : na, title = "M-S3" , color = MS3Color, style = plot.style_circles, linewidth =1) // Getting Monhly Resistance levels MR1 = security(syminfo.tickerid, "M", R1[1],barmerge.gaps_off, barmerge.lookahead_on) MR2 = security(syminfo.tickerid, "M", R2[1],barmerge.gaps_off, barmerge.lookahead_on) MR3 = security(syminfo.tickerid, "M", R3[1],barmerge.gaps_off, barmerge.lookahead_on) MR1Color =MR1 != MR1[1] ? na : color.red MR2Color =MR2 != MR2[1] ? na : color.red MR3Color =MR3 != MR3[1] ? na : color.red //Plotting Monhly Resistance levels plot(MonthlyS1R1 ? MR1 : na , title = "M-R1", color = MR1Color, style = plot.style_circles , linewidth =1) plot(MonthlyS2R2 ? MR2 : na , title = "M-R2" , color = MR2Color, style = plot.style_circles, linewidth =1) plot(MonthlyS3R3 ? MR3 : na, title = "M-R3" , color = MR3Color, style = plot.style_circles, linewidth =1) //*****************************INDICATORs************************** //SMA PlotSMA = input(title = "Plot SMA?", type=input.bool, defval=true) SMALength = input(title="SMA Length", type=input.integer, defval=50) SMASource = input(title="SMA Source", type=input.source, defval=close) SMAvg = sma (SMASource, SMALength) plot(PlotSMA ? SMAvg : na, color= color.orange, title="SMA") //EMA PlotEMA = input(title = "Plot EMA?", type=input.bool, defval=true) EMALength = input(title="EMA Length", type=input.integer, defval=50) EMASource = input(title="EMA Source", type=input.source, defval=close) EMAvg = ema (EMASource, EMALength) plot(PlotEMA ? EMAvg : na, color= color.red, title="EMA") //VWAP PlotVWAP = input(title = "Plot VWAP?", type=input.bool, defval=true) VWAPSource = input(title="VWAP Source", type=input.source, defval=close) VWAPrice = vwap (VWAPSource) plot(PlotVWAP ? VWAPrice : na, color= color.teal, title="VWAP") //SuperTrend PlotSTrend = input(title = "Plot Super Trend?", type=input.bool, defval=true) InputFactor=input(3, minval=1,maxval = 100, title="Factor") InputLength=input(10, minval=1,maxval = 100, title="Lenght") BasicUpperBand=hl2-(InputFactor*atr(InputLength)) BasicLowerBand=hl2+(InputFactor*atr(InputLength)) FinalUpperBand=0.0 FinalLowerBand=0.0 FinalUpperBand:=close[1]>FinalUpperBand[1]? max(BasicUpperBand,FinalUpperBand[1]) : BasicUpperBand FinalLowerBand:=close[1]<FinalLowerBand[1]? min(BasicLowerBand,FinalLowerBand[1]) : BasicLowerBand IsTrend=0.0 IsTrend:= close > FinalLowerBand[1] ? 1: close< FinalUpperBand[1]? -1: nz(IsTrend[1],1) STrendline = IsTrend==1? FinalUpperBand: FinalLowerBand linecolor = IsTrend == 1 ? color.green : color.red Plotline = (PlotSTrend? STrendline: na) plot(Plotline, color = linecolor , style = plot.style_line , linewidth = 1,title = "SuperTrend") PlotShapeUp = cross(close,STrendline) and close>STrendline PlotShapeDown = cross(STrendline,close) and close<STrendline plotshape(PlotSTrend? PlotShapeUp: na, "Up Arrow", shape.triangleup,location.belowbar,color.green,0,0) plotshape(PlotSTrend? PlotShapeDown: na , "Down Arrow", shape.triangledown , location.abovebar, color.red,0,0)