├── ICT Displacement Candles ├── [Indicator] ICT Displacement Candles.txt ├── [Readme] ICT Displacement Candles.txt ├── [Scanner] ICT Displacement Candles.txt └── [Screenshot] ICT Displacement Candles.png ├── ICT Equal Highs and Lows ├── ICT Equal Highs and Lows Indicator.txt ├── ICT Equal Highs and Lows with Screener.txt ├── ICT Equal Highs and Lows.png └── Readme First.txt ├── ICT External Range Liquidity ├── ICT External Range Liquidity Static Multi-timeframe (Swing High and Low).png ├── ICT External Range Liquidity Static Multi-timeframe (Swing High and Low).txt └── Readme First.txt ├── ICT External and Internal Range Liquidity ├── ICT External and Internal Range Liquidity Multi-timeframe.png ├── ICT External and Internal Range Liquidity Multi-timeframe.txt └── Readme First.txt ├── ICT Fair Value Gap (FVG) Scanner ├── Readme First.txt ├── Scanner - ICT Fair Value Gap (FVG) Scanner.txt └── Screenshot - ICT Fair Value Gap (FVG) Scanner.png ├── ICT Liquidity Sweep Pattern Scanner ├── Readme First.txt ├── Scanner - ICT Liquidity Sweep Pattern Scanner.txt └── Screenshot - ICT Liquidity Sweep Pattern Scanner.png ├── ICT Liquidity Void Fill ├── Readme First.txt ├── [Indicator] ICT Liquidity Void Fill.txt ├── [Scanner] ICT Liquidity Void Fill Scanner.txt └── [Screenshot] ICT Liquidity Void Fill Scanner.png ├── ICT Liquidity Void ├── ICT Liquidity Void Multi-timeframe.txt ├── ICT Liquidity Void Screener.txt ├── ICT Liquidity Void.png └── Readme First.txt ├── ICT Market Structure Shift (MSS) ├── ICT Market Structure Shift (MSS) Screener.txt ├── ICT Market Structure Shift (MSS).png ├── ICT Market Structure Shift (MSS).txt └── Readme First.txt ├── ICT Mitigation Block Scanner ├── Readme First.txt ├── [Scanner] ICT Mitigation Block Scanner.txt └── [Screenshot] ICT Mitigation Block Scanner.png ├── LICENSE ├── Momentum Setup - Ankush Bajaj Momentum Investing Setup ├── Momentum Setup - Ankush Bajaj Momentum Investing Setup with Scanner.txt ├── Momentum Setup - Ankush Bajaj Momentum Investing Setup.png ├── Momentum Setup - Ankush Bajaj Momentum Investing Setup.txt └── Readme First.txt ├── Momentum Setup - RSI Directional Momentum ├── [Indicator] Momentum Setup - RSI Directional Momentum.txt ├── [Readme] Momentum Setup - RSI Directional Momentum.txt ├── [Scanner] Momentum Setup - RSI Directional Momentum.txt ├── [Screenshot] Momentum Setup - RSI Directional Momentum 1.png └── [Screenshot] Momentum Setup - RSI Directional Momentum 2.png ├── Momentum Setup - Vijay Thakare Option Buying Scalping Setup ├── Momentum Setup - Vijay Thakare Option Buying Scalping Setup with Scanner.png ├── Momentum Setup - Vijay Thakare Option Buying Scalping Setup with Scanner.txt ├── Momentum Setup - Vijay Thakare Option Buying Scalping Setup.txt └── Readme First.txt ├── README.md ├── Trend Following Setup - Sideways Market Skipper Scanner ├── Indicator - Trend Following Setup - Sideways Market Skipper.txt ├── Readme First.txt ├── Scanner - Trend Following Setup - Sideways Market Skipper Scanner.txt └── Screenshot - Trend Following Setup - Sideways Market Skipper Scanner.png ├── [Indicator] Magnetic Zones - Multi Timeframe.txt ├── [Screener] ICT Retracement to Order Block with Screener.txt ├── [Screener] Market Profile with Screener (Based on [RS]Market Profile by RicardoSantos).txt ├── [Screenshot] ICT Retracement to Order Block with Screener.jpg └── [Screenshot] Market Profile with Screener (Based on [RS]Market Profile by RicardoSantos).png /ICT Displacement Candles/[Indicator] ICT Displacement Candles.txt: -------------------------------------------------------------------------------- 1 | // This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ 2 | // © Arun_K_Bhaskar 3 | 4 | //@version=6 5 | indicator(title = 'ICT Displacement Candles Indicator', shorttitle = 'ICTDC', overlay = true, max_lines_count = 500, max_labels_count = 500, behind_chart = false) 6 | 7 | //___________________________ Menu Start 8 | 9 | string g_scn_tb = '█████████████████ Scanner █████████████████' 10 | 11 | string tt_ch = 12 | "Displacement:" + 13 | "\n• Strong, sudden price move (up/down) with long candles, minimal wicks." + 14 | 15 | "\n\n Retracement:" + 16 | "\n• Price retraces to a Fibonacci level of the displacement." + 17 | "\n• Potential entry point for trend continuation." 18 | 19 | string tt_is = 20 | "• Reads only the first 40 symbols." + 21 | "\n• Max 4096 characters." + 22 | "\n• Format: EXCHANGE:SYMBOL_A,EXCHANGE:SYMBOL_B" 23 | 24 | string i_scn_choose = input.string( 25 | defval = 'Displacement', 26 | title = 'Scanning Method', 27 | options = ['Displacement', 'Retracement'], tooltip = tt_ch, group = g_scn_tb) 28 | 29 | bool i_scn_show_long = input.bool(defval = true, title = 'Long Signals', inline = 'tb_2', group = g_scn_tb) 30 | bool i_scn_show_short = input.bool(defval = true, title = 'Short Signals', inline = 'tb_2', group = g_scn_tb) 31 | 32 | string g_dc = '████████████ Displacement Candles ████████████' 33 | 34 | string tt_mb = "Shows if bars exceed the set value." 35 | string tt_dev = "Specifies the minimal size of displament, as a percentage of the average high-low range for the last 14 bars." 36 | string tt_ret_fib = 37 | "• 0: Top of bullish & bottom of bearish displacement." + 38 | "\n• 1: Bottom of bullish & top of bearish displacement." + 39 | "\n• 0.5: 50% of the displacement." 40 | 41 | int i_dc_min_bars = input.int(defval = 3, title = 'Minimum Bars', minval = 1, tooltip = tt_mb, group = g_dc) 42 | float i_dc_dev_percent = nz(input.float(60.0, "Minimal Deviation (%)", minval=1, step = 10, tooltip = tt_dev, group = g_dc) / 100 * ta.sma(high-low, 14)) 43 | bool i_dc_close_filter = input.bool(defval = true, title = 'Apply Close Above/Below Prev Close', group = g_dc) 44 | bool i_dc_hl_filter = input.bool(defval = false, title = 'Apply Close Above/Below Prev High/Low', group = g_dc) 45 | float i_dc_fib_val = input.float(defval = 0.5, title = 'Fibonacci Value', step = 0.1, tooltip = tt_ret_fib, group = g_dc) 46 | 47 | string g_af = '██████████████ Additional Fiters ██████████████' 48 | 49 | string tt_atr = "• Filters out longer or more volatile displacement candles." 50 | string tt_atr_mul = "• Higher values filter longer or more volatile candles." 51 | string tt_bf = "• 80 means the body covers 80%+ of the displacement candle." 52 | string tt_tf = "• Filter signals within a given time." 53 | string tt_df = "• Filter signals on specified dates (for Retracement Candles only)." 54 | 55 | bool i_atr_filter = input.bool(defval = false, title = 'Apply ATR Filter', tooltip = tt_atr, group = g_af) 56 | int i_atr_length = input.int(defval = 14, minval = 1, title = 'ATR Length', group = g_af) 57 | float i_atr_multi = input.float(defval = 1, title = 'ATR Multiplier', minval = 1, group = g_af) 58 | 59 | bool i_body_filter = input.bool(defval = false, title = 'Apply Body % Filter', tooltip = tt_bf, group = g_af) 60 | float i_body_percent = input.float(defval = 70, title = 'Body % Above', minval = 0, maxval = 100, group = g_af) / 100 61 | 62 | bool i_time_filter = input.bool(defval = false, title = 'Apply Time Filter', tooltip = tt_tf, group = g_af) 63 | int i_hour_1 = input.int(defval = 9, minval = 0, title = 'Time From', inline = 't_1', group = g_af) 64 | int i_minute_1 = input.int(defval = 15, minval = 0, title = ':', inline = 't_1', group = g_af) 65 | int i_hour_2 = input.int(defval = 10, minval = 0, title = 'Time To ', inline = 't_2', group = g_af) 66 | int i_minute_2 = input.int(defval = 15, minval = 0, title = ':', inline = 't_2', group = g_af) 67 | 68 | bool i_date_filter = input.bool(defval = false, title = 'Apply Date Filter', tooltip = tt_df, group = g_af) 69 | int i_day = input.int(defval = 30, minval = 1, maxval = 31, title = 'Day', group = g_af) 70 | int i_month = input.int(defval = 3, minval = 1, maxval = 12, title = 'Month', group = g_af) 71 | int i_year = input.int(defval = 2025, minval = 0, title = 'Year', group = g_af) 72 | 73 | string g_cum = '█████████████ Performance Table █████████████' 74 | 75 | bool i_cum_tbl_disp = input.bool(defval = true, title = 'Display', group = g_cum) 76 | string i_cum_tbl_pos = input.string(defval = position.bottom_right, title = 'Position', options = [position.top_left, position.top_center, position.top_right, position.middle_left, position.middle_center, position.middle_right, position.bottom_left, position.bottom_center, position.bottom_right], group = g_cum) 77 | string i_cum_tbl_size = input.string(defval = size.normal, title = 'Size', options = [size.auto, size.tiny, size.small, size.normal, size.large, size.huge], group = g_cum) 78 | 79 | //string g_ch = '█████████████████ Colors █████████████████' 80 | color i_pos_color = #089981 //input.color(defval = #089981, title = 'Positive', group = g_ch) 81 | color i_pos_light_color = #70CCBD //input.color(defval = #70CCBD, title = 'Positive Light', group = g_ch) 82 | color i_neg_light_color = #FAA1A4 //input.color(defval = #FAA1A4, title = 'Negative Light', group = g_ch) 83 | color i_neg_color = #F23645 //input.color(defval = #F23645, title = 'Negative', group = g_ch) 84 | color i_neu_dark_color = #0F0F0F //input.color(defval = #0F0F0F, title = 'Neutral', group = g_ch) 85 | 86 | //___________________________ Menu End 87 | 88 | //___________________________ Performance Start 89 | 90 | is_new_day = ta.change(time('D')) != 0 91 | 92 | // Cumulative Percentage Change 93 | var float cum_pchg = na 94 | day_pchg = na(close[1]) ? 0 : (close - close[1]) / close[1] * 100 95 | cum_pchg := is_new_day ? day_pchg : na(cum_pchg) ? day_pchg : cum_pchg + day_pchg 96 | 97 | // Cumulative Volume and Volume Percentage Change 98 | var float curr_cum_vol = na 99 | var float prev_cum_vol = na 100 | if is_new_day 101 | prev_cum_vol := curr_cum_vol 102 | curr_cum_vol := volume 103 | curr_cum_vol 104 | else 105 | curr_cum_vol := na(curr_cum_vol) ? volume : curr_cum_vol + volume 106 | curr_cum_vol 107 | prev_vol_safe = nz(prev_cum_vol, curr_cum_vol) 108 | cum_vol_pchg = (curr_cum_vol - prev_vol_safe) / prev_vol_safe * 100 109 | 110 | var table tbl_cum = table.new(position=i_cum_tbl_pos, columns=2, rows=4, border_width=1, force_overlay=true) 111 | 112 | cell_perform(col, row, txt, txt_color, aligh) => 113 | table.cell(tbl_cum, col, row, txt, text_color=txt_color, text_halign=aligh, bgcolor=i_neu_dark_color, text_size=i_cum_tbl_size) 114 | 115 | if barstate.islast and i_cum_tbl_disp 116 | pchg_col = cum_pchg > 0 ? i_pos_color : i_neg_color 117 | vol_pchg_col = cum_vol_pchg > 0 ? i_pos_color : i_neg_color 118 | prev_vol_pchg_col = prev_vol_safe < curr_cum_vol ? i_neg_color : i_pos_color 119 | 120 | cell_perform(0, 0, '%Chg', chart.fg_color, text.align_left) 121 | cell_perform(1, 0, str.tostring(cum_pchg, '#.##') + ' %', pchg_col, text.align_right) 122 | cell_perform(0, 1, 'Vol %Chg', chart.fg_color, text.align_left) 123 | cell_perform(1, 1, str.tostring(cum_vol_pchg, '#.##') + ' %', vol_pchg_col, text.align_right) 124 | cell_perform(0, 2, 'Vol', chart.fg_color, text.align_left) 125 | cell_perform(1, 2, str.tostring(curr_cum_vol / 100000, '#.##') + ' L', vol_pchg_col, text.align_right) 126 | cell_perform(0, 3, 'PD Vol', chart.fg_color, text.align_left) 127 | cell_perform(1, 3, str.tostring(prev_vol_safe / 100000, '#.##') + ' L', prev_vol_pchg_col, text.align_right) 128 | 129 | //___________________________ Performance End 130 | 131 | //___________________________ Additional Filters Start 132 | 133 | // Pre-calculate common values 134 | candle_range = high - low 135 | body_size = math.abs(close - open) 136 | 137 | // ATR Filter 138 | atr_filter = not i_atr_filter or candle_range > ta.atr(i_atr_length) * i_atr_multi 139 | 140 | // Body Filters 141 | body_filter = not i_body_filter or candle_range > 0 and body_size / candle_range >= i_body_percent 142 | 143 | // Time Filter 144 | time_filter = 145 | not i_time_filter or 146 | (hour > i_hour_1 or hour == i_hour_1 and minute >= i_minute_1) and 147 | (hour < i_hour_2 or hour == i_hour_2 and minute < i_minute_2) 148 | 149 | // Date Filter 150 | date_filter = not i_date_filter or year == i_year and month == i_month and dayofmonth == i_day 151 | 152 | //___________________________ Additional Filters End 153 | 154 | //___________________________ Displacement Candles Start 155 | 156 | // Combined tracking variables 157 | var int bullCnt = 0 158 | var int bearCnt = 0 159 | var float bullHi = na 160 | var float bullLo = na 161 | var float bearHi = na 162 | var float bearLo = na 163 | var float bullFib = na 164 | var float bearFib = na 165 | var bullHighs = array.new_float() 166 | var bullLows = array.new_float() 167 | var bearHighs = array.new_float() 168 | var bearLows = array.new_float() 169 | 170 | // Conditions and filters combined 171 | float priceChg = (high - low) 172 | bool bullish = priceChg >= i_dc_dev_percent and close > open and (not i_dc_close_filter or close > close[1]) and (not i_dc_hl_filter or close > high[1]) and atr_filter 173 | bool bearish = priceChg >= i_dc_dev_percent and close < open and (not i_dc_close_filter or close < close[1]) and (not i_dc_hl_filter or close < low[1]) and atr_filter 174 | 175 | // Optimized counting and array management 176 | if bullish 177 | bullCnt := bullCnt + 1 178 | bearCnt := 0 179 | array.push(bullHighs, high) 180 | array.push(bullLows, low) 181 | if bullCnt == 1 182 | array.clear(bearHighs) 183 | array.clear(bearLows) 184 | else if bearish 185 | bearCnt := bearCnt + 1 186 | bullCnt := 0 187 | array.push(bearHighs, high) 188 | array.push(bearLows, low) 189 | if bearCnt == 1 190 | array.clear(bullHighs) 191 | array.clear(bullLows) 192 | else 193 | bullCnt := 0 194 | bearCnt := 0 195 | array.clear(bullHighs) 196 | array.clear(bullLows) 197 | array.clear(bearHighs) 198 | array.clear(bearLows) 199 | 200 | // Calculate high-low range and percentage 201 | float bullRange = na 202 | float bearRange = na 203 | float bullRangePercent = na 204 | float bearRangePercent = na 205 | 206 | if bullCnt >= i_dc_min_bars 207 | bullHi := array.max(bullHighs) 208 | bullLo := array.min(bullLows) 209 | bullRange := bullHi - bullLo 210 | bullRangePercent := (bullRange / bullLo) * 100 211 | bullFib := bullHi - (bullHi - bullLo) * i_dc_fib_val 212 | if bearCnt >= i_dc_min_bars 213 | bearHi := array.max(bearHighs) 214 | bearLo := array.min(bearLows) 215 | bearRange := bearHi - bearLo 216 | bearRangePercent := (bearRange / bearLo) * 100 217 | bearFib := bearLo + (bearHi - bearLo) * i_dc_fib_val 218 | 219 | bearMaxCnt = bearCnt[1] >= i_dc_min_bars and bearCnt == 0 220 | bullMaxCnt = bullCnt[1] >= i_dc_min_bars and bullCnt == 0 221 | 222 | // Plot 223 | if bearMaxCnt and i_scn_show_short 224 | label.new(x = bar_index[1], y = low[1], text = str.tostring(bearCnt[1]), color = na, textcolor = i_neg_light_color, size = size.small, style = label.style_label_up, yloc = yloc.belowbar) 225 | // label.new(x = bar_index[1], y = low[1], text = str.format("{0,number,#.##}%", bearRangePercent[1]), color = na, textcolor = i_neg_light_color, size = size.small, style = label.style_label_up, yloc = yloc.belowbar) 226 | 227 | if bullMaxCnt and i_scn_show_long 228 | label.new(x = bar_index[1], y = high[1], text = str.tostring(bullCnt[1]), color = na, textcolor = i_pos_light_color, size = size.small, style = label.style_label_down, yloc = yloc.abovebar) 229 | // label.new(x = bar_index[1], y = high[1], text = str.format("{0,number,#.##}%", bullRangePercent[1]), color = na, textcolor = i_pos_light_color, size = size.small, style = label.style_label_down, yloc = yloc.abovebar) 230 | 231 | // Plot counts 232 | //if bearCnt >= i_dc_min_bars and i_scn_show_short 233 | // label.new(x = bar_index, y = low, text = str.tostring(bearCnt), color = na, textcolor = i_neg_light_color, size = size.small, style = label.style_label_up, yloc = yloc.belowbar) 234 | //if bullCnt >= i_dc_min_barst and i_scn_show_long 235 | // label.new(x = bar_index, y = high, text = str.tostring(bullCnt), color = na, textcolor = i_pos_light_color, size = size.small, style = label.style_label_down, yloc = yloc.abovebar) 236 | 237 | plot(series = bearFib, title = 'Bearish Fib Line', color = i_neg_color, style = plot.style_stepline, display = display.none) 238 | plot(series = bullFib, title = 'Bullish Fib Line', color = i_pos_color, style = plot.style_stepline, display = display.none) 239 | 240 | // Track the final count before reset 241 | var int lastBullCnt = 0 242 | var int lastBearCnt = 0 243 | 244 | // Update when sequence ends 245 | if bullMaxCnt 246 | lastBullCnt := bullCnt[1] 247 | if bearMaxCnt 248 | lastBearCnt := bearCnt[1] 249 | 250 | // Retracement tracking combined 251 | var bool bullActive = false 252 | var bool bearActive = false 253 | var bool bullDone = false 254 | var bool bearDone = false 255 | var int bullBar = na 256 | var int bearBar = na 257 | var int bullStart = na 258 | var int bearStart = na 259 | var float bullLow = na 260 | var float bearHigh = na 261 | var line bullLine = na 262 | var line bearLine = na 263 | 264 | // Activate sequences 265 | if bullCnt >= i_dc_min_bars and bullCnt[1] < i_dc_min_bars 266 | bullActive := true 267 | bearActive := false 268 | bullDone := false 269 | bearDone := false 270 | bullStart := bar_index - bullCnt + 1 271 | if bearCnt >= i_dc_min_bars and bearCnt[1] < i_dc_min_bars 272 | bearActive := true 273 | bullActive := false 274 | bearDone := false 275 | bullDone := false 276 | bearStart := bar_index - bearCnt + 1 277 | 278 | // Detect and mark retracements 279 | bool bearRet = bearActive and not bearDone and ta.crossover(high, bearFib) and high[1] < bearFib and time_filter and date_filter 280 | bool bullRet = bullActive and not bullDone and ta.crossunder(low, bullFib) and low[1] > bullFib and time_filter and date_filter 281 | if bearRet and i_scn_choose == 'Retracement' and i_scn_show_short 282 | bearDone := true 283 | bearBar := bar_index 284 | bearHigh := high 285 | bearLine := line.new(x1 = bearStart, y1 = bearFib, x2 = bearBar, y2 = bearFib, color = i_neg_light_color, style = line.style_dotted) 286 | if bullRet and i_scn_choose == 'Retracement' and i_scn_show_long 287 | bullDone := true 288 | bullBar := bar_index 289 | bullLow := low 290 | bullLine := line.new(x1 = bullStart, y1 = bullFib, x2 = bullBar, y2 = bullFib, color = i_pos_light_color, style = line.style_dotted) 291 | 292 | // Plot signals 293 | plotshape(i_scn_show_short and i_scn_choose == 'Retracement' ? bearRet : false, title = 'Bearish Retracement', style = shape.triangledown, location = location.abovebar, color = i_neg_light_color, size = size.tiny) 294 | plotshape(i_scn_show_long and i_scn_choose == 'Retracement' ? bullRet : false, title = 'Bullish Retracement', style = shape.triangleup, location = location.belowbar, color = i_pos_light_color, size = size.tiny) 295 | barcolor(i_scn_show_short and i_scn_choose == 'Retracement' and bearRet ? i_neg_light_color : i_scn_show_long and i_scn_choose == 'Retracement' and bullRet ? i_pos_light_color : na, title = 'Retracement Candle') 296 | 297 | //___________________________ Displacement Candles End 298 | 299 | //___________________________ Code End 300 | 301 | // Readme 302 | // 303 | // Indicator Title: "ICT Displacement Candles Scanner" 304 | // 305 | // Overview 306 | // - A price action trading method based on strong price moves (displacement). 307 | // - Helps identify trend direction and potential trade entries. 308 | // 309 | // Features 310 | // - Scanning Methods: 311 | // - Displacement: Strong, sudden price move (up/down) with long candles, minimal wicks. 312 | // - Retracement: Price retraces to a Fibonacci level of the displacement. 313 | // 314 | // How to Use? 315 | // 1. Identify Displacement: Look for strong price movement after liquidity is taken. 316 | // 2. Wait for Retracement: Use Fibonacci to find entry levels (e.g., 61.8%). 317 | // 3. Confirm with Order Blocks or Fair Value Gap(FVG): Ensure price reacts at an institutional level. 318 | // 4. Enter Trade: Buy or sell based on trend continuation signals. 319 | // 5. Set Targets: Aim for the next liquidity zone. 320 | // 321 | // Note: Read tooltips for more clarity. 322 | // 323 | // Questions?: Message the author on TradingView: https://www.tradingview.com/u/Arun_K_Bhaskar/ 324 | // 325 | // More Indicators: Free TradingView indicators and source code on GitHub: https://github.com/ArunKBhaskar/PineScript 326 | -------------------------------------------------------------------------------- /ICT Displacement Candles/[Readme] ICT Displacement Candles.txt: -------------------------------------------------------------------------------- 1 | // Readme 2 | // 3 | // Indicator Title: "ICT Displacement Candles Scanner" 4 | // 5 | // Overview 6 | // - A price action trading method based on strong price moves (displacement). 7 | // - Helps identify trend direction and potential trade entries. 8 | // 9 | // Features 10 | // - Scanning Methods: 11 | // - Displacement: Strong, sudden price move (up/down) with long candles, minimal wicks. 12 | // - Retracement: Price retraces to a Fibonacci level of the displacement. 13 | // 14 | // How to Use? 15 | // 1. Identify Displacement: Look for strong price movement after liquidity is taken. 16 | // 2. Wait for Retracement: Use Fibonacci to find entry levels (e.g., 61.8%). 17 | // 3. Confirm with Order Blocks or Fair Value Gap(FVG): Ensure price reacts at an institutional level. 18 | // 4. Enter Trade: Buy or sell based on trend continuation signals. 19 | // 5. Set Targets: Aim for the next liquidity zone. 20 | // 21 | // Note: Read tooltips for more clarity. 22 | // 23 | // Questions?: Message the author on TradingView: https://www.tradingview.com/u/Arun_K_Bhaskar/ 24 | // 25 | // More Indicators: Free TradingView indicators and source code on GitHub: https://github.com/ArunKBhaskar/PineScript -------------------------------------------------------------------------------- /ICT Displacement Candles/[Screenshot] ICT Displacement Candles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArunKBhaskar/PineScript/c6821225c466494b01eee08f9dd88bf84d2b24ba/ICT Displacement Candles/[Screenshot] ICT Displacement Candles.png -------------------------------------------------------------------------------- /ICT Equal Highs and Lows/ICT Equal Highs and Lows Indicator.txt: -------------------------------------------------------------------------------- 1 | // This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ 2 | // © Arun_K_Bhaskar 3 | 4 | //@version=5 5 | i_max_bars_back = 300 6 | indicator(title="ICT Equal Highs and Lows", shorttitle="Equal HL", overlay=true, max_bars_back=i_max_bars_back, max_lines_count=500, max_labels_count=500) 7 | 8 | //____________________________ Menu Pivot High Low Start 9 | 10 | g_phl_eq = '███████████████ Equal High Low ███████████████' 11 | int i_phl_1_left = input.int(defval=60, title='Left', group=g_phl_eq) 12 | int i_phl_1_right = input.int(defval=30, title='Right', group=g_phl_eq) 13 | tt_eq = "Lower values mean highs and lows are closer." 14 | float i_phl_eq_percent = input.float(defval=0.05, minval=0, step=0.01, title='Equal HL %', tooltip=tt_eq, group=g_phl_eq) 15 | string i_phl_1_source = input.string(defval='High/Low', title='Source', options=['High/Low', 'Open/Close'], group=g_phl_eq) 16 | color i_phl_1_h_ln_color = input.color(defval=#F7525F, title='Bearish Color', group=g_phl_eq) 17 | color i_phl_1_l_ln_color = input.color(defval=#22AB94, title='Bullish Color', group=g_phl_eq) 18 | int i_phl_eq_transp = input.int(defval=25, minval=0, title='Transparency', group=g_phl_eq) 19 | 20 | //____________________________ Menu Pivot High Low End 21 | 22 | //____________________________ Equal High Low Start 23 | 24 | // Get Source 25 | float _high = i_phl_1_source == 'Open/Close' ? math.max(open, close) : high 26 | float _low = i_phl_1_source == 'Open/Close' ? math.min(open, close) : low 27 | 28 | // Arrays to store the last 2 pivot highs and lows 29 | var float[] ph_arr = array.new_float(2) 30 | var int[] ph_bi_arr = array.new_int(2) 31 | var float[] pl_arr = array.new_float(2) 32 | var int[] pl_bi_arr = array.new_int(2) 33 | 34 | // Pivot calculations 35 | int prev_ph_bi = na, int prev_pl_bi = na 36 | bool ph = false, bool pl = false 37 | 38 | phl_1_ph = ta.pivothigh(_high, i_phl_1_left, i_phl_1_right) 39 | phl_1_pl = ta.pivotlow(_low, i_phl_1_left, i_phl_1_right) 40 | 41 | // Update the arrays with the last 2 pivot highs and lows 42 | if not na(phl_1_ph) 43 | ph := true 44 | prev_ph_bi := bar_index - i_phl_1_right 45 | array.unshift(ph_bi_arr, bar_index) 46 | array.pop(ph_bi_arr) 47 | 48 | if not na(phl_1_pl) 49 | pl := true 50 | prev_pl_bi := bar_index - i_phl_1_right 51 | array.unshift(pl_bi_arr, bar_index) 52 | array.pop(pl_bi_arr) 53 | 54 | // Function to update the arrays with the last 2 values 55 | update_arrays(value, array_ref) => 56 | array.unshift(array_ref, value) 57 | array.pop(array_ref) 58 | 59 | // Update arrays with the last 2 pivot highs and lows 60 | if ph 61 | update_arrays(phl_1_ph, ph_arr) 62 | if pl 63 | update_arrays(phl_1_pl, pl_arr) 64 | 65 | // Get last two pivot highs and lows 66 | ph_price_0 = array.get(ph_arr, 0), ph_price_1 = array.get(ph_arr, 1) 67 | ph_bi_0 = array.get(ph_bi_arr, 0), ph_bi_1 = array.get(ph_bi_arr, 1) 68 | 69 | pl_price_0 = array.get(pl_arr, 0), pl_price_1 = array.get(pl_arr, 1) 70 | pl_bi_0 = array.get(pl_bi_arr, 0), pl_bi_1 = array.get(pl_bi_arr, 1) 71 | 72 | // Function to calculate percentage change 73 | pchg(price_1, price_2) => 74 | change = price_1 - price_2 75 | percent_change = math.abs((change / price_2) * 100) 76 | percent_change 77 | 78 | // Calculate percentage change between the last two pivot highs and lows 79 | var float ph_pchg = na 80 | var float pl_pchg = na 81 | 82 | if array.size(ph_arr) >= 2 83 | ph_pchg := pchg(array.get(ph_arr, 0), array.get(ph_arr, 1)) 84 | 85 | if array.size(pl_arr) >= 2 86 | pl_pchg := pchg(array.get(pl_arr, 0), array.get(pl_arr, 1)) 87 | 88 | // Draw Equals Box 89 | var levelBoxes_equal = array.new_box() 90 | 91 | ph_condition = ph and ph_pchg < i_phl_eq_percent and barstate.isconfirmed 92 | pl_condition = pl and pl_pchg < i_phl_eq_percent and barstate.isconfirmed 93 | 94 | if ph_condition 95 | ph_box = box.new(left=ph_bi_1 - i_phl_1_right, top=ph_price_1, right=ph_bi_0 - i_phl_1_right, bottom=ph_price_0, border_color=color.new(i_phl_1_h_ln_color, i_phl_eq_transp), bgcolor=color.new(i_phl_1_h_ln_color, i_phl_eq_transp)) 96 | array.push(levelBoxes_equal, ph_box) 97 | 98 | if pl_condition 99 | pl_box = box.new(left=pl_bi_1 - i_phl_1_right, top=pl_price_1, right=pl_bi_0 - i_phl_1_right, bottom=pl_price_0, border_color=color.new(i_phl_1_l_ln_color, i_phl_eq_transp), bgcolor=color.new(i_phl_1_l_ln_color, i_phl_eq_transp)) 100 | array.push(levelBoxes_equal, pl_box) 101 | 102 | // Plot Equal Labels 103 | plotshape(ph_condition ? high[i_phl_1_right] : na, style=shape.xcross, location=location.absolute, offset=-i_phl_1_right, color=color.new(i_phl_1_h_ln_color, i_phl_eq_transp), size=size.small) 104 | plotshape(pl_condition ? low[i_phl_1_right] : na, style=shape.xcross, location=location.absolute, offset=-i_phl_1_right, color=color.new(i_phl_1_l_ln_color, i_phl_eq_transp), size=size.small) 105 | 106 | //____________________________ Equal High Low End 107 | 108 | // _____________________________ Code End -------------------------------------------------------------------------------- /ICT Equal Highs and Lows/ICT Equal Highs and Lows with Screener.txt: -------------------------------------------------------------------------------- 1 | // This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ 2 | // © Arun_K_Bhaskar 3 | 4 | //@version=5 5 | i_max_bars_back = 300 6 | indicator(title="ICT Equal Highs and Lows with Screener", shorttitle="Equal HL Scr", overlay=true, max_bars_back=i_max_bars_back, max_lines_count=500, max_labels_count=500) 7 | 8 | //_____________________________ Menu Screener Start 9 | 10 | g_tb = '█████████████████ Screener █████████████████' 11 | 12 | string i_scr_choose = input.string(defval='Equals', title='Screening Method', options=['Equals', 'Equals Sweep'], group=g_tb) 13 | 14 | tt_is = "• Input exactly 40 symbols, nothing more or less." + 15 | "\n• Total characters cannot exceed 4096." + 16 | "\n• Use comma as delimiter without any space." + 17 | "\n• Eg: EXCHANGE:SYMBOL_A,EXCHANGE:SYMBOL_B" 18 | string i_symbols = input.text_area( 19 | defval="NSE:AEGISCHEM,NSE:BANKINDIA,NSE:BHEL,NSE:BLS,NSE:CASTROLIND,NSE:CESC,NSE:ENGINERSIN,NSE:EQUITASBNK,NSE:FSL,NSE:GICRE,NSE:GPPL,NSE:GSPL,NSE:HFCL,NSE:HINDCOPPER,NSE:HUDCO,NSE:IBULHSGFIN,NSE:INDIACEM,NSE:INDUSTOWER,NSE:IOC,NSE:IRCON,NSE:IRFC,NSE:KARURVYSYA,NSE:NATIONALUM,NSE:NETWORK18,NSE:NIACL,NSE:NLCINDIA,NSE:PCBL,NSE:PFC,NSE:PNB,NSE:PNCINFRA,NSE:RVNL,NSE:SAIL,NSE:SJVN,NSE:TTML,NSE:UNIONBANK,NSE:USHAMART,NSE:VAIBHAVGBL,NSE:WELSPUNLIV,NSE:ZEEL,NSE:ZOMATO,", 20 | title="Paste Symbols", tooltip=tt_is, group=g_tb) 21 | 22 | string i_scr_direction = input.string(defval='Both', title='Direction', options=['Both', 'Bullish', 'Bearish'], inline='tb_1', group=g_tb) 23 | bool i_scr_show_bull = input.bool(defval=true, title='Only Bullish', inline='tb_2', group=g_tb) 24 | bool i_scr_show_bear = input.bool(defval=true, title='Only Bearish', inline='tb_2', group=g_tb) 25 | 26 | int i_tbl_disp_rows = input.int(defval=16, title='Display Rows', minval=0, maxval=100, group=g_tb) 27 | string i_tbl_position = input.string(defval=position.bottom_left, title='Table Position', options=[position.top_left, position.top_center, position.top_right, position.middle_left, position.middle_center, position.middle_right, position.bottom_left, position.bottom_center, position.bottom_right], group=g_tb) 28 | string i_tbl_text_size = input.string(defval=size.small, title='Table Size', options=[size.auto, size.tiny, size.small, size.normal, size.large, size.huge], group=g_tb) 29 | 30 | //_____________________________ Menu Screener End 31 | 32 | //____________________________ Menu Pivot High Low Start 33 | 34 | g_phl_eq = '███████████████ Equal High Low ███████████████' 35 | int i_phl_1_left = input.int(defval=60, title='Left', group=g_phl_eq) 36 | int i_phl_1_right = input.int(defval=30, title='Right', group=g_phl_eq) 37 | tt_eq = "Lower values mean highs and lows are closer." 38 | float i_phl_eq_percent = input.float(defval=0.05, minval=0, step=0.01, title='Equal HL %', tooltip=tt_eq, group=g_phl_eq) 39 | string i_phl_1_source = input.string(defval='High/Low', title='Source', options=['High/Low', 'Open/Close'], group=g_phl_eq) 40 | color i_phl_1_h_ln_color = input.color(defval=#F7525F, title='Bearish Color', group=g_phl_eq) 41 | color i_phl_1_l_ln_color = input.color(defval=#22AB94, title='Bullish Color', group=g_phl_eq) 42 | color i_phl_txt_color = input.color(defval=#B2B5BE, title='Neutral Color', group=g_phl_eq) 43 | int i_phl_eq_transp = input.int(defval=25, minval=0, title='Transparency', group=g_phl_eq) 44 | 45 | //____________________________ Menu Pivot High Low End 46 | 47 | //____________________________ Equal High Low Start 48 | 49 | // Get Source 50 | float _high = i_phl_1_source == 'Open/Close' ? math.max(open, close) : high 51 | float _low = i_phl_1_source == 'Open/Close' ? math.min(open, close) : low 52 | 53 | // Arrays to store the last 2 pivot highs and lows 54 | var float[] ph_arr = array.new_float(2) 55 | var int[] ph_bi_arr = array.new_int(2) 56 | var float[] pl_arr = array.new_float(2) 57 | var int[] pl_bi_arr = array.new_int(2) 58 | 59 | // Pivot calculations 60 | int prev_ph_bi = na, int prev_pl_bi = na 61 | bool ph = false, bool pl = false 62 | 63 | phl_1_ph = ta.pivothigh(_high, i_phl_1_left, i_phl_1_right) 64 | phl_1_pl = ta.pivotlow(_low, i_phl_1_left, i_phl_1_right) 65 | 66 | // Update the arrays with the last 2 pivot highs and lows 67 | if not na(phl_1_ph) 68 | ph := true 69 | prev_ph_bi := bar_index - i_phl_1_right 70 | array.unshift(ph_bi_arr, bar_index) 71 | array.pop(ph_bi_arr) 72 | 73 | if not na(phl_1_pl) 74 | pl := true 75 | prev_pl_bi := bar_index - i_phl_1_right 76 | array.unshift(pl_bi_arr, bar_index) 77 | array.pop(pl_bi_arr) 78 | 79 | // Function to update the arrays with the last 2 values 80 | update_arrays(value, array_ref) => 81 | array.unshift(array_ref, value) 82 | array.pop(array_ref) 83 | 84 | // Update arrays with the last 2 pivot highs and lows 85 | if ph 86 | update_arrays(phl_1_ph, ph_arr) 87 | if pl 88 | update_arrays(phl_1_pl, pl_arr) 89 | 90 | // Get last two pivot highs and lows 91 | ph_price_0 = array.get(ph_arr, 0), ph_price_1 = array.get(ph_arr, 1) 92 | ph_bi_0 = array.get(ph_bi_arr, 0), ph_bi_1 = array.get(ph_bi_arr, 1) 93 | 94 | pl_price_0 = array.get(pl_arr, 0), pl_price_1 = array.get(pl_arr, 1) 95 | pl_bi_0 = array.get(pl_bi_arr, 0), pl_bi_1 = array.get(pl_bi_arr, 1) 96 | 97 | // Function to calculate percentage change 98 | pchg(price_1, price_2) => 99 | change = price_1 - price_2 100 | percent_change = math.abs((change / price_2) * 100) 101 | percent_change 102 | 103 | // Calculate percentage change between the last two pivot highs and lows 104 | var float ph_pchg = na 105 | var float pl_pchg = na 106 | 107 | if array.size(ph_arr) >= 2 108 | ph_pchg := pchg(array.get(ph_arr, 0), array.get(ph_arr, 1)) 109 | 110 | if array.size(pl_arr) >= 2 111 | pl_pchg := pchg(array.get(pl_arr, 0), array.get(pl_arr, 1)) 112 | 113 | // Draw Equals Box 114 | var levelBoxes_equal = array.new_box() 115 | 116 | ph_condition = ph and ph_pchg < i_phl_eq_percent and barstate.isconfirmed 117 | pl_condition = pl and pl_pchg < i_phl_eq_percent and barstate.isconfirmed 118 | 119 | if ph_condition 120 | ph_box = box.new(left=ph_bi_1 - i_phl_1_right, top=ph_price_1, right=ph_bi_0 - i_phl_1_right, bottom=ph_price_0, border_color=color.new(i_phl_1_h_ln_color, i_phl_eq_transp), bgcolor=color.new(i_phl_1_h_ln_color, i_phl_eq_transp)) 121 | array.push(levelBoxes_equal, ph_box) 122 | 123 | if pl_condition 124 | pl_box = box.new(left=pl_bi_1 - i_phl_1_right, top=pl_price_1, right=pl_bi_0 - i_phl_1_right, bottom=pl_price_0, border_color=color.new(i_phl_1_l_ln_color, i_phl_eq_transp), bgcolor=color.new(i_phl_1_l_ln_color, i_phl_eq_transp)) 125 | array.push(levelBoxes_equal, pl_box) 126 | 127 | // Plot Equal Labels 128 | plotshape(ph_condition ? high[i_phl_1_right] : na, style=shape.xcross, location=location.absolute, offset=-i_phl_1_right, color=color.new(i_phl_1_h_ln_color, i_phl_eq_transp), size=size.small) 129 | plotshape(pl_condition ? low[i_phl_1_right] : na, style=shape.xcross, location=location.absolute, offset=-i_phl_1_right, color=color.new(i_phl_1_l_ln_color, i_phl_eq_transp), size=size.small) 130 | 131 | //____________________________ Equal High Low End 132 | 133 | //____________________________ Get Symbols for Screener Start 134 | 135 | // Acknowledgement & Reference 136 | // Trader: 'allanster' 137 | // Indicator Title: 'How To Input CSV List Of Symbol Data Used For Screener' 138 | // Indicator Link: 'https://www.tradingview.com/script/KfqHqHUH-How-To-Input-CSV-List-Of-Symbol-Data-Used-For-Screener/' 139 | 140 | feed(back) => // extract tickerid and decrement list of ticker IDs 141 | loop = back // declare string variable to hold content list 142 | getT = string(na) // declare string variable to hold tickerid 143 | if str.length(loop) == 0 // if list is empty 144 | getT := string(na) // assign na to tickerid variable 145 | loop := string(na) // assign na to list of ticker Ids variable 146 | else // else extract first tickerid 147 | getP = nz(str.pos(loop, ','), str.length(loop)) // get position of first comma or last character 148 | getT := str.substring(loop, 0, getP) // get tickerid in first position of list 149 | loop := str.replace(loop, getT + ',', '') // clear tickerid + delimiter character from list 150 | [getT, loop] // return tickerid in first position & truncated list 151 | 152 | [tid_001, out_001] = feed(i_symbols), [tid_002, out_002] = feed(out_001), [tid_003, out_003] = feed(out_002), [tid_004, out_004] = feed(out_003), 153 | [tid_005, out_005] = feed(out_004), [tid_006, out_006] = feed(out_005), [tid_007, out_007] = feed(out_006), [tid_008, out_008] = feed(out_007), 154 | [tid_009, out_009] = feed(out_008), [tid_010, out_010] = feed(out_009), [tid_011, out_011] = feed(out_010), [tid_012, out_012] = feed(out_011), 155 | [tid_013, out_013] = feed(out_012), [tid_014, out_014] = feed(out_013), [tid_015, out_015] = feed(out_014), [tid_016, out_016] = feed(out_015), 156 | [tid_017, out_017] = feed(out_016), [tid_018, out_018] = feed(out_017), [tid_019, out_019] = feed(out_018), [tid_020, out_020] = feed(out_019), 157 | [tid_021, out_021] = feed(out_020), [tid_022, out_022] = feed(out_021), [tid_023, out_023] = feed(out_022), [tid_024, out_024] = feed(out_023), 158 | [tid_025, out_025] = feed(out_024), [tid_026, out_026] = feed(out_025), [tid_027, out_027] = feed(out_026), [tid_028, out_028] = feed(out_027), 159 | [tid_029, out_029] = feed(out_028), [tid_030, out_030] = feed(out_029), [tid_031, out_031] = feed(out_030), [tid_032, out_032] = feed(out_031), 160 | [tid_033, out_033] = feed(out_032), [tid_034, out_034] = feed(out_033), [tid_035, out_035] = feed(out_034), [tid_036, out_036] = feed(out_035), 161 | [tid_037, out_037] = feed(out_036), [tid_038, out_038] = feed(out_037), [tid_039, out_039] = feed(out_038), [tid_040, out_040] = feed(out_039) 162 | 163 | //____________________________ Get Symbols for Screener End 164 | 165 | // _____________________________ Screener Start 166 | 167 | // Acknowledgement & Reference 168 | // Trader: 'MUQWISHI' 169 | // Indicator Title: 'Candlestick Patterns Screener [By MUQWISHI]' 170 | // Indicator Link: 'https://www.tradingview.com/script/xiWQuGOq-Candlestick-Patterns-Screener-By-MUQWISHI/' 171 | 172 | // Choose Screening Method 173 | bull_method = 174 | i_scr_choose == 'Equals' ? ph_condition : 175 | ph_pchg < i_phl_eq_percent and ta.crossover(high, ph_price_0) and barstate.isconfirmed 176 | 177 | bear_method = 178 | i_scr_choose == 'Equals' ? pl_condition : 179 | pl_pchg < i_phl_eq_percent and ta.crossunder(low, pl_price_0) and barstate.isconfirmed 180 | 181 | // Screener Conditions 182 | bullish_cond = bull_method 183 | bearish_cond = bear_method 184 | 185 | // Define Bull and Bear Conditions 186 | bull = not(i_scr_direction == "Bearish") 187 | bear = not(i_scr_direction == "Bullish") 188 | 189 | // Function for Screener Indicator Calculation 190 | indicator_calculation() => 191 | // Initialize variables 192 | price = float(na) 193 | _time = int(na) 194 | indicator = "" 195 | signal = int(na) 196 | 197 | if barstate.isconfirmed 198 | // Check for Bearish Momentum Candle and conditions (Modify here to customize indicators) 199 | if i_scr_show_bull and bearish_cond and bear 200 | indicator := "L" 201 | signal := -1 202 | 203 | // Check for Bullish Momentum Candle and conditions (Modify here to customize indicators) 204 | else if i_scr_show_bear and bullish_cond and bull 205 | indicator := "H" 206 | signal := 1 207 | 208 | // Update price and time if signal is not null 209 | if not na(signal) 210 | price := math.round_to_mintick(close) 211 | _time := time 212 | 213 | [_time, indicator, price, signal] 214 | 215 | // Function to format time 216 | format_time(x) => 217 | timezone = syminfo.timezone 218 | timeframe.isintraday ? str.format_time(x, "HH:mm dd-MM-yyyy", timezone) : str.format_time(x, "dd-MM-yyyy", timezone) 219 | 220 | // Function to extract symbol name 221 | symbol(s) => 222 | array.get(str.split(s, ":"), 1) 223 | 224 | // Matrix setup 225 | var matrix = matrix.new(0, 5, na) 226 | 227 | // Function to add rows to the matrix 228 | mtxFun(symbol, _time, indicator, price, signal) => 229 | matrix.add_row(matrix, 0, array.from(symbol, _time, indicator, price, signal)) 230 | 231 | // Screener function to collect data 232 | screener(s) => 233 | sym = ticker.modify(s, syminfo.session) 234 | [_time, indicator, price, signal] = request.security(sym, timeframe.period, indicator_calculation()) 235 | 236 | // Check if the signal is not na and the time matches 237 | if not na(signal) and _time == time 238 | symbolName = symbol(s) 239 | formattedTime = format_time(_time) 240 | strPrice = str.tostring(price) 241 | strSignal = str.tostring(signal) 242 | 243 | // Add data to the matrix 244 | mtxFun(symbolName, formattedTime, indicator, strPrice, strSignal) 245 | 246 | // Call Screener function for multiple symbols 247 | screener(tid_001), screener(tid_002), screener(tid_003), screener(tid_004), screener(tid_005), screener(tid_006), screener(tid_007), 248 | screener(tid_008), screener(tid_009), screener(tid_010), screener(tid_011), screener(tid_012), screener(tid_013), screener(tid_014), 249 | screener(tid_015), screener(tid_016), screener(tid_017), screener(tid_018), screener(tid_019), screener(tid_020), screener(tid_021), 250 | screener(tid_022), screener(tid_023), screener(tid_024), screener(tid_025), screener(tid_026), screener(tid_027), screener(tid_028), 251 | screener(tid_029), screener(tid_030), screener(tid_031), screener(tid_032), screener(tid_033), screener(tid_034), screener(tid_035), 252 | screener(tid_036), screener(tid_037), screener(tid_038), screener(tid_039), screener(tid_040) 253 | 254 | // Trim excess rows in the matrix 255 | if matrix.rows(matrix) > i_tbl_disp_rows 256 | while matrix.rows(matrix) > i_tbl_disp_rows 257 | matrix.remove_row(matrix, matrix.rows(matrix)-1) 258 | 259 | // Plot Table 260 | // Create table with specified properties 261 | var table tbl = table.new(position=i_tbl_position, columns=4, rows=102, border_width=1) 262 | 263 | // Function to populate cells in the table 264 | cell(col, row, txt, color) => 265 | table.cell(tbl, col, row, text = txt, text_color = color, text_halign=text.align_left, bgcolor = color.new(color, 90), text_size=i_tbl_text_size) 266 | 267 | // Check if it's the last bar 268 | if barstate.islast 269 | // Clear existing data in the table 270 | table.clear(tbl, 0, 0, 3, 101) 271 | 272 | // Set headers for the table 273 | cell(0, 0, "Symbol", i_phl_txt_color) 274 | cell(1, 0, "Time", i_phl_txt_color) 275 | cell(2, 0, "Dir" , i_phl_txt_color) 276 | cell(3, 0, "Price", i_phl_txt_color) 277 | 278 | j = 1 279 | // Populate table with matrix data 280 | if matrix.rows(matrix) > 0 281 | for i = 0 to matrix.rows(matrix) - 1 282 | // Determine color based on the signal 283 | col = matrix.get(matrix, i, 4) == "1" ? i_phl_1_h_ln_color : 284 | matrix.get(matrix, i, 4) == "-1" ? i_phl_1_l_ln_color : i_phl_txt_color 285 | 286 | // Populate cells in the table 287 | cell(0, j, matrix.get(matrix, i, 0), col) 288 | cell(1, j, matrix.get(matrix, i, 1), col) 289 | cell(2, j, matrix.get(matrix, i, 2), col) 290 | cell(3, j, matrix.get(matrix, i, 3), col) 291 | 292 | j += 1 293 | 294 | // _____________________________ Screener End 295 | 296 | // _____________________________ Code End 297 | -------------------------------------------------------------------------------- /ICT Equal Highs and Lows/ICT Equal Highs and Lows.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArunKBhaskar/PineScript/c6821225c466494b01eee08f9dd88bf84d2b24ba/ICT Equal Highs and Lows/ICT Equal Highs and Lows.png -------------------------------------------------------------------------------- /ICT Equal Highs and Lows/Readme First.txt: -------------------------------------------------------------------------------- 1 | Indicator: 2 | ICT Equal Highs and Lows Indicator: Only the indicator without Screener 3 | 4 | Screener: 5 | ICT Equal Highs and Lows with Screener: 6 | Two screening methods are available. 7 | One screens the equal levels. 8 | The other screens when price cross the equal levels. 9 | -------------------------------------------------------------------------------- /ICT External Range Liquidity/ICT External Range Liquidity Static Multi-timeframe (Swing High and Low).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArunKBhaskar/PineScript/c6821225c466494b01eee08f9dd88bf84d2b24ba/ICT External Range Liquidity/ICT External Range Liquidity Static Multi-timeframe (Swing High and Low).png -------------------------------------------------------------------------------- /ICT External Range Liquidity/ICT External Range Liquidity Static Multi-timeframe (Swing High and Low).txt: -------------------------------------------------------------------------------- 1 | // This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ 2 | // © Arun_K_Bhaskar 3 | 4 | //@version=5 5 | i_max_bars_back = 4999 6 | indicator(title='ICT External Range Liquidity Static Multi-timeframe (Swing High and Low)', shorttitle='ICT ERL', overlay=true, max_bars_back=i_max_bars_back, max_lines_count=500, max_labels_count=500) 7 | 8 | //____________________________ Menu Pivot High Low Start 9 | 10 | g_phl_qd = '███████████████ Quick On/Off ███████████████' 11 | bool i_phl_1_show = input.bool(defval=true, title='Pivot High Low 1', group=g_phl_qd) 12 | bool i_phl_2_show = input.bool(defval=true, title='Pivot High Low 2', group=g_phl_qd) 13 | bool i_phl_3_show = input.bool(defval=true, title='Pivot High Low 3', group=g_phl_qd) 14 | bool i_phl_eq_show = input.bool(defval=true, title='Equal Pivot High Low', group=g_phl_qd) 15 | 16 | g_phl_co = '██████████████ Common Settings ██████████████' 17 | string i_phl_1_source = input.string(defval='High/Low', title='Source', options=['High/Low', 'Open/Close'], group=g_phl_co) 18 | 19 | g_phl_1 = '██████████████ Pivot High Low 1 ██████████████' 20 | string i_phl_1_tf = input.timeframe(defval="15", title='Timeframe', group=g_phl_1) 21 | int i_phl_1_left = input.int(defval=2, title='Left', group=g_phl_1) 22 | int i_phl_1_right = input.int(defval=2, title='Right', group=g_phl_1) 23 | int i_phl_1_showlast = input.int(defval=2, title='Show Last', minval=0, group=g_phl_1) 24 | bool i_phl_1_ln_extend = input.bool(defval=false, title='Line Extend', group=g_phl_1) 25 | color i_phl_1_h_ln_color = input.color(defval=#F7525F, title='High Color', group=g_phl_1) 26 | color i_phl_1_l_ln_color = input.color(defval=#22AB94, title='Low Color', group=g_phl_1) 27 | string i_phl_1_ln_stye = input.string(defval=line.style_solid, title='Line style', options=[line.style_solid, line.style_dashed, line.style_dotted], group=g_phl_1) 28 | int i_phl_1_ln_width = input.int(defval=2, title='Line Width', minval=1, group=g_phl_1) 29 | bool i_phl_1_lbl_show = input.bool(defval=false, title='Label', group=g_phl_1) 30 | 31 | g_phl_2 = '██████████████ Pivot High Low 2 ██████████████' 32 | string i_phl_2_tf = input.timeframe(defval="60", title='Timeframe', group=g_phl_2) 33 | int i_phl_2_left = input.int(defval=2, title='Left', group=g_phl_2) 34 | int i_phl_2_right = input.int(defval=2, title='Right', group=g_phl_2) 35 | int i_phl_2_showlast = input.int(defval=2, title='Show Last', minval=0, group=g_phl_2) 36 | bool i_phl_2_ln_extend = input.bool(defval=false, title='Line Extend', group=g_phl_2) 37 | color i_phl_2_h_ln_color = input.color(defval=#F7525F, title='High Color', group=g_phl_2) 38 | color i_phl_2_l_ln_color = input.color(defval=#22AB94, title='Low Color', group=g_phl_2) 39 | string i_phl_2_ln_stye = input.string(defval=line.style_solid, title='Line style', options=[line.style_solid, line.style_dashed, line.style_dotted], group=g_phl_2) 40 | int i_phl_2_ln_width = input.int(defval=2, title='Line Width', minval=1, group=g_phl_2) 41 | bool i_phl_2_lbl_show = input.bool(defval=false, title='Label', group=g_phl_2) 42 | 43 | g_phl_3 = '██████████████ Pivot High Low 3 ██████████████' 44 | string i_phl_3_tf = input.timeframe(defval="240", title='Timeframe', group=g_phl_3) 45 | int i_phl_3_left = input.int(defval=2, title='Left', group=g_phl_3) 46 | int i_phl_3_right = input.int(defval=2, title='Right', group=g_phl_3) 47 | int i_phl_3_showlast = input.int(defval=2, title='Show Last', minval=0, group=g_phl_3) 48 | bool i_phl_3_ln_extend = input.bool(defval=false, title='Line Extend', group=g_phl_3) 49 | color i_phl_3_h_ln_color = input.color(defval=#F7525F, title='High Color', group=g_phl_3) 50 | color i_phl_3_l_ln_color = input.color(defval=#22AB94, title='Low Color', group=g_phl_3) 51 | string i_phl_3_ln_stye = input.string(defval=line.style_solid, title='Line style', options=[line.style_solid, line.style_dashed, line.style_dotted], group=g_phl_3) 52 | int i_phl_3_ln_width = input.int(defval=2, title='Line Width', minval=1, group=g_phl_3) 53 | bool i_phl_3_lbl_show = input.bool(defval=false, title='Label', group=g_phl_3) 54 | 55 | g_phl_eq = '███████████████ Equal High Low ███████████████' 56 | int i_phl_eq_left = input.int(defval=60, title='Left', group=g_phl_eq) 57 | int i_phl_eq_right = input.int(defval=30, title='Right', group=g_phl_eq) 58 | tt_eq = "Lower values mean highs and lows are closer." 59 | float i_phl_eq_percent = input.float(defval=0.05, minval=0, step=0.01, title='Equal HL %', tooltip=tt_eq, group=g_phl_eq) 60 | color i_phl_eq_h_ln_color = input.color(defval=#F7525F, title='Bearish Color', group=g_phl_eq) 61 | color i_phl_eq_l_ln_color = input.color(defval=#22AB94, title='Bullish Color', group=g_phl_eq) 62 | int i_phl_eq_transp = input.int(defval=25, minval=0, title='Transparency', group=g_phl_eq) 63 | 64 | //____________________________ Menu Pivot High Low End 65 | 66 | 67 | //____________________________ Pivot High Low Common Functions Start 68 | 69 | // Acknowledgement & Reference 70 | // Trader: "lmatl" 71 | // Indicator Title: "Pivot mtf semaphore support&resistance [LM]" 72 | // Indicator Link: "https://www.tradingview.com/script/OZDSeSQd-Pivot-mtf-semaphore-support-resistance-LM/" 73 | 74 | f_offsetToP(_src, _pivotPrice, _maxBack) => 75 | int _offset = na 76 | float _delta = 10e10 77 | if not na(_pivotPrice) 78 | for _i = 1 to _maxBack by 1 79 | _thisDelta = math.abs(_src[_i] - _pivotPrice) 80 | if _thisDelta < _delta 81 | _delta := _thisDelta 82 | _offset := _i 83 | _offset 84 | _offset 85 | 86 | f_resInMinutes() => 87 | _resInMinutes = timeframe.multiplier * (timeframe.isseconds ? 1. / 60. : timeframe.isminutes ? 1. : timeframe.isdaily ? 1440. : timeframe.isweekly ? 10080. : timeframe.ismonthly ? 43800. : na) 88 | _resInMinutes 89 | 90 | f_tfResInMinutes(_resolution) => 91 | request.security(syminfo.tickerid, _resolution, f_resInMinutes()) 92 | 93 | f_extendArray(_lineArray, _labelArray, _extendLines) => 94 | if array.size(_lineArray) > 0 95 | for _i = array.size(_lineArray) - 1 to 0 by 1 96 | 97 | x2 = line.get_x2(array.get(_lineArray, _i)) 98 | yValue = line.get_y1(array.get(_lineArray, _i)) 99 | 100 | if _extendLines or bar_index - 1 == x2 and not(high > yValue and low < yValue) 101 | line.set_x2(array.get(_lineArray, _i), bar_index) 102 | label.set_x(array.get(_labelArray, _i), bar_index) 103 | float(na) 104 | 105 | f_drawLine(_x1, _x2, _yValue, _lineColor, _lineThickness, _lineStyle) => 106 | line.new(x1=_x1, y1=_yValue, x2=_x2, y2=_yValue, color=_lineColor, style=_lineStyle, width=_lineThickness) 107 | 108 | f_drawLabel(label_show, _x, _y, _textColor) => 109 | if label_show 110 | label.new(_x, _y, '      ' + str.tostring(_y), xloc.bar_index, yloc.price, #00000000, label.style_none, _textColor) 111 | 112 | f_drawPivotLineAndLabel(label_show, _x1, _x2, _yValue, _colorLine, _lineCount, _lineThickness, _lineStyle, _pivotArray, _labelArray) => 113 | line l = f_drawLine(_x1, _x2, _yValue, _colorLine, _lineThickness, _lineStyle) 114 | label lab = f_drawLabel(label_show, _x1, _yValue, _colorLine) 115 | 116 | if array.size(_pivotArray) == _lineCount 117 | line.delete(array.shift(_pivotArray)) 118 | label.delete(array.shift(_labelArray)) 119 | array.push(_pivotArray, l) 120 | array.push(_labelArray, lab) 121 | 122 | f_addLines(label_show, _htfPH, _htfPL, _offsetToPH, _offsetToPL, _newPH, _newPL, h_color, l_color, _lineCount, _lineThickness, _lineStyle, _pivotArray, _pivotLabelArray) => 123 | if _newPH 124 | int x1 = bar_index - _offsetToPH 125 | int x2 = bar_index 126 | float yValue = _htfPH 127 | f_drawPivotLineAndLabel(label_show, x1, x2, yValue, h_color, _lineCount, _lineThickness, _lineStyle, _pivotArray, _pivotLabelArray) 128 | 129 | if _newPL 130 | int x1 = bar_index - _offsetToPL 131 | int x2 = bar_index 132 | float yValue = _htfPL 133 | f_drawPivotLineAndLabel(label_show, x1, x2, yValue, l_color, _lineCount, _lineThickness, _lineStyle, _pivotArray, _pivotLabelArray) 134 | 135 | //____________________________ Pivot High Low Common Functions End 136 | 137 | // Common Calculations 138 | var res_in_minutes = f_resInMinutes() 139 | 140 | // Get Source 141 | float _high = i_phl_1_source == 'Open/Close' ? math.max(open, close) : high 142 | float _low = i_phl_1_source == 'Open/Close' ? math.min(open, close) : low 143 | 144 | 145 | //____________________________ Pivot High Low 1 Get Data & Draw Start 146 | 147 | // Arrays 148 | var phl_1_ln_arr = array.new_line(i_phl_1_showlast) 149 | var phl_1_lbl_arr = array.new_label(i_phl_1_showlast) 150 | 151 | // Get Data 152 | phl_1_bars_htf = int(f_tfResInMinutes(i_phl_1_tf) / res_in_minutes) 153 | phl_1_bars_offset = int(i_phl_1_left * phl_1_bars_htf) 154 | 155 | phl_1_ph = ta.pivothigh(_high, i_phl_1_left, i_phl_1_right) 156 | phl_1_pl = ta.pivotlow(_low, i_phl_1_left, i_phl_1_right) 157 | 158 | phl_1_ph_htf = request.security(syminfo.tickerid, i_phl_1_tf, phl_1_ph) 159 | phl_1_pl_htf = request.security(syminfo.tickerid, i_phl_1_tf, phl_1_pl) 160 | phl_1_ph_new = na(phl_1_ph_htf[1]) and not na(phl_1_ph_htf) 161 | phl_1_pl_new = na(phl_1_pl_htf[1]) and not na(phl_1_pl_htf) 162 | 163 | phl_1_ph_offset = f_offsetToP(_high, phl_1_ph_htf, math.min(i_max_bars_back, math.max(30, phl_1_bars_offset + phl_1_bars_htf + 1))) 164 | phl_1_pl_offset = f_offsetToP(_low, phl_1_pl_htf, math.min(i_max_bars_back, math.max(30, phl_1_bars_offset + phl_1_bars_htf + 1))) 165 | 166 | // Draw 167 | if i_phl_1_show and phl_1_bars_offset <= i_max_bars_back 168 | f_addLines(i_phl_1_lbl_show, phl_1_ph_htf, phl_1_pl_htf, phl_1_ph_offset, phl_1_pl_offset, phl_1_ph_new, phl_1_pl_new, i_phl_1_h_ln_color, i_phl_1_l_ln_color, i_phl_1_showlast, i_phl_1_ln_width, i_phl_1_ln_stye, phl_1_ln_arr, phl_1_lbl_arr) 169 | 170 | if i_phl_1_show 171 | f_extendArray(phl_1_ln_arr, phl_1_lbl_arr, i_phl_1_ln_extend) 172 | //____________________________ Pivot High Low 1 Get Data & Draw End 173 | 174 | 175 | //____________________________ Pivot High Low 2 Get Data & Draw Start 176 | 177 | // Arrays 178 | var phl_2_ln_arr = array.new_line(i_phl_2_showlast) 179 | var phl_2_lbl_arr = array.new_label(i_phl_2_showlast) 180 | 181 | // Get Data 182 | phl_2_bars_htf = int(f_tfResInMinutes(i_phl_2_tf) / res_in_minutes) 183 | phl_2_bars_offset = int(i_phl_2_left * phl_2_bars_htf) 184 | 185 | float phl_2_ph = ta.pivothigh(_high, i_phl_2_left, i_phl_2_right) 186 | float phl_2_pl = ta.pivotlow(_low, i_phl_2_left, i_phl_2_right) 187 | 188 | phl_2_ph_htf = request.security(syminfo.tickerid, i_phl_2_tf, phl_2_ph) 189 | phl_2_pl_htf = request.security(syminfo.tickerid, i_phl_2_tf, phl_2_pl) 190 | phl_2_ph_new = na(phl_2_ph_htf[1]) and not na(phl_2_ph_htf) 191 | phl_2_pl_new = na(phl_2_pl_htf[1]) and not na(phl_2_pl_htf) 192 | 193 | phl_2_ph_offset = f_offsetToP(_high, phl_2_ph_htf, math.min(i_max_bars_back, math.max(30, phl_2_bars_offset + phl_2_bars_htf + 1))) 194 | phl_2_pl_offset = f_offsetToP(_low, phl_2_pl_htf, math.min(i_max_bars_back, math.max(30, phl_2_bars_offset + phl_2_bars_htf + 1))) 195 | 196 | // Draw 197 | if i_phl_2_show and phl_2_bars_offset <= i_max_bars_back 198 | f_addLines(i_phl_2_lbl_show, phl_2_ph_htf, phl_2_pl_htf, phl_2_ph_offset, phl_2_pl_offset, phl_2_ph_new, phl_2_pl_new, i_phl_2_h_ln_color, i_phl_2_l_ln_color, i_phl_2_showlast, i_phl_2_ln_width, i_phl_2_ln_stye, phl_2_ln_arr, phl_2_lbl_arr) 199 | 200 | if i_phl_2_show 201 | f_extendArray(phl_2_ln_arr, phl_2_lbl_arr, i_phl_2_ln_extend) 202 | 203 | //____________________________ Pivot High Low 2 Get Data & Draw End 204 | 205 | 206 | //____________________________ Pivot High Low 3 Get Data & Draw Start 207 | 208 | // Arrays 209 | var phl_3_ln_arr = array.new_line(i_phl_3_showlast) 210 | var phl_3_lbl_arr = array.new_label(i_phl_3_showlast) 211 | 212 | // Get Data 213 | phl_3_bars_htf = int(f_tfResInMinutes(i_phl_3_tf) / res_in_minutes) 214 | phl_3_bars_offset = int(i_phl_3_left * phl_3_bars_htf) 215 | 216 | float phl_3_ph = ta.pivothigh(_high, i_phl_3_left, i_phl_3_right) 217 | float phl_3_pl = ta.pivotlow(_low, i_phl_3_left, i_phl_3_right) 218 | 219 | phl_3_ph_htf = request.security(syminfo.tickerid, i_phl_3_tf, phl_3_ph) 220 | phl_3_pl_htf = request.security(syminfo.tickerid, i_phl_3_tf, phl_3_pl) 221 | phl_3_ph_new = na(phl_3_ph_htf[1]) and not na(phl_3_ph_htf) 222 | phl_3_pl_new = na(phl_3_pl_htf[1]) and not na(phl_3_pl_htf) 223 | 224 | phl_3_ph_offset = f_offsetToP(_high, phl_3_ph_htf, math.min(i_max_bars_back, math.max(30, phl_3_bars_offset + phl_3_bars_htf + 1))) 225 | phl_3_pl_offset = f_offsetToP(_low, phl_3_pl_htf, math.min(i_max_bars_back, math.max(30, phl_3_bars_offset + phl_3_bars_htf + 1))) 226 | 227 | // Draw 228 | if i_phl_3_show and phl_3_bars_offset <= i_max_bars_back 229 | f_addLines(i_phl_3_lbl_show, phl_3_ph_htf, phl_3_pl_htf, phl_3_ph_offset, phl_3_pl_offset, phl_3_ph_new, phl_3_pl_new, i_phl_3_h_ln_color, i_phl_3_l_ln_color, i_phl_3_showlast, i_phl_3_ln_width, i_phl_3_ln_stye, phl_3_ln_arr, phl_3_lbl_arr) 230 | 231 | if i_phl_3_show 232 | f_extendArray(phl_3_ln_arr, phl_3_lbl_arr, i_phl_3_ln_extend) 233 | 234 | //____________________________ Pivot High Low 3 Get Data & Draw End 235 | 236 | 237 | //____________________________ Equal High Low Start 238 | 239 | phl_eq_ph = ta.pivothigh(_high, i_phl_eq_left, i_phl_eq_right) 240 | phl_eq_pl = ta.pivotlow(_low, i_phl_eq_left, i_phl_eq_right) 241 | 242 | i_phl_eq_tf = "" 243 | phl_eq_ph_htf = request.security(syminfo.tickerid, i_phl_eq_tf, phl_eq_ph) 244 | phl_eq_pl_htf = request.security(syminfo.tickerid, i_phl_eq_tf, phl_eq_pl) 245 | 246 | // Arrays to store the last 2 pivot highs and lows 247 | var float[] ph_arr = array.new_float(2) 248 | var int[] ph_bi_arr = array.new_int(2) 249 | var float[] pl_arr = array.new_float(2) 250 | var int[] pl_bi_arr = array.new_int(2) 251 | 252 | // Pivot calculations 253 | int prev_ph_bi = na, int prev_pl_bi = na 254 | bool active_ph = false, bool active_pl = false 255 | bool ph = false, bool pl = false 256 | 257 | // Update the arrays with the last 2 pivot highs and lows 258 | if not na(phl_eq_ph_htf) 259 | ph := true 260 | prev_ph_bi := bar_index - i_phl_eq_right 261 | array.unshift(ph_bi_arr, bar_index) 262 | array.pop(ph_bi_arr) 263 | 264 | if not na(phl_eq_pl_htf) 265 | pl := true 266 | prev_pl_bi := bar_index - i_phl_eq_right 267 | array.unshift(pl_bi_arr, bar_index) 268 | array.pop(pl_bi_arr) 269 | 270 | // Function to update the arrays with the last 2 values 271 | update_arrays(value, array_ref) => 272 | array.unshift(array_ref, value) 273 | array.pop(array_ref) 274 | 275 | // Update arrays with the last 2 pivot highs and lows 276 | if ph 277 | update_arrays(phl_eq_ph_htf, ph_arr) 278 | if pl 279 | update_arrays(phl_eq_pl_htf, pl_arr) 280 | 281 | // Get last two pivot highs and lows 282 | ph_price_0 = array.get(ph_arr, 0), ph_price_1 = array.get(ph_arr, 1) 283 | ph_bi_0 = array.get(ph_bi_arr, 0), ph_bi_1 = array.get(ph_bi_arr, 1) 284 | 285 | pl_price_0 = array.get(pl_arr, 0), pl_price_1 = array.get(pl_arr, 1) 286 | pl_bi_0 = array.get(pl_bi_arr, 0), pl_bi_1 = array.get(pl_bi_arr, 1) 287 | 288 | // Function to calculate percentage change 289 | pchg(price_1, price_2) => 290 | change = price_1 - price_2 291 | percent_change = math.abs((change / price_2) * 100) 292 | percent_change 293 | 294 | // Calculate percentage change between the last two pivot highs and lows 295 | var float ph_pchg = na 296 | var float pl_pchg = na 297 | 298 | if array.size(ph_arr) >= 2 299 | ph_pchg := pchg(array.get(ph_arr, 0), array.get(ph_arr, 1)) 300 | 301 | if array.size(pl_arr) >= 2 302 | pl_pchg := pchg(array.get(pl_arr, 0), array.get(pl_arr, 1)) 303 | 304 | // Draw Equals Box 305 | var levelBoxes_equal=array.new_box() 306 | 307 | if i_phl_eq_show and ph and ph_pchg < i_phl_eq_percent 308 | ph_box = box.new(left=ph_bi_1 - i_phl_eq_right, top=ph_price_1, right=ph_bi_0 - i_phl_eq_right, bottom=ph_price_0, border_color=color.new(i_phl_eq_h_ln_color, i_phl_eq_transp), bgcolor=color.new(i_phl_eq_h_ln_color, i_phl_eq_transp)) 309 | array.push(levelBoxes_equal, ph_box) 310 | if i_phl_eq_show and pl and pl_pchg < i_phl_eq_percent 311 | pl_box = box.new(left=pl_bi_1 - i_phl_eq_right, top=pl_price_1, right=pl_bi_0 - i_phl_eq_right, bottom=pl_price_0, border_color=color.new(i_phl_eq_l_ln_color, i_phl_eq_transp), bgcolor=color.new(i_phl_eq_l_ln_color, i_phl_eq_transp)) 312 | array.push(levelBoxes_equal, pl_box) 313 | 314 | // Plot Equal Labels 315 | plotshape(i_phl_eq_show and pl and pl_pchg < i_phl_eq_percent ? low[i_phl_eq_right] : na, style=shape.xcross, location=location.absolute, offset=-i_phl_eq_right, color=color.new(i_phl_eq_l_ln_color, i_phl_eq_transp), size=size.small) 316 | plotshape(i_phl_eq_show and ph and ph_pchg < i_phl_eq_percent ? high[i_phl_eq_right] : na, style=shape.xcross, location=location.absolute, offset=-i_phl_eq_right, color=color.new(i_phl_eq_h_ln_color, i_phl_eq_transp), size=size.small) 317 | 318 | //____________________________ Equal High Low End 319 | 320 | //____________________________ CODE END -------------------------------------------------------------------------------- /ICT External Range Liquidity/Readme First.txt: -------------------------------------------------------------------------------- 1 | Relevance of this indicator: 2 | 1. This indicator is useful because it keeps its levels the same, even when you change the chart's timeframe, making it reliable for analysis. 3 | 2. This indicator also displays equal highs and lows, which serve as crucial reference points for analysis. 4 | 5 | Reference Videos: The indicator is developed based on the following video contents. 6 | 7 | Original The Inner Circle Trader Video: 8 | Video Title: ICT Mentorship Core Content - Month 04 - Reinforcing Liquidity Concepts & Price Delivery 9 | Video Link: https://www.youtube.com/watch?v=npL3ZXJ5zOU 10 | 11 | A Simplified Explanation from TTrades: 12 | Video Title: Internal & External Liquidity (Daily Bias) - ICT Concepts 13 | Video Link: https://www.youtube.com/watch?v=3OivsP1j_UE&t=1s 14 | 15 | The indicator is based on the following indicator: 16 | Indicator Title: "Pivot mtf semaphore support&resistance [LM]" 17 | Indicator Link: "https://www.tradingview.com/script/OZDSeSQd-Pivot-mtf-semaphore-support-resistance-LM/" 18 | 19 | Note: 20 | Please note that the information provided is purely suggested for educational purposes and not intended as promotion. There are no personal preferences involved, and no endorsement of any individual or entity is implied. -------------------------------------------------------------------------------- /ICT External and Internal Range Liquidity/ICT External and Internal Range Liquidity Multi-timeframe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArunKBhaskar/PineScript/c6821225c466494b01eee08f9dd88bf84d2b24ba/ICT External and Internal Range Liquidity/ICT External and Internal Range Liquidity Multi-timeframe.png -------------------------------------------------------------------------------- /ICT External and Internal Range Liquidity/Readme First.txt: -------------------------------------------------------------------------------- 1 | Relevance of this indicator: 2 | 1. This indicator is useful because it keeps its levels the same, even when you change the chart's timeframe, making it reliable for analysis. 3 | 2. This indicator displays External Range Liquidity levels which are swing highs and lows. 4 | 3. This indicator displays Interal Range Liquidity levels which are Fair Value Gaps. 5 | 4. This indicator also displays equal highs and lows, which serve as crucial reference points for analysis. 6 | 7 | Reference Videos: The indicator is developed based on the following video contents. 8 | 9 | Original The Inner Circle Trader Video: 10 | Video Title: ICT Mentorship Core Content - Month 04 - Reinforcing Liquidity Concepts & Price Delivery 11 | Video Link: https://www.youtube.com/watch?v=npL3ZXJ5zOU 12 | 13 | Video Title: ICT Mentorship Core Content - Month 04 - ICT Fair Value Gaps FVG 14 | Video Link: https://www.youtube.com/watch?v=FgacYSN9QEo 15 | 16 | A Simplified Explanation from TTrades: 17 | Video Title: Internal & External Liquidity (Daily Bias) - ICT Concepts 18 | Video Link: https://www.youtube.com/watch?v=3OivsP1j_UE&t=1s 19 | 20 | The indicator is based on the following indicator: 21 | Indicator Title: "Pivot mtf semaphore support&resistance [LM]" 22 | Indicator Link: "https://www.tradingview.com/script/OZDSeSQd-Pivot-mtf-semaphore-support-resistance-LM/" 23 | 24 | Indicator Title: "ICT HTF FVGs (fadi)" 25 | Indicator Link: "https://www.tradingview.com/script/Cti9P1Ww-ICT-HTF-FVGs-fadi/" 26 | 27 | ICT Private Mentorship Core Content Playlist Links: 28 | 29 | 2016 ICT Private Mentorship Core Content Month 01 30 | https://www.youtube.com/playlist?list=PLVgHx4Z63paYzh3KwUFX0UHQUf31CAEXk 31 | 32 | 2016 ICT Private Mentorship Core Content Month 02 33 | https://www.youtube.com/playlist?list=PLVgHx4Z63paZvjqerfbn320myZ06L1MOB 34 | 35 | 2016 ICT Private Mentorship Core Content Month 03 36 | https://www.youtube.com/playlist?list=PLVgHx4Z63paaY69GotBJyZ7KN_U09ra2o 37 | 38 | 2016 ICT Private Mentorship Core Content Month 04 39 | https://www.youtube.com/playlist?list=PLVgHx4Z63pabb9rl1nyG58TG8PG8yzuao 40 | 41 | 2017 ICT Private Mentorship Core Content Month 05 42 | https://www.youtube.com/playlist?list=PLVgHx4Z63paYBN404Q2QZ7D4mOJz1IHAk 43 | 44 | 2017 ICT Private Mentorship Core Content Month 06 45 | https://www.youtube.com/playlist?list=PLVgHx4Z63paaG-26YEf2svQ_EsdGXjws1 46 | 47 | 2017 ICT Private Mentorship Core Content Month 07 48 | https://www.youtube.com/playlist?list=PLVgHx4Z63paYWV_3PDkYajv_oNznvK2aR 49 | 50 | 2017 ICT Private Mentorship Core Content Month 08 51 | https://www.youtube.com/playlist?list=PLVgHx4Z63paZrCT5EaUhJ6sCVNaegCf_c 52 | 53 | 2017 ICT Private Mentorship Core Content Month 09 54 | https://www.youtube.com/playlist?list=PLVgHx4Z63paZfDRSk94aEMoYKUBqQgj0b 55 | 56 | 2017 ICT Private Mentorship Core Content Month 10 57 | https://www.youtube.com/playlist?list=PLVgHx4Z63paZdnxymLp2Ihj-Pc_-foVVV 58 | 59 | 2017 ICT Private Mentorship Core Content Month 11 60 | https://www.youtube.com/playlist?list=PLVgHx4Z63paa4FfJ8zI_QpdJICSLkXTQO 61 | 62 | 2017 ICT Private Mentorship Core Content Month 12 63 | https://www.youtube.com/playlist?list=PLVgHx4Z63paaQ-8s2wrhfi6N2O_lTPuAI 64 | 65 | Note: 66 | Please note that the information provided is purely suggested for educational purposes and not intended as promotion. There are no personal preferences involved, and no endorsement of any individual or entity is implied. -------------------------------------------------------------------------------- /ICT Fair Value Gap (FVG) Scanner/Readme First.txt: -------------------------------------------------------------------------------- 1 | // Readme First: 2 | 3 | // ICT Fair Value Gap (FVG) Scanner 4 | 5 | // Logic 6 | // - A fully filled Fair Value Gap (FVG) is more likely to bounce back with strong momentum. 7 | // - If the FVG is larger in height, the probability of a bounce back increases. 8 | // - In most live trading sessions by ICT, a large FVG is often filled slowly or with high resistance. 9 | // - This is similar to filling a Liquidity Void. 10 | 11 | // Notes 12 | // - Use a higher timeframe, like 1 hour, for stock selection. 13 | // - The Scanner will generate wrong signals also. -------------------------------------------------------------------------------- /ICT Fair Value Gap (FVG) Scanner/Screenshot - ICT Fair Value Gap (FVG) Scanner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArunKBhaskar/PineScript/c6821225c466494b01eee08f9dd88bf84d2b24ba/ICT Fair Value Gap (FVG) Scanner/Screenshot - ICT Fair Value Gap (FVG) Scanner.png -------------------------------------------------------------------------------- /ICT Liquidity Sweep Pattern Scanner/Readme First.txt: -------------------------------------------------------------------------------- 1 | // Readme First: 2 | 3 | // ICT Liquidity Sweep Pattern Scanner 4 | 5 | // Logic 6 | // - This generally identifies bullish or bearish liquidity sweeps of previous 1st, 2nd, or 3rd swings. 7 | 8 | // Notes 9 | // - Use higher timeframes for stock selection and trade in lower timeframes. 10 | // - The scanner may also generate incorrect signals. -------------------------------------------------------------------------------- /ICT Liquidity Sweep Pattern Scanner/Screenshot - ICT Liquidity Sweep Pattern Scanner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArunKBhaskar/PineScript/c6821225c466494b01eee08f9dd88bf84d2b24ba/ICT Liquidity Sweep Pattern Scanner/Screenshot - ICT Liquidity Sweep Pattern Scanner.png -------------------------------------------------------------------------------- /ICT Liquidity Void Fill/Readme First.txt: -------------------------------------------------------------------------------- 1 | // Readme First: 2 | 3 | // ICT Liquidity Void Fill Scanner 4 | 5 | // Logic 6 | // - This identifies a momentum candle, an 80% body candle with high volatility, or a displacement. 7 | // - A signal is generated when the price retraces to the candle body, void, or FVG, based on the Fibonacci value. 8 | 9 | // Notes 10 | // - Use a higher timeframe, like 4 hour or 1 hour, for stock selection. 11 | // - The Scanner will generate wrong signals also. 12 | -------------------------------------------------------------------------------- /ICT Liquidity Void Fill/[Indicator] ICT Liquidity Void Fill.txt: -------------------------------------------------------------------------------- 1 | // This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ 2 | // © Arun_K_Bhaskar 3 | 4 | //@version=6 5 | indicator(title = 'ICT Liquidity Void Fill', shorttitle = 'ICT LV Fill', overlay = true, max_lines_count = 500) 6 | 7 | //_____________________________ Menu Start 8 | 9 | string g_lv = '███████████████ Liquidity Void ███████████████' 10 | 11 | string tt_lv_fib = 12 | "• '0' → Bottom of a bullish candle, top of a bearish candle." + 13 | "\n• '1' → Top of a bullish candle, bottom of a bearish candle." + 14 | "\n• '0.5' → 50% level of the candle." + 15 | "\n• Other Fibonacci/OTE values like 0.62, 0.705, 0.79, etc., are usable." + 16 | "\n• Range: Min = 0, Max = 1." 17 | 18 | bool i_scr_show_long = input.bool(defval = true, title = 'Long Signals', inline = 'tb_2', group = g_lv) 19 | bool i_scr_show_short = input.bool(defval = true, title = 'Short Signals', inline = 'tb_2', group = g_lv) 20 | float i_fib_val = input.float(defval = 0.5, title = 'Fib Value', minval = 0, maxval = 1, step = 0.1, tooltip = tt_lv_fib, group = g_lv) 21 | string i_fvg_ln_style = input.string(defval = line.style_solid, title = 'Line Style', options = [line.style_solid, line.style_dashed, line.style_dotted], group = g_lv) 22 | 23 | string g_af = '██████████████ Additional Fiters ██████████████' 24 | 25 | string tt_atr = 26 | "• Applicable only to 1st displacement, 80%, or momentum candles." + 27 | "\n• ATR filters out longer or more volatile candles."+ 28 | "\n• Higher multiplier value filters longer/volatile 1st candle." 29 | string tt_bf = 30 | "• Applicable only to 1st displacement, 80%, or momentum candles." + 31 | "\n• If the input is '80', the candle's body covers over 80% of its total length." 32 | string tt_bs = 33 | "• Applicable only to 1st displacement, 80%, or momentum candles." + 34 | "\n• If the input is '2', the candle is twice the size of the previous candle." 35 | string tt_tf = 36 | "• Applicable only to the retracement candle." + 37 | "\n• Filter out a signals between the given Time." 38 | string tt_df = 39 | "• Applicable only to the retracement candle." + 40 | "\n• Filter out a signals on the given Date." + 41 | "\n• Turn this on and enter yesterday's date to generate signals for yesterday." 42 | 43 | bool i_atr_filter = input.bool(defval = true, title = 'Apply ATR Filter', tooltip = tt_atr, group = g_af) 44 | int i_atr_length = input.int(defval = 14, minval = 1, title = 'ATR Length', group = g_af) 45 | float i_atr_multi = input.float(defval = 1, title = 'ATR Multiplier', minval = 1, group = g_af) 46 | 47 | bool i_body_filter = input.bool(defval = true, title = 'Apply Body % Filter', tooltip = tt_bf, group = g_af) 48 | float i_body_percent = input.float(defval = 80, title = 'Body % Above', minval = 0, maxval = 100, group = g_af) / 100 49 | 50 | bool i_body_size_filter = input.bool(defval = false, title = 'Apply Body Size Filter', tooltip = tt_bs, group = g_af) 51 | int i_body_size_multiplier = input.int(defval = 2, title = 'Body Size Multiplier (x)', minval = 0, group = g_af) 52 | 53 | bool i_time_filter = input.bool(defval = false, title = 'Apply Time Filter', tooltip = tt_tf, group = g_af) 54 | int i_hour_1 = input.int(defval = 9, minval = 0, title = 'Time From', inline = 't_1', group = g_af) 55 | int i_minute_1 = input.int(defval = 15, minval = 0, title = ':', inline = 't_1', group = g_af) 56 | int i_hour_2 = input.int(defval = 10, minval = 0, title = 'Time To ', inline = 't_2', group = g_af) 57 | int i_minute_2 = input.int(defval = 15, minval = 0, title = ':', inline = 't_2', group = g_af) 58 | 59 | bool i_date_filter = input.bool(defval = false, title = 'Apply Date Filter', tooltip = tt_df, group = g_af) 60 | int i_day = input.int(defval = 13, minval = 1, maxval = 31, title = 'Day', group = g_af) 61 | int i_month = input.int(defval = 03, minval = 1, maxval = 12, title = 'Month', group = g_af) 62 | int i_year = input.int(defval = 2025, minval = 0, title = 'Year', group = g_af) 63 | 64 | string g_ch = '███████████████ Chart Settings ███████████████' 65 | 66 | color i_pos_color = input.color(defval = #089981, title = 'Positive Mid', group = g_ch) 67 | color i_pos_light_color = input.color(defval = #ACE5DC, title = 'Positive Light', group = g_ch) 68 | color i_neg_light_color = input.color(defval = #FCCBCD, title = 'Negative Light', group = g_ch) 69 | color i_neg_color = input.color(defval = #F23645, title = 'Negative Mid', group = g_ch) 70 | color i_neu_color = input.color(defval = #9C9C9C, title = 'Neutral Light', group = g_ch) 71 | color i_neu_dark_color = input.color(defval = #0F0F0F, title = 'Neutral Dark', group = g_ch) 72 | 73 | //_____________________________ Menu End 74 | 75 | //_____________________________ Additional Filters Start 76 | 77 | // ATR Filter 78 | bool atr_filter = true 79 | if i_atr_filter 80 | atr_filter := high - low > ta.atr(i_atr_length) * i_atr_multi 81 | 82 | // Body Percent Filter 83 | bool body_filter = true 84 | if i_body_filter 85 | body_filter := math.abs(close - open) / (high - low) >= i_body_percent 86 | 87 | // Body Size Filter 88 | bool body_size_filter = true 89 | if i_body_size_filter 90 | body_size_filter := math.abs(close - open) / (high - low) >= i_body_percent and high - low >= (high[1] - low[1]) * i_body_size_multiplier 91 | 92 | // Time Filter 93 | bool time_filter = true 94 | if i_time_filter 95 | time_filter := (hour > i_hour_1 or hour == i_hour_1 and minute >= i_minute_1) and (hour < i_hour_2 or hour == i_hour_2 and minute < i_minute_2) 96 | 97 | // Date Filter 98 | bool date_filter = true 99 | if i_date_filter 100 | date_filter := year == i_year and month == i_month and dayofmonth == i_day 101 | 102 | //_____________________________ Additional Filters End 103 | 104 | //_____________________________ Fibonacci Start 105 | 106 | // Fibonacci Function 107 | fibonacci(bool calc_from_high, float high_value, float low_value, float fib_value) => 108 | if calc_from_high 109 | low_value + (high_value - low_value) * fib_value 110 | else 111 | high_value - (high_value - low_value) * fib_value 112 | 113 | //_____________________________ Fibonacci End 114 | 115 | //_____________________________ Signals Start 116 | 117 | // Short Condition 1 118 | short_cont_1 = 119 | open > close and 120 | atr_filter and 121 | body_filter and 122 | body_size_filter 123 | 124 | var short_cont_1_high = float(na) 125 | var short_cont_1_low = float(na) 126 | var short_cont_1_bi = int(na) 127 | if short_cont_1 128 | short_cont_1_high := high 129 | short_cont_1_low := low 130 | short_cont_1_bi := bar_index 131 | 132 | float bear_fib_val = fibonacci(false, short_cont_1_high, short_cont_1_low, i_fib_val) 133 | 134 | // Short Condition 2 135 | short_cont_2 = 136 | ta.crossover(high, bear_fib_val) and 137 | time_filter and 138 | date_filter and 139 | barstate.isconfirmed 140 | 141 | // Short Retracement Signal 142 | var short_curr_state = 0 143 | short_prev_state = nz(short_curr_state[1]) 144 | short_curr_state := short_prev_state == 2 ? 0 : short_prev_state 145 | if short_cont_1 and short_curr_state == 0 146 | short_curr_state := 1 147 | if not short_cont_1 and short_cont_2 and short_curr_state == 1 148 | short_curr_state := 2 149 | 150 | short_ret_signal = short_curr_state == 2 ? true : false 151 | 152 | 153 | // Long Condition 1 154 | long_cont_1 = 155 | open < close and 156 | atr_filter and 157 | body_filter and 158 | body_size_filter 159 | 160 | var long_cont_1_high = float(na) 161 | var long_cont_1_low = float(na) 162 | var long_cont_1_bi = int(na) 163 | if long_cont_1 164 | long_cont_1_high := high 165 | long_cont_1_low := low 166 | long_cont_1_bi := bar_index 167 | 168 | float bull_fib_val = fibonacci(true, long_cont_1_high, long_cont_1_low, i_fib_val) 169 | 170 | // Long Condition 2 171 | long_cont_2 = 172 | ta.crossunder(low, bull_fib_val) and 173 | time_filter and 174 | date_filter and 175 | barstate.isconfirmed 176 | 177 | // Long Retracement 178 | var long_curr_state = 0 179 | long_prev_state = nz(long_curr_state[1]) 180 | long_curr_state := long_prev_state == 2 ? 0 : long_prev_state 181 | if long_cont_1 and long_curr_state == 0 182 | long_curr_state := 1 183 | if not long_cont_1 and long_cont_2 and long_curr_state == 1 184 | long_curr_state := 2 185 | 186 | long_ret_signal = long_curr_state == 2 ? true : false 187 | 188 | //_____________________________ Signals End 189 | 190 | //_____________________________ Plot Start 191 | 192 | // Plot 193 | plotshape(series = i_scr_show_short and short_ret_signal ? 3 : na, title = 'Short Signal', style = shape.triangledown, location = location.abovebar, color = i_neg_light_color, size = size.tiny, force_overlay = true) 194 | plotshape(series = i_scr_show_long and long_ret_signal ? 3 : na, title = 'Long Signal', style = shape.triangleup, location = location.belowbar, color = i_pos_light_color, size = size.tiny, force_overlay = true) 195 | barcolor(color = i_scr_show_short and short_cont_1 ? i_neg_light_color : i_scr_show_long and long_cont_1 ? i_pos_light_color : na, title = '80% Candle') 196 | 197 | // Line 198 | var line_array = array.new_line() 199 | 200 | if i_scr_show_short and short_ret_signal 201 | array.push(line_array, line.new(x1 = short_cont_1_bi, y1 = bear_fib_val, x2 = bar_index, y2 = bear_fib_val, color = i_neg_color, style = i_fvg_ln_style)) 202 | 203 | if i_scr_show_long and long_ret_signal 204 | array.push(line_array, line.new(x1 = long_cont_1_bi, y1 = bull_fib_val, x2 = bar_index, y2 = bull_fib_val, color = i_pos_color, style = i_fvg_ln_style)) 205 | 206 | //_____________________________ Plot End 207 | 208 | //_____________________________ Code End 209 | 210 | // Readme First: 211 | 212 | // ICT Liquidity Void Fill Scanner 213 | 214 | // Logic 215 | // - This identifies a momentum candle, an 80% body candle with high volatility, or a displacement. 216 | // - A signal is generated when the price retraces to the candle body, void, or FVG, based on the Fibonacci value. 217 | 218 | // Notes 219 | // - Use a higher timeframe, like 4 hour or 1 hour, for stock selection. 220 | // - The Scanner will generate wrong signals also. 221 | -------------------------------------------------------------------------------- /ICT Liquidity Void Fill/[Screenshot] ICT Liquidity Void Fill Scanner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArunKBhaskar/PineScript/c6821225c466494b01eee08f9dd88bf84d2b24ba/ICT Liquidity Void Fill/[Screenshot] ICT Liquidity Void Fill Scanner.png -------------------------------------------------------------------------------- /ICT Liquidity Void/ICT Liquidity Void Multi-timeframe.txt: -------------------------------------------------------------------------------- 1 | // This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ 2 | // © Arun_K_Bhaskar 3 | 4 | //@version=5 5 | indicator(title="ICT Liquidity Void Multi-timeframe", shorttitle="ICT LV", overlay=true) 6 | 7 | //_____________________________ Menu Liquidity Void Start 8 | 9 | g_lv = '███████████████ Liquidity Void ███████████████' 10 | string i_lv_htf = input.timeframe(defval='', title='Timeframe', group=g_lv) 11 | int i_lv_show_last = input.int(defval=2, title='Show Last', minval=0, group=g_lv) 12 | string i_lv_line = input.string(defval='High/Low', title='Source', options=['High/Low', 'OTE 0.79%', '50%'], group=g_lv) 13 | bool i_lv_bear_show = input.bool(defval=true, title='Bearish', group=g_lv) 14 | bool i_lv_bull_show = input.bool(defval=true, title='Bullish', group=g_lv) 15 | bool i_lv_hide_crossed = input.bool(defval=false, title='Hide Crossed', group=g_lv) 16 | 17 | g_lv_f = "Void Height Filter" 18 | tt_lv_f = "• Filters remove narrow liquidity voids." + 19 | "\n• ATR filtering adjusts automatically when the timeframe changes." + 20 | "\n• Percentage filter will be constant across all timeframes." + 21 | "\n• If you don't want any filtering, choose 'Percentage' and then change Percentage to 0." 22 | string i_lv_additional = input.string(defval='ATR', title='Filter Using', options=['ATR', 'Percentage'], tooltip=tt_lv_f, group=g_lv_f) 23 | tt_lv_atr = "Applicable only if 'Filter Using' is 'ATR'" 24 | int i_lv_atr_length = input.int(defval=14, minval=1, title='ATR Period', tooltip=tt_lv_atr, group=g_lv_f) 25 | tt_lv_atr_m = "Higher the number, filters higher void height." 26 | float i_lv_atr_multi = input.float(defval=4, minval=1, title='ATR Multiplier', tooltip=tt_lv_atr_m, group=g_lv_f) 27 | tt_lv_p = "Filters liquidity void above the given percentage." 28 | float i_lv_percentage = input.float(defval=2.5, minval=0, step=0.1, title='Percentage Above', tooltip=tt_lv_p, group=g_lv_f) 29 | 30 | g_lv_ds = "Display Settings" 31 | color i_lv_bear_color = input.color(defval=#F7525F, title='Bearish Color', group=g_lv_ds) 32 | color i_lv_bull_color = input.color(defval=#22AB94, title='Bullish Color', group=g_lv_ds) 33 | string i_lv_ln_style = input.string(defval=line.style_solid, title="Line Style", options=[line.style_solid, line.style_dashed, line.style_dotted], group=g_lv_ds) 34 | int i_lv_ln_width = input.int(defval=2, title='Width', group=g_lv_ds) 35 | int i_lv_box_trans = input.int(defval=75, title='Box Transparency', group=g_lv_ds) 36 | 37 | //_____________________________ Menu Liquidity Void End 38 | 39 | //_____________________________ Get Data Start 40 | 41 | [open_htf, high_htf, low_htf, close_htf, time_htf, atr_htf, bc_htf] = 42 | request.security(symbol=syminfo.tickerid, timeframe=i_lv_htf, expression=[open, high, low, close, time, ta.atr(i_lv_atr_length), barstate.isconfirmed], lookahead=barmerge.lookahead_on) 43 | 44 | //_____________________________ Get Data End 45 | 46 | //_____________________________ Functions Start 47 | 48 | // Function to calculate filter based on ATR or percentage 49 | filter(prev_value, other_value, _atr_htf, _atr_multi, _percentage, _additional) => 50 | filter_atr = math.abs(prev_value - other_value) > _atr_htf * _atr_multi 51 | filter_percent = math.abs((prev_value - other_value) / prev_value * 100) > _percentage 52 | _additional == 'ATR' ? filter_atr : filter_percent 53 | 54 | // Function to determine line type 55 | price_source(float prev_value, float other_value, string price_source) => 56 | price_source == 'High/Low' ? prev_value : 57 | price_source == 'OTE 0.79%' ? other_value + ((prev_value - other_value) * 0.79) : 58 | price_source == 'OTE 0.79%' ? other_value - ((prev_value - other_value) * 0.79) : 59 | math.avg(prev_value, other_value) 60 | 61 | draw_line(int x1_time, float y1_price, color _color)=> 62 | line.new(x1=x1_time, y1=y1_price, x2=time_htf, y2=y1_price, xloc=xloc.bar_time, color=_color, style=i_lv_ln_style, width=i_lv_ln_width) 63 | 64 | draw_box(int left_time, float top_price, float bottom_price, color _color)=> 65 | box.new(left=left_time, top=top_price, right=time_htf, bottom=bottom_price, xloc=xloc.bar_time, border_color=color.new(_color, i_lv_box_trans), bgcolor=color.new(_color, i_lv_box_trans)) 66 | 67 | // Function to handle array operations and cleanup 68 | clean_arrays(_all_lines, _keep_lines, _all_boxes, _keep_boxes, _lv_line, _lv_box) => 69 | 70 | array.push(_all_lines, _lv_line) 71 | array.push(_all_boxes, _lv_box) 72 | 73 | if array.size(_all_lines) > i_lv_show_last 74 | removed_line = array.shift(_all_lines) 75 | if array.includes(_keep_lines, removed_line) 76 | index_of_removed_line = array.indexof(_keep_lines, removed_line) 77 | array.remove(_keep_lines, index_of_removed_line) 78 | line.delete(removed_line) 79 | 80 | if array.size(_all_boxes) > i_lv_show_last 81 | removed_box = array.shift(_all_boxes) 82 | if array.includes(_keep_boxes, removed_box) 83 | index_of_removed_box = array.indexof(_keep_boxes, removed_box) 84 | array.remove(_keep_boxes, index_of_removed_box) 85 | box.delete(removed_box) 86 | 87 | break_object(float price) => 88 | high_htf >= price and low_htf <= price 89 | 90 | update_lines(lines, keep_lines, int _time) => 91 | for current_line in lines 92 | if not array.includes(keep_lines, current_line) 93 | line.set_x2(current_line, _time) 94 | line_price = line.get_y1(current_line) 95 | if break_object(line_price) 96 | array.push(keep_lines, current_line) 97 | 98 | update_boxes(boxes, keep_boxes, int _time) => 99 | for current_box in boxes 100 | if not array.includes(keep_boxes, current_box) 101 | box.set_right(current_box, _time) 102 | box_price = box.get_top(current_box) 103 | if break_object(box_price) 104 | array.push(keep_boxes, current_box) 105 | 106 | clean_lines(keep_lines, all_lines) => 107 | for keep_line in keep_lines 108 | line_price = line.get_y1(keep_line) 109 | if i_lv_hide_crossed and break_object(line_price) 110 | line.delete(keep_line) 111 | index = array.indexof(all_lines, keep_line) 112 | if not na(index) 113 | array.remove(all_lines, index) 114 | 115 | clean_boxes(keep_boxes, all_boxes) => 116 | for keep_box in keep_boxes 117 | box_price = box.get_bottom(keep_box) 118 | if i_lv_hide_crossed and break_object(box_price) 119 | box.delete(keep_box) 120 | index = array.indexof(all_boxes, keep_box) 121 | if not na(index) 122 | array.remove(all_boxes, index) 123 | 124 | //_____________________________ Functions End 125 | 126 | //_____________________________ Liquidity Void Bearish Start 127 | 128 | var float bear_prev_low = na, var int bear_prev_low_time = na 129 | var bear_keep_lines = array.new_line(), var bear_all_lines = array.new_line() 130 | var bear_keep_boxes = array.new_box(), var bear_all_boxes = array.new_box() 131 | 132 | if i_lv_bear_show and bc_htf and (close_htf > open_htf) 133 | bear_filter = filter(bear_prev_low, high_htf, atr_htf, i_lv_atr_multi, i_lv_percentage, i_lv_additional) 134 | bear_price_source = price_source(bear_prev_low, high_htf, i_lv_line) 135 | 136 | if (na(bear_prev_low) or high_htf <= bear_prev_low) and bear_filter 137 | lv_bear_line = draw_line(bear_prev_low_time, bear_price_source, i_lv_bear_color) 138 | lv_bear_box = draw_box(bear_prev_low_time, high_htf, bear_prev_low, i_lv_bear_color) 139 | clean_arrays(bear_all_lines, bear_keep_lines, bear_all_boxes, bear_keep_boxes, lv_bear_line, lv_bear_box) 140 | 141 | bear_prev_low := low_htf 142 | bear_prev_low_time := time_htf 143 | 144 | // Update 145 | update_lines(bear_all_lines, bear_keep_lines, time_htf) 146 | update_boxes(bear_all_boxes, bear_keep_boxes, time_htf) 147 | 148 | // Clean 149 | clean_lines(bear_keep_lines, bear_all_lines) 150 | clean_boxes(bear_keep_boxes, bear_all_boxes) 151 | 152 | //_____________________________ Liquidity Void Bearish End 153 | 154 | //_____________________________ Liquidity Void Bullish Start 155 | 156 | var float bull_prev_high = na, var int bull_prev_high_time = na 157 | var bull_keep_lines = array.new_line(), var bull_all_lines = array.new_line() 158 | var bull_keep_boxes = array.new_box(), var bull_all_boxes = array.new_box() 159 | 160 | if i_lv_bull_show and bc_htf and (close_htf < open_htf) 161 | bull_filter = filter(bull_prev_high, low_htf, atr_htf, i_lv_atr_multi, i_lv_percentage, i_lv_additional) 162 | bull_price_source = price_source(bull_prev_high, low_htf, i_lv_line) 163 | 164 | if (na(bull_prev_high) or low_htf >= bull_prev_high) and bull_filter 165 | lv_bull_line = draw_line(bull_prev_high_time, bull_price_source, i_lv_bull_color) 166 | lv_bull_box = draw_box(bull_prev_high_time, low_htf, bull_prev_high, i_lv_bull_color) 167 | clean_arrays(bull_all_lines, bull_keep_lines, bull_all_boxes, bull_keep_boxes, lv_bull_line, lv_bull_box) 168 | 169 | bull_prev_high := high_htf 170 | bull_prev_high_time := time_htf 171 | 172 | // Update 173 | update_lines(bull_all_lines, bull_keep_lines, time_htf) 174 | update_boxes(bull_all_boxes, bull_keep_boxes, time_htf) 175 | 176 | // Clean 177 | clean_lines(bull_keep_lines, bull_all_lines) 178 | clean_boxes(bull_keep_boxes, bull_all_boxes) 179 | 180 | //_____________________________ Liquidity Void Bullish End 181 | 182 | //_____________________________ Code End 183 | -------------------------------------------------------------------------------- /ICT Liquidity Void/ICT Liquidity Void Screener.txt: -------------------------------------------------------------------------------- 1 | // This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ 2 | // © Arun_K_Bhaskar 3 | 4 | //@version=5 5 | indicator(title="ICT Liquidity Void Screener", shorttitle="ICT LV Scr", overlay=true) 6 | 7 | //_____________________________ Menu Screener Start 8 | 9 | g_tb = '█████████████████ Screener █████████████████' 10 | 11 | tt_is = "• Input exactly 40 symbols, nothing more or less." + 12 | "\n• Total characters cannot exceed 4096." + 13 | "\n• Use comma as delimiter without any space." + 14 | "\n• Eg: EXCHANGE:SYMBOL_A,EXCHANGE:SYMBOL_B" 15 | string i_symbols = input.text_area( 16 | defval="NSE:AEGISCHEM,NSE:BANKINDIA,NSE:BHEL,NSE:BLS,NSE:CASTROLIND,NSE:CESC,NSE:CGPOWER,NSE:CHAMBLFERT,NSE:DELTACORP,NSE:DEVYANI,NSE:EQUITASBNK,NSE:GAEL,NSE:GPPL,NSE:GSFC,NSE:HUDCO,NSE:IBULHSGFIN,NSE:INDIACEM,NSE:INDUSTOWER,NSE:IRCON,NSE:JKPAPER,NSE:JMFINANCIL,NSE:JYOTHYLAB,NSE:KARURVYSYA,NSE:NAM_INDIA,NSE:NATIONALUM,NSE:NCC,NSE:NETWORK18,NSE:NYKAA,NSE:PNB,NSE:RAIN,NSE:RALLIS,NSE:RBA,NSE:RBLBANK,NSE:RCF,NSE:REDINGTON,NSE:TRITURBINE,NSE:UNIONBANK,NSE:VAIBHAVGBL,NSE:WELSPUNLIV,NSE:ZEEL", 17 | title="Paste Symbols", tooltip=tt_is, group=g_tb) 18 | 19 | string i_scr_direction = input.string(defval='Both', title='Direction', options=['Both', 'Bullish', 'Bearish'], inline='tb_1', group=g_tb) 20 | bool i_scr_show_bull = input.bool(defval=true, title='Only Bullish', inline='tb_2', group=g_tb) 21 | bool i_scr_show_bear = input.bool(defval=true, title='Only Bearish', inline='tb_2', group=g_tb) 22 | 23 | int i_scr_disp_rows = input.int(defval=16, title='Display Rows', minval=0, maxval=100, group=g_tb) 24 | string i_scr_position = input.string(defval=position.bottom_left, title='Table Position', options=[position.top_left, position.top_center, position.top_right, position.middle_left, position.middle_center, position.middle_right, position.bottom_left, position.bottom_center, position.bottom_right], group=g_tb) 25 | string i_scr_text_size = input.string(defval=size.small, title='Table Size', options=[size.auto, size.tiny, size.small, size.normal, size.large, size.huge], group=g_tb) 26 | 27 | color i_scr_neg_col = input.color(defval=#F7525F, title='-', inline='c', group=g_tb) 28 | color i_scr_pos_col = input.color(defval=#22AB94, title='+', inline='c', group=g_tb) 29 | color i_scr_neu_col = input.color(defval=#B2B5BE, title='0', inline='c', group=g_tb) 30 | 31 | //_____________________________ Menu Screener End 32 | 33 | //_____________________________ Menu Liquidity Void Start 34 | 35 | g_lv = '███████████████ Liquidity Void ███████████████' 36 | 37 | int i_lv_show_last = input.int(defval=2, title='Show Last', minval=0, group=g_lv) 38 | string i_lv_line = input.string(defval='High/Low', title='Source', options=['High/Low', 'OTE 0.79%', '50%'], group=g_lv) 39 | bool i_lv_bear_show = input.bool(defval=true, title='Bearish', group=g_lv) 40 | bool i_lv_bull_show = input.bool(defval=true, title='Bullish', group=g_lv) 41 | bool i_lv_hide_crossed = input.bool(defval=false, title='Hide Crossed', group=g_lv) 42 | 43 | g_lv_f = "Void Height Filter" 44 | tt_lv_f = "• Filters remove narrow liquidity voids." + 45 | "\n• ATR filtering adjusts automatically when the timeframe changes." + 46 | "\n• Percentage filter will be constant across all timeframes." + 47 | "\n• If you don't want any filtering, choose 'Percentage' and then change Percentage to 0." 48 | string i_lv_additional = input.string(defval='ATR', title='Filter Using', options=['ATR', 'Percentage'], tooltip=tt_lv_f, group=g_lv_f) 49 | tt_lv_atr = "Applicable only if 'Filter Using' is 'ATR'" 50 | int i_lv_atr_length = input.int(defval=14, minval=1, title='ATR Period', tooltip=tt_lv_atr, group=g_lv_f) 51 | tt_lv_atr_m = "Higher the number, filters higher void height." 52 | float i_lv_atr_multi = input.float(defval=4, minval=1, title='ATR Multiplier', tooltip=tt_lv_atr_m, group=g_lv_f) 53 | tt_lv_p = "Filters liquidity void above the given percentage." 54 | float i_lv_percentage = input.float(defval=2.5, minval=0, step=0.1, title='Percentage Above', tooltip=tt_lv_p, group=g_lv_f) 55 | 56 | g_lv_ds = "Display Settings" 57 | color i_lv_bear_color = input.color(defval=#F7525F, title='Bearish Color', group=g_lv_ds) 58 | color i_lv_bull_color = input.color(defval=#22AB94, title='Bullish Color', group=g_lv_ds) 59 | string i_lv_ln_style = input.string(defval=line.style_solid, title="Line Style", options=[line.style_solid, line.style_dashed, line.style_dotted], group=g_lv_ds) 60 | int i_lv_ln_width = input.int(defval=2, title='Width', group=g_lv_ds) 61 | int i_lv_box_trans = input.int(defval=75, title='Box Transparency', group=g_lv_ds) 62 | 63 | //_____________________________ Menu Liquidity Void End 64 | 65 | //_____________________________ Functions Start 66 | 67 | // Function to calculate filter based on ATR or percentage 68 | filter(prev_value, other_value, _atr_htf, _atr_multi, _percentage, _additional) => 69 | filter_atr = math.abs(prev_value - other_value) > _atr_htf * _atr_multi 70 | filter_percent = math.abs((prev_value - other_value) / prev_value * 100) > _percentage 71 | _additional == 'ATR' ? filter_atr : filter_percent 72 | 73 | // Function to determine line type 74 | price_source(float prev_value, float other_value, string price_source) => 75 | price_source == 'High/Low' ? prev_value : 76 | price_source == 'OTE 0.79%' ? other_value + ((prev_value - other_value) * 0.79) : 77 | price_source == 'OTE 0.79%' ? other_value - ((prev_value - other_value) * 0.79) : 78 | math.avg(prev_value, other_value) 79 | 80 | draw_line(int x1_time, float y1_price, color _color)=> 81 | line.new(x1=x1_time, y1=y1_price, x2=time, y2=y1_price, xloc=xloc.bar_time, color=_color, style=i_lv_ln_style, width=i_lv_ln_width) 82 | 83 | draw_box(int left_time, float top_price, float bottom_price, color _color)=> 84 | box.new(left=left_time, top=top_price, right=time, bottom=bottom_price, xloc=xloc.bar_time, border_color=color.new(_color, i_lv_box_trans), bgcolor=color.new(_color, i_lv_box_trans)) 85 | 86 | // Function to handle array operations and cleanup 87 | clean_arrays(_all_lines, _keep_lines, _all_boxes, _keep_boxes, _lv_line, _lv_box) => 88 | 89 | array.push(_all_lines, _lv_line) 90 | array.push(_all_boxes, _lv_box) 91 | 92 | if array.size(_all_lines) > i_lv_show_last 93 | removed_line = array.shift(_all_lines) 94 | if array.includes(_keep_lines, removed_line) 95 | index_of_removed_line = array.indexof(_keep_lines, removed_line) 96 | array.remove(_keep_lines, index_of_removed_line) 97 | line.delete(removed_line) 98 | 99 | if array.size(_all_boxes) > i_lv_show_last 100 | removed_box = array.shift(_all_boxes) 101 | if array.includes(_keep_boxes, removed_box) 102 | index_of_removed_box = array.indexof(_keep_boxes, removed_box) 103 | array.remove(_keep_boxes, index_of_removed_box) 104 | box.delete(removed_box) 105 | 106 | break_object(float price) => 107 | high >= price and low <= price 108 | 109 | update_lines(lines, keep_lines, int _time) => 110 | for current_line in lines 111 | if not array.includes(keep_lines, current_line) 112 | line.set_x2(current_line, _time) 113 | line_price = line.get_y1(current_line) 114 | if break_object(line_price) 115 | array.push(keep_lines, current_line) 116 | 117 | update_boxes(boxes, keep_boxes, int _time) => 118 | for current_box in boxes 119 | if not array.includes(keep_boxes, current_box) 120 | box.set_right(current_box, _time) 121 | box_price = box.get_top(current_box) 122 | if break_object(box_price) 123 | array.push(keep_boxes, current_box) 124 | 125 | clean_lines(keep_lines, all_lines) => 126 | for keep_line in keep_lines 127 | line_price = line.get_y1(keep_line) 128 | if i_lv_hide_crossed and break_object(line_price) 129 | line.delete(keep_line) 130 | index = array.indexof(all_lines, keep_line) 131 | if not na(index) 132 | array.remove(all_lines, index) 133 | 134 | clean_boxes(keep_boxes, all_boxes) => 135 | for keep_box in keep_boxes 136 | box_price = box.get_bottom(keep_box) 137 | if i_lv_hide_crossed and break_object(box_price) 138 | box.delete(keep_box) 139 | index = array.indexof(all_boxes, keep_box) 140 | if not na(index) 141 | array.remove(all_boxes, index) 142 | 143 | //_____________________________ Functions End 144 | 145 | //_____________________________ Liquidity Void Bearish Start 146 | 147 | var float bear_prev_low = na, var int bear_prev_low_time = na 148 | var float bear_price_source_val = na, var float bear_high_val = na 149 | var bear_keep_lines = array.new_line(), var bear_all_lines = array.new_line() 150 | var bear_keep_boxes = array.new_box(), var bear_all_boxes = array.new_box() 151 | 152 | if i_lv_bear_show and barstate.isconfirmed and (close > open) 153 | bear_filter = filter(bear_prev_low, high, ta.atr(i_lv_atr_length), i_lv_atr_multi, i_lv_percentage, i_lv_additional) 154 | bear_price_source = price_source(bear_prev_low, high, i_lv_line) 155 | 156 | if (na(bear_prev_low) or high <= bear_prev_low) and bear_filter 157 | lv_bear_line = draw_line(bear_prev_low_time, bear_price_source, i_lv_bear_color) 158 | lv_bear_box = draw_box(bear_prev_low_time, high, bear_prev_low, i_lv_bear_color) 159 | clean_arrays(bear_all_lines, bear_keep_lines, bear_all_boxes, bear_keep_boxes, lv_bear_line, lv_bear_box) 160 | 161 | bear_high_val := high 162 | bear_price_source_val := bear_price_source 163 | 164 | bear_prev_low := low 165 | bear_prev_low_time := time 166 | 167 | // Update 168 | update_lines(bear_all_lines, bear_keep_lines, time) 169 | update_boxes(bear_all_boxes, bear_keep_boxes, time) 170 | 171 | // Clean 172 | clean_lines(bear_keep_lines, bear_all_lines) 173 | clean_boxes(bear_keep_boxes, bear_all_boxes) 174 | 175 | //_____________________________ Liquidity Void Bearish End 176 | 177 | //_____________________________ Liquidity Void Bullish Start 178 | 179 | var float bull_prev_high = na, var int bull_prev_high_time = na 180 | var float bull_price_source_val = na, var float bull_low_val = na 181 | var bull_keep_lines = array.new_line(), var bull_all_lines = array.new_line() 182 | var bull_keep_boxes = array.new_box(), var bull_all_boxes = array.new_box() 183 | 184 | if i_lv_bull_show and barstate.isconfirmed and (close < open) 185 | bull_filter = filter(bull_prev_high, low, ta.atr(i_lv_atr_length), i_lv_atr_multi, i_lv_percentage, i_lv_additional) 186 | bull_price_source = price_source(bull_prev_high, low, i_lv_line) 187 | 188 | if (na(bull_prev_high) or low >= bull_prev_high) and bull_filter 189 | lv_bull_line = draw_line(bull_prev_high_time, bull_price_source, i_lv_bull_color) 190 | lv_bull_box = draw_box(bull_prev_high_time, low, bull_prev_high, i_lv_bull_color) 191 | clean_arrays(bull_all_lines, bull_keep_lines, bull_all_boxes, bull_keep_boxes, lv_bull_line, lv_bull_box) 192 | 193 | bull_low_val := high 194 | bull_price_source_val := bull_price_source 195 | 196 | bull_prev_high := high 197 | bull_prev_high_time := time 198 | 199 | // Update 200 | update_lines(bull_all_lines, bull_keep_lines, time) 201 | update_boxes(bull_all_boxes, bull_keep_boxes, time) 202 | 203 | // Clean 204 | clean_lines(bull_keep_lines, bull_all_lines) 205 | clean_boxes(bull_keep_boxes, bull_all_boxes) 206 | 207 | //_____________________________ Liquidity Void Bullish End 208 | 209 | //____________________________ Get Symbols for Screener Start 210 | 211 | // Acknowledgement & Reference 212 | // Trader: 'allanster' 213 | // Indicator Title: 'How To Input CSV List Of Symbol Data Used For Screener' 214 | // Indicator Link: 'https://www.tradingview.com/script/KfqHqHUH-How-To-Input-CSV-List-Of-Symbol-Data-Used-For-Screener/' 215 | 216 | feed(back) => // extract tickerid and decrement list of ticker IDs 217 | loop = back // declare string variable to hold content list 218 | getT = string(na) // declare string variable to hold tickerid 219 | if str.length(loop) == 0 // if list is empty 220 | getT := string(na) // assign na to tickerid variable 221 | loop := string(na) // assign na to list of ticker Ids variable 222 | else // else extract first tickerid 223 | getP = nz(str.pos(loop, ','), str.length(loop)) // get position of first comma or last character 224 | getT := str.substring(loop, 0, getP) // get tickerid in first position of list 225 | loop := str.replace(loop, getT + ',', '') // clear tickerid + delimiter character from list 226 | [getT, loop] // return tickerid in first position & truncated list 227 | 228 | [tid_01, out_01] = feed(i_symbols), [tid_02, out_02] = feed(out_01), [tid_03, out_03] = feed(out_02), [tid_04, out_04] = feed(out_03), 229 | [tid_05, out_05] = feed(out_04), [tid_06, out_06] = feed(out_05), [tid_07, out_07] = feed(out_06), [tid_08, out_08] = feed(out_07), 230 | [tid_09, out_09] = feed(out_08), [tid_10, out_10] = feed(out_09), [tid_11, out_11] = feed(out_10), [tid_12, out_12] = feed(out_11), 231 | [tid_13, out_13] = feed(out_12), [tid_14, out_14] = feed(out_13), [tid_15, out_15] = feed(out_14), [tid_16, out_16] = feed(out_15), 232 | [tid_17, out_17] = feed(out_16), [tid_18, out_18] = feed(out_17), [tid_19, out_19] = feed(out_18), [tid_20, out_20] = feed(out_19), 233 | [tid_21, out_21] = feed(out_20), [tid_22, out_22] = feed(out_21), [tid_23, out_23] = feed(out_22), [tid_24, out_24] = feed(out_23), 234 | [tid_25, out_25] = feed(out_24), [tid_26, out_26] = feed(out_25), [tid_27, out_27] = feed(out_26), [tid_28, out_28] = feed(out_27), 235 | [tid_29, out_29] = feed(out_28), [tid_30, out_30] = feed(out_29), [tid_31, out_31] = feed(out_30), [tid_32, out_32] = feed(out_31), 236 | [tid_33, out_33] = feed(out_32), [tid_34, out_34] = feed(out_33), [tid_35, out_35] = feed(out_34), [tid_36, out_36] = feed(out_35), 237 | [tid_37, out_37] = feed(out_36), [tid_38, out_38] = feed(out_37), [tid_39, out_39] = feed(out_38), [tid_40, out_40] = feed(out_39) 238 | 239 | //____________________________ Get Symbols for Screener End 240 | 241 | // _____________________________ Screener Start 242 | 243 | // Acknowledgement & Reference 244 | // Trader: 'MUQWISHI' 245 | // Indicator Title: 'Candlestick Patterns Screener [By MUQWISHI]' 246 | // Indicator Link: 'https://www.tradingview.com/script/xiWQuGOq-Candlestick-Patterns-Screener-By-MUQWISHI/' 247 | 248 | // Screener Conditions 249 | bearish_cond = ta.crossunder(low, bull_price_source_val) and barstate.isconfirmed 250 | bullish_cond = ta.crossover(high, bear_price_source_val) and barstate.isconfirmed 251 | 252 | // Define Bull and Bear Conditions 253 | bull = not(i_scr_direction == "Bearish") 254 | bear = not(i_scr_direction == "Bullish") 255 | 256 | // Function for Screener Indicator Calculation 257 | indicator_calculation() => 258 | // Initialize variables 259 | price = float(na) 260 | _time = int(na) 261 | indicator = "" 262 | signal = int(na) 263 | 264 | if barstate.isconfirmed 265 | // Check for Bearish Momentum Candle and conditions (Modify here to customize indicators) 266 | if i_scr_show_bull and bearish_cond and bear 267 | indicator := "L" 268 | signal := -1 269 | 270 | // Check for Bullish Momentum Candle and conditions (Modify here to customize indicators) 271 | else if i_scr_show_bear and bullish_cond and bull 272 | indicator := "H" 273 | signal := 1 274 | 275 | // Update price and time if signal is not null 276 | if not na(signal) 277 | price := math.round_to_mintick(close) 278 | _time := time 279 | 280 | [_time, indicator, price, signal] 281 | 282 | // Function to format time 283 | format_time(x) => 284 | timezone = syminfo.timezone 285 | timeframe.isintraday ? str.format_time(x, "HH:mm dd-MM-yyyy", timezone) : str.format_time(x, "dd-MM-yyyy", timezone) 286 | 287 | // Function to extract symbol name 288 | symbol(s) => 289 | array.get(str.split(s, ":"), 1) 290 | 291 | // Matrix setup 292 | var matrix = matrix.new(0, 5, na) 293 | 294 | // Function to add rows to the matrix 295 | mtxFun(symbol, _time, indicator, price, signal) => 296 | matrix.add_row(matrix, 0, array.from(symbol, _time, indicator, price, signal)) 297 | 298 | // Screener function to collect data 299 | screener(s) => 300 | sym = ticker.modify(s, syminfo.session) 301 | [_time, indicator, price, signal] = request.security(sym, timeframe.period, indicator_calculation()) 302 | 303 | // Check if the signal is not na and the time matches 304 | if not na(signal) and _time == time 305 | symbolName = symbol(s) 306 | formattedTime = format_time(_time) 307 | strPrice = str.tostring(price) 308 | strSignal = str.tostring(signal) 309 | 310 | // Add data to the matrix 311 | mtxFun(symbolName, formattedTime, indicator, strPrice, strSignal) 312 | 313 | // Call Screener function for multiple symbols 314 | screener(tid_01), screener(tid_02), screener(tid_03), screener(tid_04), screener(tid_05), screener(tid_06), screener(tid_07), 315 | screener(tid_08), screener(tid_09), screener(tid_10), screener(tid_11), screener(tid_12), screener(tid_13), screener(tid_14), 316 | screener(tid_15), screener(tid_16), screener(tid_17), screener(tid_18), screener(tid_19), screener(tid_20), screener(tid_21), 317 | screener(tid_22), screener(tid_23), screener(tid_24), screener(tid_25), screener(tid_26), screener(tid_27), screener(tid_28), 318 | screener(tid_29), screener(tid_30), screener(tid_31), screener(tid_32), screener(tid_33), screener(tid_34), screener(tid_35), 319 | screener(tid_36), screener(tid_37), screener(tid_38), screener(tid_39), screener(tid_40) 320 | 321 | // Trim excess rows in the matrix 322 | if matrix.rows(matrix) > i_scr_disp_rows 323 | while matrix.rows(matrix) > i_scr_disp_rows 324 | matrix.remove_row(matrix, matrix.rows(matrix)-1) 325 | 326 | // Plot Table 327 | // Create table with specified properties 328 | var table tbl = table.new(position=i_scr_position, columns=4, rows=102, border_width=1) 329 | 330 | // Function to populate cells in the table 331 | cell(col, row, txt, color) => 332 | table.cell(tbl, col, row, text = txt, text_color = color, text_halign=text.align_left, bgcolor = color.new(color, 90), text_size=i_scr_text_size) 333 | 334 | // Check if it's the last bar 335 | if barstate.islast 336 | // Clear existing data in the table 337 | table.clear(tbl, 0, 0, 3, 101) 338 | 339 | // Set headers for the table 340 | cell(0, 0, "Symbol", i_scr_neu_col) 341 | cell(1, 0, "Time", i_scr_neu_col) 342 | cell(2, 0, "Dir" , i_scr_neu_col) 343 | cell(3, 0, "Price", i_scr_neu_col) 344 | 345 | j = 1 346 | // Populate table with matrix data 347 | if matrix.rows(matrix) > 0 348 | for i = 0 to matrix.rows(matrix) - 1 349 | // Determine color based on the signal 350 | col = matrix.get(matrix, i, 4) == "1" ? i_scr_neg_col : 351 | matrix.get(matrix, i, 4) == "-1" ? i_scr_pos_col : i_scr_neu_col 352 | 353 | // Populate cells in the table 354 | cell(0, j, matrix.get(matrix, i, 0), col) 355 | cell(1, j, matrix.get(matrix, i, 1), col) 356 | cell(2, j, matrix.get(matrix, i, 2), col) 357 | cell(3, j, matrix.get(matrix, i, 3), col) 358 | 359 | j += 1 360 | 361 | // _____________________________ Screener End 362 | 363 | // _____________________________ Code End 364 | -------------------------------------------------------------------------------- /ICT Liquidity Void/ICT Liquidity Void.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArunKBhaskar/PineScript/c6821225c466494b01eee08f9dd88bf84d2b24ba/ICT Liquidity Void/ICT Liquidity Void.png -------------------------------------------------------------------------------- /ICT Liquidity Void/Readme First.txt: -------------------------------------------------------------------------------- 1 | About this indicator: 2 | 1. The application of liquidity voids is often noticed in ICT live trades, especially bearish voids. 3 | 2. Similar to equal highs and lows, liquidity voids are important reference points and easily identifiable. 4 | 3. The screener filters cross over or cross under to the high or low or the liquidity voids. 5 | 4. There are still minor issues existing in the indicator, which will be solved in the future. 6 | 7 | Reference Videos: The indicator is developed based on the following video contents. 8 | 9 | Original The Inner Circle Trader Video: 10 | 11 | Video Title: ICT Mentorship Core Content - Month 04 - Liquidity Voids 12 | Video Link: https://www.youtube.com/watch?v=HTQgH11W37o 13 | 14 | Video Title: ICT Mentorship Core Content - Month 1 - Fair Valuation 15 | Video Link: https://www.youtube.com/watch?v=SiVmoeyOWZE 16 | 17 | Note: 18 | Please note that the information provided is purely suggested for educational purposes and not intended as promotion. 19 | There are no personal preferences involved, and no endorsement of any individual or entity is implied. -------------------------------------------------------------------------------- /ICT Market Structure Shift (MSS)/ICT Market Structure Shift (MSS).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArunKBhaskar/PineScript/c6821225c466494b01eee08f9dd88bf84d2b24ba/ICT Market Structure Shift (MSS)/ICT Market Structure Shift (MSS).png -------------------------------------------------------------------------------- /ICT Market Structure Shift (MSS)/ICT Market Structure Shift (MSS).txt: -------------------------------------------------------------------------------- 1 | // This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ 2 | // © Arun_K_Bhaskar 3 | 4 | //@version=5 5 | i_max_bars_back = 300 6 | indicator(title="ICT Market Structure Shift (MSS)", shorttitle="ICT MSS", overlay=true, max_bars_back=i_max_bars_back, max_lines_count=500, max_boxes_count=500) 7 | 8 | //_____________________________ Menu Zig Zag Start 9 | 10 | g_zz = '██████████████████ Zig Zag ██████████████████' 11 | 12 | bool i_zz_bear_show = input.bool(defval=true, title='Bearish', inline='be', group=g_zz) 13 | bool i_zz_bear_shift_show = input.bool(defval=true, title='Shift', inline='be', group=g_zz) 14 | bool i_zz_bear_ret_show = input.bool(defval=true, title='Retracement', inline='be', group=g_zz) 15 | 16 | bool i_zz_bull_show = input.bool(defval=true, title='Bullish ', inline='bu', group=g_zz) 17 | bool i_zz_bull_shift_show = input.bool(defval=true, title='Shift', inline='bu', group=g_zz) 18 | bool i_zz_bull_ret_show = input.bool(defval=true, title='Retracement', inline='bu', group=g_zz) 19 | 20 | int i_zz_period = input.int(defval=4, title='Zig Zag Length', minval=2, group=g_zz) 21 | string i_zz_source = input.string(defval='High/Low', title='Source', options=['High/Low', 'Open/Close'], group=g_zz) 22 | tt_zz = "• Distance between swings." + 23 | "\n• Lower values mean highs and lows are closer." 24 | float i_zz_percent = input.float(defval=0, minval=0, step=0.1, title='% Difference >', tooltip=tt_zz, group=g_zz) 25 | bool i_zz_show = input.bool(defval=false, title='', inline='zz', group=g_zz) 26 | color i_zz_bull_color = input.color(defval=#1E53E5, title='Zig Zag Colors: +', inline='zz', group=g_zz) 27 | color i_zz_bear_color = input.color(defval=#1E53E5, title='-', inline='zz', group=g_zz) 28 | color i_pos_color = input.color(defval=#22AB94, title='Colors:             +', inline='c_1', group=g_zz) 29 | color i_neg_color = input.color(defval=#F7525F, title='-', inline='c_1', group=g_zz) 30 | color i_zz_bull_signal_color = input.color(defval=#70CCBD, title='Signal Colors:       +', inline='c_2', group=g_zz) 31 | color i_zz_bear_signal_color = input.color(defval=#FAA1A4, title='-', inline='c_2', group=g_zz) 32 | int i_zz_bx_transp = input.int(defval=75, title='Box Transparency   ', minval=0, maxval=100, group=g_zz) 33 | 34 | g_zz_f = "Additional Filters" 35 | tt_zz_f = "• Filters remove narrow swing displacements." + 36 | "\n• Swing displacement means the distance between old swing high/low and new swing high/low." + 37 | "\n• Multiplier filtering adjusts automatically when the chart timeframe changes." + 38 | "\n• Percentage filter will be constant across all timeframes." + 39 | "\n• If you don't want any filtering, choose 'Percentage' and then change Percentage to 0." 40 | string i_zz_filter_choice = input.string(defval='Percentage', title='Filter Using', options=['Multiplier', 'Percentage'], tooltip=tt_zz_f, group=g_zz_f) 41 | tt_zz_m = "• Higher the number, filters higher swing displacement." + 42 | "\n• Eg: If 'Multiplier' is 2, swing displacement is 2 times than the previous swing." 43 | float i_zz_multiplier = input.float(defval=2, minval=1, step=0.1, title='Multiplier', tooltip=tt_zz_m, group=g_zz_f) 44 | tt_zz_p = "Filters liquidity displacement above the given percentage." 45 | float i_zz_percentage = input.float(defval=0.7, minval=0, step=0.1, title='Percentage Above', tooltip=tt_zz_p, group=g_zz_f) 46 | 47 | //_____________________________ Menu Zig Zag End 48 | 49 | //_____________________________ Zig Zag Start 50 | 51 | // Acknowledgement & Reference 52 | // Trader: 'RozaniGhani-RG' 53 | // Indicator Title: 'Zig Zag Ratio Simplified' 54 | // Indicator Link: 'https://www.tradingview.com/script/CIk186OY-Zig-Zag-Ratio-Simplified/' 55 | 56 | //_____________________________ Get Source 57 | 58 | float _high = i_zz_source == 'Open/Close' ? math.max(open, close) : high 59 | float _low = i_zz_source == 'Open/Close' ? math.min(open, close) : low 60 | 61 | //============================== 1. Variables 62 | 63 | //_____________________________ 1.1 Highest / Lowest 64 | float ph = ta.highestbars(_high, i_zz_period) == 0 ? _high : na 65 | float pl = ta.lowestbars(_low, i_zz_period) == 0 ? _low : na 66 | 67 | //_____________________________ 1.2 Dir 68 | var int dir = 0, dir := pl and na(ph) ? -1 : ph and na(pl) ? 1 : dir 69 | 70 | //_____________________________ 1.4 Array 71 | var max_array_size = 10, var zigzag = array.new_float(0), oldzigzag = array.copy(zigzag) 72 | 73 | //_____________________________ 1.5 Others 74 | var line line_zz = na 75 | 76 | //============================== 3. Custom Functions 77 | 78 | add_to_zigzag(float[] pointer, float value, int bindex) => 79 | array.unshift(pointer, bindex) 80 | array.unshift(pointer, value) 81 | if array.size(pointer) > max_array_size 82 | array.pop(pointer) 83 | array.pop(pointer) 84 | 85 | update_zigzag(float[] pointer, float value, int bindex, int dir) => 86 | if array.size(pointer) == 0 87 | add_to_zigzag(pointer, value, bindex) 88 | else 89 | if dir == 1 and value > array.get(pointer, 0) or dir == -1 and value < array.get(pointer, 0) 90 | array.set(pointer, 0, value) 91 | array.set(pointer, 1, bindex) 92 | 0. 93 | 94 | //============================== 4. Calculations 95 | 96 | dirchanged = ta.change(dir) 97 | 98 | if ph or pl 99 | if dirchanged 100 | add_to_zigzag(zigzag, dir == 1 ? ph : pl, bar_index) 101 | else 102 | update_zigzag(zigzag, dir == 1 ? ph : pl, bar_index, dir) 103 | 104 | //============================== 5. Constructs 105 | 106 | if array.size(zigzag) >= 6 107 | if array.get(zigzag, 0) != array.get(oldzigzag, 0) or array.get(zigzag, 1) != array.get(oldzigzag, 1) 108 | if array.get(zigzag, 2) == array.get(oldzigzag, 2) and array.get(zigzag, 3) == array.get(oldzigzag, 3) 109 | line.delete(line_zz) 110 | if i_zz_show 111 | line_zz := line.new(x1 = math.round(array.get(zigzag, 1)), y1 = array.get(zigzag, 0), x2 = math.round(array.get(zigzag, 3)), y2 = array.get(zigzag, 2), color = dir == 1 ? i_zz_bull_color : i_zz_bear_color, width=2) 112 | 113 | //_____________________________ Get Swing Price & Bar Index 114 | 115 | zz_1 = array.size(zigzag) > 7 ? array.get(zigzag, array.size(zigzag) - 8) : na 116 | bi_1 = array.size(zigzag) > 6 ? array.get(zigzag, array.size(zigzag) - 7) : na 117 | zz_2 = array.size(zigzag) > 5 ? array.get(zigzag, array.size(zigzag) - 6) : na 118 | bi_2 = array.size(zigzag) > 4 ? array.get(zigzag, array.size(zigzag) - 5) : na 119 | zz_3 = array.size(zigzag) > 3 ? array.get(zigzag, array.size(zigzag) - 4) : na 120 | bi_3 = array.size(zigzag) > 2 ? array.get(zigzag, array.size(zigzag) - 3) : na 121 | 122 | // Create a single label for the last five zigzag values and their corresponding bar index 123 | //label_text = str.tostring(zz_0) + "\n" + str.tostring(bi_0) + "\n" + str.tostring(zz_1) + "\n" + str.tostring(bi_1) + "\n" + str.tostring(zz_2) + 124 | // "\n" + str.tostring(bi_2) + "\n" + str.tostring(zz_3) + "\n" + str.tostring(bi_3) + "\n" + str.tostring(zz_4) + "\n" + str.tostring(bi_4) 125 | //if barstate.islast 126 | // label.new(x = bar_index, y = high, text = label_text, color=color.white) 127 | 128 | // Function to calculate filter based on ATR or percentage 129 | filter(float swing_3, float swing_2, float swing_1, float multiplier, float percentage, string choice) => 130 | filter_x_times = math.abs(swing_1 - swing_2) > math.abs(swing_3 - swing_2) * multiplier 131 | filter_percent = math.abs((swing_3 - swing_1) / swing_3 * 100) > percentage 132 | choice == 'Multiplier' ? filter_x_times : filter_percent 133 | 134 | bearish_filter = filter(zz_3, zz_2, zz_1, i_zz_multiplier, i_zz_percentage, i_zz_filter_choice) 135 | bullish_filter = filter(zz_3, zz_2, zz_1, i_zz_multiplier, i_zz_percentage, i_zz_filter_choice) 136 | 137 | //_____________________________ MSS Conditions 138 | 139 | // Bearish Condition 140 | bearish_condition = 141 | zz_1 > zz_2 and 142 | zz_1 > zz_3 and 143 | zz_2 < zz_1 and 144 | zz_2 < zz_3 and 145 | zz_3 < zz_1 and 146 | zz_3 > zz_2 and 147 | close < zz_1 and 148 | close < zz_2 and 149 | close < zz_3 and 150 | ta.crossunder(close, zz_2) and 151 | bearish_filter and 152 | barstate.isconfirmed 153 | 154 | // Bullish Condition 155 | bullish_condition = 156 | zz_1 < zz_2 and 157 | zz_1 < zz_3 and 158 | zz_2 > zz_1 and 159 | zz_2 > zz_3 and 160 | zz_3 > zz_1 and 161 | zz_3 < zz_2 and 162 | close > zz_1 and 163 | close > zz_2 and 164 | close > zz_3 and 165 | ta.crossover(close, zz_2) and 166 | bullish_filter and 167 | barstate.isconfirmed 168 | 169 | //___________________________ Bearish Retracement 170 | 171 | // Retracement Levels 172 | float bearish_retracement_level = zz_1 - ((zz_1-zz_2)/3) 173 | float bullish_retracement_level = zz_1 + ((zz_2-zz_1)/3) 174 | 175 | // Get Bearish Retracement Price in Bearish Condition 176 | var bearish_retracement_price = float(na) 177 | var bearish_retracement_bi = float(na) 178 | if bearish_condition 179 | bearish_retracement_price := bearish_retracement_level 180 | bearish_retracement_bi := bi_1 181 | 182 | // Bearish Retracement Condition 183 | bool bearish_retracement_condition = 184 | ta.crossover(high, bearish_retracement_price) and 185 | barstate.isconfirmed 186 | 187 | // Bearish Retracement in Sequential Order 188 | var bear_current_state = 0 189 | bear_previous_state = nz(bear_current_state[1]) 190 | bear_current_state := bear_previous_state == 2 ? 0 : bear_previous_state 191 | if bearish_condition and bear_current_state == 0 192 | bear_current_state := 1 193 | if bearish_retracement_condition and bear_current_state == 1 194 | bear_current_state := 2 195 | 196 | bool bearish_retracement_trigger = bear_current_state == 2 ? true : false 197 | 198 | //___________________________ Bullish Retracement 199 | 200 | // Get Bullish Retracement Price in Bullish Condition 201 | var bullish_retracement_price = float(na) 202 | var bullish_retracement_bi = float(na) 203 | if bullish_condition 204 | bullish_retracement_price := bullish_retracement_level 205 | bullish_retracement_bi := bi_1 206 | 207 | // Bullish Retracement Condition 208 | bool bullish_retracement_condition = 209 | ta.crossunder(low, bullish_retracement_price) and 210 | barstate.isconfirmed 211 | 212 | // Bullish Retracement in Sequential Order 213 | var bull_current_state = 0 214 | bull_previous_state = nz(bull_current_state[1]) 215 | bull_current_state := bull_previous_state == 2 ? 0 : bull_previous_state 216 | if bullish_condition and bull_current_state == 0 217 | bull_current_state := 1 218 | if bullish_retracement_condition and bull_current_state == 1 219 | bull_current_state := 2 220 | 221 | bool bullish_retracement_trigger = bull_current_state == 2 ? true : false 222 | 223 | //_____________________________ Plot 224 | 225 | // Plot Break Signal 226 | plotshape(series=i_zz_bear_show and i_zz_bear_shift_show ? bearish_condition : na, title='Bearish Shift', style=shape.triangledown, location=location.abovebar, color=i_zz_bear_signal_color, textcolor=i_zz_bear_signal_color, size=size.tiny) 227 | plotshape(series=i_zz_bull_show and i_zz_bull_shift_show ? bullish_condition : na, title='Bullish Shift', style=shape.triangleup, location=location.belowbar, color=i_zz_bull_signal_color, textcolor=i_zz_bull_signal_color, size=size.tiny) 228 | barcolor(color=i_zz_bear_show and i_zz_bear_shift_show and bearish_condition ? i_zz_bear_signal_color : i_zz_bull_show and i_zz_bull_shift_show and bullish_condition ? i_zz_bull_signal_color : na, title='Shift Candle') 229 | 230 | //var box_array = array.new_box() 231 | var line_array = array.new_line() 232 | 233 | if i_zz_bear_show and bearish_condition 234 | ph_box = box.new(left=int(bi_3), top=zz_3, right=int(bi_1), bottom=zz_1, border_color=#00000000, bgcolor=color.new(i_neg_color, i_zz_bx_transp)) 235 | if i_zz_bear_shift_show 236 | ph_line = line.new(x1=int(bi_2), y1=zz_2, x2=bar_index, y2=zz_2, color=i_neg_color, style=line.style_dashed) 237 | //array.push(box_array, ph_box) 238 | array.push(line_array, ph_line) 239 | 240 | if i_zz_bull_show and bullish_condition 241 | pl_box = box.new(left=int(bi_3), top=zz_3, right=int(bi_1), bottom=zz_1, border_color=#00000000, bgcolor=color.new(i_pos_color, i_zz_bx_transp)) 242 | if i_zz_bull_shift_show 243 | pl_line = line.new(x1=int(bi_2), y1=zz_2, x2=bar_index, y2=zz_2, color=i_pos_color, style=line.style_dashed) 244 | //array.push(box_array, pl_box) 245 | array.push(line_array, pl_line) 246 | 247 | // Plot Retracement Signal 248 | plotchar(series=i_zz_bear_show and i_zz_bear_ret_show and bearish_retracement_trigger ? 3 : na, title='Bear Retracement', char="↷", location=location.abovebar, color=i_zz_bear_signal_color, size=size.tiny) 249 | plotchar(series=i_zz_bull_show and i_zz_bull_ret_show and bullish_retracement_trigger ? 3 : na, title='Bull Retracement', char="⤻", location=location.belowbar, color=i_zz_bull_signal_color, size=size.tiny) 250 | barcolor(color=i_zz_bear_show and i_zz_bear_ret_show and bearish_retracement_trigger ? i_zz_bear_signal_color : i_zz_bull_show and i_zz_bull_ret_show and bullish_retracement_trigger ? i_zz_bull_signal_color : na, title='Retracement Candle') 251 | 252 | //var line_array = array.new_line() 253 | 254 | if i_zz_bear_show and i_zz_bear_ret_show and bearish_retracement_trigger 255 | bull_ret_ln = line.new(x1=int(bearish_retracement_bi), y1=bearish_retracement_price, x2=bar_index, y2=bearish_retracement_price, color=i_neg_color, style=line.style_dotted) 256 | array.push(line_array, bull_ret_ln) 257 | 258 | if i_zz_bull_show and i_zz_bull_ret_show and bullish_retracement_trigger 259 | bear_ret_ln = line.new(x1=int(bullish_retracement_bi), y1=bullish_retracement_price, x2=bar_index, y2=bullish_retracement_price, color=i_pos_color, style=line.style_dotted) 260 | array.push(line_array, bear_ret_ln) 261 | 262 | //_____________________________ Zig Zag End 263 | 264 | //_____________________________ Code End 265 | -------------------------------------------------------------------------------- /ICT Market Structure Shift (MSS)/Readme First.txt: -------------------------------------------------------------------------------- 1 | ICT Market Structure Shift (MSS): An Improved Market Structure Shift Indicator And Screener 2 | 3 | Enhanced Signal Accuracy: 4 | Unlike previous versions, this indicator provides more reliable signals, minimizing unnecessary or incorrect alerts. 5 | 6 | Two Signal and Screening Options: 7 | - Market Structure Shift: Detects when the close price surpasses an inside range liquidity level or swing point, signaling a potential trend change. 8 | - Retracement to Order Block: Identifies retracements to Order Blocks or OTE levels after a Market Structure Shift occurs. 9 | 10 | Cautionary Notes: 11 | - Automated Signals:Since this indicator is automated, it may generate numerous unnecessary signals. Exercise caution when interpreting them. 12 | - Signal Height Filter: Utilize the "% Difference" option to filter out signals based on their height, avoiding too closely spaced signals. 13 | - Self-Evaluation: Perform a thorough self-assessment for each signal to gauge its validity and relevance to your trading strategy. 14 | -------------------------------------------------------------------------------- /ICT Mitigation Block Scanner/Readme First.txt: -------------------------------------------------------------------------------- 1 | // Readme First: 2 | 3 | // ICT Mitigation Block Scanner 4 | 5 | // Reference 6 | // - Video Title: ICT Mentorship Core Content - Month 04 - Mitigation Blocks 7 | // - Video Link: https://www.youtube.com/watch?v=FOUzW0QmsfI 8 | 9 | // Notes 10 | // - For intraday trading, a 3-minute timeframe works well. 11 | // - The Scanner will generate wrong signals also. -------------------------------------------------------------------------------- /ICT Mitigation Block Scanner/[Screenshot] ICT Mitigation Block Scanner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArunKBhaskar/PineScript/c6821225c466494b01eee08f9dd88bf84d2b24ba/ICT Mitigation Block Scanner/[Screenshot] ICT Mitigation Block Scanner.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Mozilla Public License Version 2.0 2 | ================================== 3 | 4 | 1. Definitions 5 | -------------- 6 | 7 | 1.1. "Contributor" 8 | means each individual or legal entity that creates, contributes to 9 | the creation of, or owns Covered Software. 10 | 11 | 1.2. "Contributor Version" 12 | means the combination of the Contributions of others (if any) used 13 | by a Contributor and that particular Contributor's Contribution. 14 | 15 | 1.3. "Contribution" 16 | means Covered Software of a particular Contributor. 17 | 18 | 1.4. "Covered Software" 19 | means Source Code Form to which the initial Contributor has attached 20 | the notice in Exhibit A, the Executable Form of such Source Code 21 | Form, and Modifications of such Source Code Form, in each case 22 | including portions thereof. 23 | 24 | 1.5. "Incompatible With Secondary Licenses" 25 | means 26 | 27 | (a) that the initial Contributor has attached the notice described 28 | in Exhibit B to the Covered Software; or 29 | 30 | (b) that the Covered Software was made available under the terms of 31 | version 1.1 or earlier of the License, but not also under the 32 | terms of a Secondary License. 33 | 34 | 1.6. "Executable Form" 35 | means any form of the work other than Source Code Form. 36 | 37 | 1.7. "Larger Work" 38 | means a work that combines Covered Software with other material, in 39 | a separate file or files, that is not Covered Software. 40 | 41 | 1.8. "License" 42 | means this document. 43 | 44 | 1.9. "Licensable" 45 | means having the right to grant, to the maximum extent possible, 46 | whether at the time of the initial grant or subsequently, any and 47 | all of the rights conveyed by this License. 48 | 49 | 1.10. "Modifications" 50 | means any of the following: 51 | 52 | (a) any file in Source Code Form that results from an addition to, 53 | deletion from, or modification of the contents of Covered 54 | Software; or 55 | 56 | (b) any new file in Source Code Form that contains any Covered 57 | Software. 58 | 59 | 1.11. "Patent Claims" of a Contributor 60 | means any patent claim(s), including without limitation, method, 61 | process, and apparatus claims, in any patent Licensable by such 62 | Contributor that would be infringed, but for the grant of the 63 | License, by the making, using, selling, offering for sale, having 64 | made, import, or transfer of either its Contributions or its 65 | Contributor Version. 66 | 67 | 1.12. "Secondary License" 68 | means either the GNU General Public License, Version 2.0, the GNU 69 | Lesser General Public License, Version 2.1, the GNU Affero General 70 | Public License, Version 3.0, or any later versions of those 71 | licenses. 72 | 73 | 1.13. "Source Code Form" 74 | means the form of the work preferred for making modifications. 75 | 76 | 1.14. "You" (or "Your") 77 | means an individual or a legal entity exercising rights under this 78 | License. For legal entities, "You" includes any entity that 79 | controls, is controlled by, or is under common control with You. For 80 | purposes of this definition, "control" means (a) the power, direct 81 | or indirect, to cause the direction or management of such entity, 82 | whether by contract or otherwise, or (b) ownership of more than 83 | fifty percent (50%) of the outstanding shares or beneficial 84 | ownership of such entity. 85 | 86 | 2. License Grants and Conditions 87 | -------------------------------- 88 | 89 | 2.1. Grants 90 | 91 | Each Contributor hereby grants You a world-wide, royalty-free, 92 | non-exclusive license: 93 | 94 | (a) under intellectual property rights (other than patent or trademark) 95 | Licensable by such Contributor to use, reproduce, make available, 96 | modify, display, perform, distribute, and otherwise exploit its 97 | Contributions, either on an unmodified basis, with Modifications, or 98 | as part of a Larger Work; and 99 | 100 | (b) under Patent Claims of such Contributor to make, use, sell, offer 101 | for sale, have made, import, and otherwise transfer either its 102 | Contributions or its Contributor Version. 103 | 104 | 2.2. Effective Date 105 | 106 | The licenses granted in Section 2.1 with respect to any Contribution 107 | become effective for each Contribution on the date the Contributor first 108 | distributes such Contribution. 109 | 110 | 2.3. Limitations on Grant Scope 111 | 112 | The licenses granted in this Section 2 are the only rights granted under 113 | this License. No additional rights or licenses will be implied from the 114 | distribution or licensing of Covered Software under this License. 115 | Notwithstanding Section 2.1(b) above, no patent license is granted by a 116 | Contributor: 117 | 118 | (a) for any code that a Contributor has removed from Covered Software; 119 | or 120 | 121 | (b) for infringements caused by: (i) Your and any other third party's 122 | modifications of Covered Software, or (ii) the combination of its 123 | Contributions with other software (except as part of its Contributor 124 | Version); or 125 | 126 | (c) under Patent Claims infringed by Covered Software in the absence of 127 | its Contributions. 128 | 129 | This License does not grant any rights in the trademarks, service marks, 130 | or logos of any Contributor (except as may be necessary to comply with 131 | the notice requirements in Section 3.4). 132 | 133 | 2.4. Subsequent Licenses 134 | 135 | No Contributor makes additional grants as a result of Your choice to 136 | distribute the Covered Software under a subsequent version of this 137 | License (see Section 10.2) or under the terms of a Secondary License (if 138 | permitted under the terms of Section 3.3). 139 | 140 | 2.5. Representation 141 | 142 | Each Contributor represents that the Contributor believes its 143 | Contributions are its original creation(s) or it has sufficient rights 144 | to grant the rights to its Contributions conveyed by this License. 145 | 146 | 2.6. Fair Use 147 | 148 | This License is not intended to limit any rights You have under 149 | applicable copyright doctrines of fair use, fair dealing, or other 150 | equivalents. 151 | 152 | 2.7. Conditions 153 | 154 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 155 | in Section 2.1. 156 | 157 | 3. Responsibilities 158 | ------------------- 159 | 160 | 3.1. Distribution of Source Form 161 | 162 | All distribution of Covered Software in Source Code Form, including any 163 | Modifications that You create or to which You contribute, must be under 164 | the terms of this License. You must inform recipients that the Source 165 | Code Form of the Covered Software is governed by the terms of this 166 | License, and how they can obtain a copy of this License. You may not 167 | attempt to alter or restrict the recipients' rights in the Source Code 168 | Form. 169 | 170 | 3.2. Distribution of Executable Form 171 | 172 | If You distribute Covered Software in Executable Form then: 173 | 174 | (a) such Covered Software must also be made available in Source Code 175 | Form, as described in Section 3.1, and You must inform recipients of 176 | the Executable Form how they can obtain a copy of such Source Code 177 | Form by reasonable means in a timely manner, at a charge no more 178 | than the cost of distribution to the recipient; and 179 | 180 | (b) You may distribute such Executable Form under the terms of this 181 | License, or sublicense it under different terms, provided that the 182 | license for the Executable Form does not attempt to limit or alter 183 | the recipients' rights in the Source Code Form under this License. 184 | 185 | 3.3. Distribution of a Larger Work 186 | 187 | You may create and distribute a Larger Work under terms of Your choice, 188 | provided that You also comply with the requirements of this License for 189 | the Covered Software. If the Larger Work is a combination of Covered 190 | Software with a work governed by one or more Secondary Licenses, and the 191 | Covered Software is not Incompatible With Secondary Licenses, this 192 | License permits You to additionally distribute such Covered Software 193 | under the terms of such Secondary License(s), so that the recipient of 194 | the Larger Work may, at their option, further distribute the Covered 195 | Software under the terms of either this License or such Secondary 196 | License(s). 197 | 198 | 3.4. Notices 199 | 200 | You may not remove or alter the substance of any license notices 201 | (including copyright notices, patent notices, disclaimers of warranty, 202 | or limitations of liability) contained within the Source Code Form of 203 | the Covered Software, except that You may alter any license notices to 204 | the extent required to remedy known factual inaccuracies. 205 | 206 | 3.5. Application of Additional Terms 207 | 208 | You may choose to offer, and to charge a fee for, warranty, support, 209 | indemnity or liability obligations to one or more recipients of Covered 210 | Software. However, You may do so only on Your own behalf, and not on 211 | behalf of any Contributor. You must make it absolutely clear that any 212 | such warranty, support, indemnity, or liability obligation is offered by 213 | You alone, and You hereby agree to indemnify every Contributor for any 214 | liability incurred by such Contributor as a result of warranty, support, 215 | indemnity or liability terms You offer. You may include additional 216 | disclaimers of warranty and limitations of liability specific to any 217 | jurisdiction. 218 | 219 | 4. Inability to Comply Due to Statute or Regulation 220 | --------------------------------------------------- 221 | 222 | If it is impossible for You to comply with any of the terms of this 223 | License with respect to some or all of the Covered Software due to 224 | statute, judicial order, or regulation then You must: (a) comply with 225 | the terms of this License to the maximum extent possible; and (b) 226 | describe the limitations and the code they affect. Such description must 227 | be placed in a text file included with all distributions of the Covered 228 | Software under this License. Except to the extent prohibited by statute 229 | or regulation, such description must be sufficiently detailed for a 230 | recipient of ordinary skill to be able to understand it. 231 | 232 | 5. Termination 233 | -------------- 234 | 235 | 5.1. The rights granted under this License will terminate automatically 236 | if You fail to comply with any of its terms. However, if You become 237 | compliant, then the rights granted under this License from a particular 238 | Contributor are reinstated (a) provisionally, unless and until such 239 | Contributor explicitly and finally terminates Your grants, and (b) on an 240 | ongoing basis, if such Contributor fails to notify You of the 241 | non-compliance by some reasonable means prior to 60 days after You have 242 | come back into compliance. Moreover, Your grants from a particular 243 | Contributor are reinstated on an ongoing basis if such Contributor 244 | notifies You of the non-compliance by some reasonable means, this is the 245 | first time You have received notice of non-compliance with this License 246 | from such Contributor, and You become compliant prior to 30 days after 247 | Your receipt of the notice. 248 | 249 | 5.2. If You initiate litigation against any entity by asserting a patent 250 | infringement claim (excluding declaratory judgment actions, 251 | counter-claims, and cross-claims) alleging that a Contributor Version 252 | directly or indirectly infringes any patent, then the rights granted to 253 | You by any and all Contributors for the Covered Software under Section 254 | 2.1 of this License shall terminate. 255 | 256 | 5.3. In the event of termination under Sections 5.1 or 5.2 above, all 257 | end user license agreements (excluding distributors and resellers) which 258 | have been validly granted by You or Your distributors under this License 259 | prior to termination shall survive termination. 260 | 261 | ************************************************************************ 262 | * * 263 | * 6. Disclaimer of Warranty * 264 | * ------------------------- * 265 | * * 266 | * Covered Software is provided under this License on an "as is" * 267 | * basis, without warranty of any kind, either expressed, implied, or * 268 | * statutory, including, without limitation, warranties that the * 269 | * Covered Software is free of defects, merchantable, fit for a * 270 | * particular purpose or non-infringing. The entire risk as to the * 271 | * quality and performance of the Covered Software is with You. * 272 | * Should any Covered Software prove defective in any respect, You * 273 | * (not any Contributor) assume the cost of any necessary servicing, * 274 | * repair, or correction. This disclaimer of warranty constitutes an * 275 | * essential part of this License. No use of any Covered Software is * 276 | * authorized under this License except under this disclaimer. * 277 | * * 278 | ************************************************************************ 279 | 280 | ************************************************************************ 281 | * * 282 | * 7. Limitation of Liability * 283 | * -------------------------- * 284 | * * 285 | * Under no circumstances and under no legal theory, whether tort * 286 | * (including negligence), contract, or otherwise, shall any * 287 | * Contributor, or anyone who distributes Covered Software as * 288 | * permitted above, be liable to You for any direct, indirect, * 289 | * special, incidental, or consequential damages of any character * 290 | * including, without limitation, damages for lost profits, loss of * 291 | * goodwill, work stoppage, computer failure or malfunction, or any * 292 | * and all other commercial damages or losses, even if such party * 293 | * shall have been informed of the possibility of such damages. This * 294 | * limitation of liability shall not apply to liability for death or * 295 | * personal injury resulting from such party's negligence to the * 296 | * extent applicable law prohibits such limitation. Some * 297 | * jurisdictions do not allow the exclusion or limitation of * 298 | * incidental or consequential damages, so this exclusion and * 299 | * limitation may not apply to You. * 300 | * * 301 | ************************************************************************ 302 | 303 | 8. Litigation 304 | ------------- 305 | 306 | Any litigation relating to this License may be brought only in the 307 | courts of a jurisdiction where the defendant maintains its principal 308 | place of business and such litigation shall be governed by laws of that 309 | jurisdiction, without reference to its conflict-of-law provisions. 310 | Nothing in this Section shall prevent a party's ability to bring 311 | cross-claims or counter-claims. 312 | 313 | 9. Miscellaneous 314 | ---------------- 315 | 316 | This License represents the complete agreement concerning the subject 317 | matter hereof. If any provision of this License is held to be 318 | unenforceable, such provision shall be reformed only to the extent 319 | necessary to make it enforceable. Any law or regulation which provides 320 | that the language of a contract shall be construed against the drafter 321 | shall not be used to construe this License against a Contributor. 322 | 323 | 10. Versions of the License 324 | --------------------------- 325 | 326 | 10.1. New Versions 327 | 328 | Mozilla Foundation is the license steward. Except as provided in Section 329 | 10.3, no one other than the license steward has the right to modify or 330 | publish new versions of this License. Each version will be given a 331 | distinguishing version number. 332 | 333 | 10.2. Effect of New Versions 334 | 335 | You may distribute the Covered Software under the terms of the version 336 | of the License under which You originally received the Covered Software, 337 | or under the terms of any subsequent version published by the license 338 | steward. 339 | 340 | 10.3. Modified Versions 341 | 342 | If you create software not governed by this License, and you want to 343 | create a new license for such software, you may create and use a 344 | modified version of this License if you rename the license and remove 345 | any references to the name of the license steward (except to note that 346 | such modified license differs from this License). 347 | 348 | 10.4. Distributing Source Code Form that is Incompatible With Secondary 349 | Licenses 350 | 351 | If You choose to distribute Source Code Form that is Incompatible With 352 | Secondary Licenses under the terms of this version of the License, the 353 | notice described in Exhibit B of this License must be attached. 354 | 355 | Exhibit A - Source Code Form License Notice 356 | ------------------------------------------- 357 | 358 | This Source Code Form is subject to the terms of the Mozilla Public 359 | License, v. 2.0. If a copy of the MPL was not distributed with this 360 | file, You can obtain one at http://mozilla.org/MPL/2.0/. 361 | 362 | If it is not possible or desirable to put the notice in a particular 363 | file, then You may include the notice in a location (such as a LICENSE 364 | file in a relevant directory) where a recipient would be likely to look 365 | for such a notice. 366 | 367 | You may add additional accurate notices of copyright ownership. 368 | 369 | Exhibit B - "Incompatible With Secondary Licenses" Notice 370 | --------------------------------------------------------- 371 | 372 | This Source Code Form is "Incompatible With Secondary Licenses", as 373 | defined by the Mozilla Public License, v. 2.0. 374 | -------------------------------------------------------------------------------- /Momentum Setup - Ankush Bajaj Momentum Investing Setup/Momentum Setup - Ankush Bajaj Momentum Investing Setup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArunKBhaskar/PineScript/c6821225c466494b01eee08f9dd88bf84d2b24ba/Momentum Setup - Ankush Bajaj Momentum Investing Setup/Momentum Setup - Ankush Bajaj Momentum Investing Setup.png -------------------------------------------------------------------------------- /Momentum Setup - Ankush Bajaj Momentum Investing Setup/Momentum Setup - Ankush Bajaj Momentum Investing Setup.txt: -------------------------------------------------------------------------------- 1 | // This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ 2 | // © Arun_K_Bhaskar 3 | 4 | //@version=5 5 | indicator(title='Momentum Setup - Ankush Bajaj Momentum Investing Setup', shorttitle='AB Mom', overlay=true, max_bars_back=500, max_lines_count=500, max_boxes_count=500) 6 | 7 | //_____________________________ Menu Indicators Start 8 | 9 | g_pchg = '██████████████ 250 Candle % Change ██████████████' 10 | tt_pchg = 11 | "• Calculate the % change between the past 250th candle and the current candle." + 12 | "\n• For a bullish trend, the input value is considered positive; for a bearish trend, it's negative." + 13 | "\n• The default value is 8 for daily timeframe. For intraday timeframes like 5 minutes, change it to 2 or 4 or adjust as needed for other timeframes." 14 | 15 | float i_pchg_250 = input.float(defval=8, title='Above/Below %', minval=0, tooltip=tt_pchg, group=g_pchg) 16 | 17 | g_rsi = '███████████ Relative Strength Index (RSI) ███████████' 18 | bool i_rsi_display = input.bool(defval=true, title='Display', group=g_rsi) 19 | int i_rsi_len = input.int(defval=14, title='RSI Length', minval=1, group=g_rsi) 20 | int i_rsi_sma_len = input.int(defval=14, title='SMA Length', minval=1, group=g_rsi) 21 | int i_rsi_ob = input.int(defval=60, title='Overbought', minval=0, maxval=100, group=g_rsi) 22 | int i_rsi_os = input.int(defval=40, title='Oversold', minval=0, maxval=100, group=g_rsi) 23 | float i_rsi_voffset = input.float(defval=1.3, title='Vertical Offset', step=0.1, group=g_rsi) 24 | float i_rsi_height = input.float(defval=2, title='Height', step=0.1, group=g_rsi) 25 | 26 | g_mfi = '█████████████ Money Flow Index (MFI) █████████████' 27 | bool i_mfi_display = input.bool(defval=true, title='Display', group=g_mfi) 28 | int i_mfi_len = input.int(defval=14, title='MFI Length', minval=1, group=g_mfi) 29 | int i_mfi_ob = input.int(defval=60, title='Overbought', minval=0, maxval=100, group=g_mfi) 30 | int i_mfi_os = input.int(defval=40, title='Oversold', minval=0, maxval=100, group=g_mfi) 31 | float i_mfi_voffset = input.float(defval=1.6, title='Vertical Offset', step=0.1, group=g_mfi)// 1.1 32 | float i_mfi_height = input.float(defval=1, title='Height', step=0.1, group=g_mfi)//1.0 33 | 34 | g_cci = '██████████ Commodity Channel Index (CCI) ██████████' 35 | bool i_cci_display = input.bool(defval=true, title='Display', group=g_cci) 36 | int i_cci_len = input.int(defval=20, title='CCI Length', minval=1, group=g_cci) 37 | int i_cci_sma_len = input.int(defval=5, title='SMA Length', minval=1, group=g_cci) 38 | int i_cci_ob = input.int(defval=100, title='Overbought', minval=0, group=g_cci) 39 | int i_cci_os = input.int(defval=-100, title='Oversold', maxval=0, group=g_cci) 40 | float i_cci_voffset = input.float(defval=1.8, title='Vertical Offset', step=0.1, group=g_cci) 41 | float i_cci_height = input.float(defval=0.2, title='Height', step=0.1, group=g_cci) 42 | 43 | g_vol = '██████████████████ Volume ██████████████████' 44 | tt_vm = 45 | "• The value shifts the volume moving average upward." + 46 | "\n• The default value of 1 means no multiplier is applied, but a multiplier of 5 indicates higher volume according to the strategy." 47 | 48 | bool i_vol_display = input.bool(defval=true, title='Display', inline='VOL', group=g_vol) 49 | string i_vol_type = input.string(defval='Regular Volume', title='Type', options=['Buying/Selling Volume', 'Regular Volume', 'None'], group=g_vol) 50 | int i_vol_ma_len = input.int(defval=20, title='MA Length', minval=1, group=g_vol) 51 | float i_vol_ma_multi = input.float(defval=5, title='MA Multiplier (x)', minval=1, tooltip=tt_vm, group=g_vol) 52 | i_vol_hoffset = 0 53 | float i_vol_voffset = input.float(defval=0.3, title='Vertical Offset', step=0.1, group=g_vol) 54 | float i_vol_height = input.float(defval=0.6, title='Height', step=0.1, group=g_vol) 55 | 56 | g_st = '█████████████████ Supertrend █████████████████' 57 | bool i_st_display = input.bool(defval=true, title='Display', group=g_st) 58 | int i_st_atr_period = input.int(defval=10, title="ATR Length", minval=1, group=g_st) 59 | float i_st_factor = input.float(defval=3.0, title="Factor", minval=0.01, step=0.01, group=g_st) 60 | 61 | //_____________________________ Menu Indicators End 62 | 63 | //_____________________________ Menu Table Start 64 | 65 | g_tb = '███████████████████ Table ███████████████████' 66 | string i_tbl_position = input.string(defval=position.top_right, title='Position', options=[position.top_left, position.top_center, position.top_right, position.middle_left, position.middle_center, position.middle_right, position.bottom_left, position.bottom_center, position.bottom_right], group=g_tb) 67 | string i_tbl_text_size = input.string(defval=size.normal, title='Size', options=[size.auto, size.tiny, size.small, size.normal, size.large, size.huge], group=g_tb) 68 | 69 | //_____________________________ Menu Table End 70 | 71 | //_____________________________ Chart Settings Start 72 | 73 | g_ch = '████████████████ Chart Settings ████████████████' 74 | int i_display_len = input.int(defval=50, title='Display Length', minval=1, group=g_ch) 75 | color i_pos_col = input.color(defval=#26A69A, title='Positive', group=g_ch) 76 | color i_pos_light_col = input.color(defval=#B2DFDB, title='Positive Light', group=g_ch) 77 | color i_neg_light_col = input.color(defval=#FFCDD2, title='Negative Light', group=g_ch) 78 | color i_neg_col = input.color(defval=#FF5250, title='Negative', group=g_ch) 79 | color i_indicator_col = input.color(defval=#2962FF, title='Indicator', group=g_ch) 80 | color i_signal_col = input.color(defval=#FF6D00, title='Signal', group=g_ch) 81 | color i_neu_col = input.color(defval=#787B86, title='Neutral', group=g_ch) 82 | 83 | //_____________________________ Chart Settings End 84 | 85 | //_____________________________ 1. Percentage Change 250 Start 86 | 87 | float pchg = (ta.change(close, 250) / close) * 100 88 | 89 | //_____________________________ 1. Percentage Change 250 end 90 | 91 | //_____________________________ 2. RSI Start 92 | 93 | float rsi = ta.rsi(close, i_rsi_len) 94 | float rsi_sma = ta.sma(rsi, i_rsi_sma_len) 95 | 96 | //_____________________________ 2. RSI End 97 | 98 | //_____________________________ 3. MFI Start 99 | 100 | float mfi = ta.mfi(hlc3, i_mfi_len) 101 | 102 | //_____________________________ 3. MFI End 103 | 104 | //_____________________________ 4. CCI Start 105 | 106 | float cci = ta.cci(hlc3, i_cci_len) 107 | float cci_sma = ta.sma(cci, i_cci_sma_len) 108 | 109 | //_____________________________ 4. CCI End 110 | 111 | //_____________________________ 5. Volume: 20 SMA Start 112 | 113 | vol_sma = ta.ema(volume, i_vol_ma_len) * i_vol_ma_multi 114 | 115 | //_____________________________ 5. Volume: 20 SMA End 116 | 117 | //_____________________________ 6. Supertrend Start 118 | 119 | [supertrend, direction] = ta.supertrend(i_st_factor, i_st_atr_period) 120 | 121 | supertrend := i_st_display and barstate.isfirst ? na : supertrend 122 | upTrend = plot(series=i_st_display and direction < 0 ? supertrend : na, title="Supertrend Up", color=i_pos_col, style=plot.style_linebr) 123 | downTrend = plot(series=i_st_display and direction < 0 ? na : supertrend, title="Supertrend Down", color=i_neg_col, style=plot.style_linebr) 124 | bodyMiddle = plot(series=i_st_display and barstate.isfirst ? na : (open + close) / 2, title="Body Middle", display=display.none) 125 | 126 | //fill(plot1=bodyMiddle, plot2=upTrend, color=color.new(i_pos_col, 90), fillgaps=false) 127 | //fill(plot1=bodyMiddle, plot2=downTrend, color=color.new(i_neg_col, 90), fillgaps=false) 128 | 129 | //_____________________________ 6. Supertrend End 130 | 131 | //_____________________________ Signals Start 132 | 133 | // Condition 134 | short_cont = 135 | //ta.crossunder(pchg, (-i_pchg_250)) and 136 | pchg < (-i_pchg_250) and 137 | rsi < i_rsi_os and 138 | mfi < i_mfi_os and 139 | cci < i_cci_os and 140 | volume > vol_sma and 141 | barstate.isconfirmed 142 | 143 | long_cont = 144 | //ta.crossover(pchg, i_pchg_250) and 145 | pchg > i_pchg_250 and 146 | rsi > i_rsi_ob and 147 | mfi > i_mfi_ob and 148 | cci > i_cci_ob and 149 | volume > vol_sma and 150 | barstate.isconfirmed 151 | 152 | // Plot 153 | plotshape(series=short_cont, title='Short Signal', style=shape.triangledown, location=location.abovebar, color=i_neg_light_col, size=size.tiny) 154 | plotshape(series=long_cont, title='Long Signal', style=shape.triangleup, location=location.belowbar, color=i_pos_light_col, size=size.tiny) 155 | 156 | bgcolor(color=short_cont ? color.new(i_neg_light_col, 90) : long_cont ? color.new(i_pos_light_col, 90) : na, title='Signal Bgcolor', show_last=i_display_len) 157 | barcolor(color=short_cont ? i_neg_light_col : long_cont ? i_pos_light_col : na, title='Signal Candle') 158 | 159 | //_____________________________ Signals End 160 | 161 | //_____________________________ Overlay Charts Start 162 | 163 | // Acknowledgement & Reference 164 | // Trader: 'dgtrd' 165 | // Indicator Title: 'Technical Analyst by DGT' 166 | // Indicator Link: 'https://www.tradingview.com/script/r2kuEi0l-Technical-Analyst-by-DGT/' 167 | 168 | // Functions ----------------------------------------------------------------------------------- // 169 | 170 | f_drawLabelX(_x, _y, _text, _xloc, _yloc, _color, _style, _textcolor, _size, _textalign, _tooltip) => 171 | var id = label.new(_x, _y, _text, _xloc, _yloc, _color, _style, _textcolor, _size, _textalign, _tooltip) 172 | label.set_text(id, _text) 173 | label.set_tooltip(id, _tooltip) 174 | label.set_xy(id, _x, _y) 175 | label.set_textcolor(id, _textcolor) 176 | 177 | // -Calculations ================================================================================ // 178 | 179 | source = close 180 | nzVolume = nz(volume) 181 | 182 | //------------------------------------------------------------------------------ 183 | // Volume 184 | 185 | //vol_sma = ta.sma(nzVolume, i_vol_ma_len) 186 | 187 | B = nzVolume * (close - low) / (high - low) 188 | S = nzVolume * (high - close) / (high - low) 189 | 190 | // Draw Charts 191 | var a_lines = array.new_line() 192 | var a_hist = array.new_box() 193 | 194 | //i_display_len = 50 195 | priceHighest = ta.highest(high, i_display_len) 196 | priceLowest = ta.lowest (low , i_display_len) 197 | priceChangeRate = (priceHighest - priceLowest) / priceHighest 198 | 199 | oscHighest = 100//ta.highest(osc, i_display_len) 200 | 201 | volumeMARate = nzVolume / vol_sma 202 | volumeHighest = ta.highest(nzVolume, i_display_len) 203 | bullCandle = close > open 204 | 205 | if barstate.islast 206 | if array.size(a_lines) > 0 207 | for i = 1 to array.size(a_lines) 208 | line.delete(array.shift(a_lines)) 209 | 210 | if array.size(a_hist) > 0 211 | for i = 1 to array.size(a_hist) 212 | box.delete(array.shift(a_hist)) 213 | 214 | if i_mfi_display 215 | mid_line = math.avg(100, 0) 216 | array.push(a_hist, box.new (bar_index[i_display_len], priceLowest * (1 - priceChangeRate * i_mfi_voffset) * (1 + i_mfi_ob / oscHighest * priceChangeRate * i_mfi_height), 217 | bar_index , priceLowest * (1 - priceChangeRate * i_mfi_voffset) * (1 + i_mfi_ob / oscHighest * priceChangeRate * i_mfi_height), color.new(i_pos_col, 75), 1)) 218 | array.push(a_hist, box.new (bar_index[i_display_len], priceLowest * (1 - priceChangeRate * i_mfi_voffset) * (1 + mid_line / oscHighest * priceChangeRate * i_mfi_height), 219 | bar_index , priceLowest * (1 - priceChangeRate * i_mfi_voffset) * (1 + mid_line / oscHighest * priceChangeRate * i_mfi_height), color.new(i_neu_col, 75), 1)) 220 | array.push(a_hist, box.new (bar_index[i_display_len], priceLowest * (1 - priceChangeRate * i_mfi_voffset) * (1 + i_mfi_os / oscHighest * priceChangeRate * i_mfi_height), 221 | bar_index , priceLowest * (1 - priceChangeRate * i_mfi_voffset) * (1 + i_mfi_os / oscHighest * priceChangeRate * i_mfi_height), color.new(i_neg_col, 75), 1)) 222 | f_drawLabelX( bar_index + 3 , priceLowest * (1 - priceChangeRate * i_mfi_voffset) * (1 + mid_line / oscHighest * priceChangeRate * i_mfi_height), 'MFI', xloc.bar_index, yloc.price, #00000000, label.style_label_left, chart.fg_color, size.small, text.align_center, str.tostring(mfi, '#.##')) 223 | 224 | if i_rsi_display 225 | mid_line = math.avg(100, 0) 226 | array.push(a_hist, box.new (bar_index[i_display_len], priceLowest * (1 - priceChangeRate * i_rsi_voffset) * (1 + i_rsi_ob / oscHighest * priceChangeRate * i_rsi_height), 227 | bar_index , priceLowest * (1 - priceChangeRate * i_rsi_voffset) * (1 + i_rsi_ob / oscHighest * priceChangeRate * i_rsi_height), color.new(i_pos_col, 75), 1)) 228 | array.push(a_hist, box.new (bar_index[i_display_len], priceLowest * (1 - priceChangeRate * i_rsi_voffset) * (1 + mid_line / oscHighest * priceChangeRate * i_rsi_height), 229 | bar_index , priceLowest * (1 - priceChangeRate * i_rsi_voffset) * (1 + mid_line / oscHighest * priceChangeRate * i_rsi_height), color.new(i_neu_col, 75), 1)) 230 | array.push(a_hist, box.new (bar_index[i_display_len], priceLowest * (1 - priceChangeRate * i_rsi_voffset) * (1 + i_rsi_os / oscHighest * priceChangeRate * i_rsi_height), 231 | bar_index , priceLowest * (1 - priceChangeRate * i_rsi_voffset) * (1 + i_rsi_os / oscHighest * priceChangeRate * i_rsi_height), color.new(i_neg_col, 75), 1)) 232 | f_drawLabelX( bar_index + 3 , priceLowest * (1 - priceChangeRate * i_rsi_voffset) * (1 + mid_line / oscHighest * priceChangeRate * i_rsi_height), 'RSI', xloc.bar_index, yloc.price, #00000000, label.style_label_left, chart.fg_color, size.small, text.align_center, str.tostring(rsi, '#.##')) 233 | 234 | if i_cci_display 235 | mid_line = math.avg(100, 0) 236 | array.push(a_hist, box.new (bar_index[i_display_len], priceLowest * (1 - priceChangeRate * i_cci_voffset) * (1 + i_cci_ob / oscHighest * priceChangeRate * i_cci_height), 237 | bar_index , priceLowest * (1 - priceChangeRate * i_cci_voffset) * (1 + i_cci_ob / oscHighest * priceChangeRate * i_cci_height), color.new(i_pos_col, 75), 1)) 238 | array.push(a_hist, box.new (bar_index[i_display_len], priceLowest * (1 - priceChangeRate * i_cci_voffset), 239 | bar_index , priceLowest * (1 - priceChangeRate * i_cci_voffset), color.new(i_neu_col, 75), 1)) 240 | array.push(a_hist, box.new (bar_index[i_display_len], priceLowest * (1 - priceChangeRate * i_cci_voffset) * (1 + i_cci_os / oscHighest * priceChangeRate * i_cci_height), 241 | bar_index , priceLowest * (1 - priceChangeRate * i_cci_voffset) * (1 + i_cci_os / oscHighest * priceChangeRate * i_cci_height), color.new(i_neg_col, 75), 1)) 242 | f_drawLabelX( bar_index + 3 , priceLowest * (1 - priceChangeRate * i_cci_voffset), 'CCI', xloc.bar_index, yloc.price, #00000000, label.style_label_left, chart.fg_color, size.small, text.align_center, str.tostring(cci, '#.##')) 243 | 244 | if i_vol_type != 'None' 245 | f_drawLabelX( bar_index + 3 , priceHighest * (1 + priceChangeRate * i_vol_voffset), 'VOL', xloc.bar_index, yloc.price, #00000000, label.style_label_left, chart.fg_color, size.small, text.align_center, 'Buy Vol : ' + str.tostring(B / (B + S) * 100, '#.##') + '%\nSell Vol : ' + str.tostring(S / (B + S) * 100, '#.##') + '%\nLast Vol : ' + str.tostring(nzVolume, format.volume) + '\nAvg Vol : ' + str.tostring(vol_sma, format.volume)) 246 | 247 | for barIndex = 0 to i_display_len - 1 248 | if array.size(a_lines) < 500 249 | 250 | if i_mfi_display 251 | array.push(a_lines, line.new(bar_index[barIndex], priceLowest * (1 - priceChangeRate * i_mfi_voffset) * (1 + mfi[barIndex] / oscHighest * priceChangeRate * i_mfi_height), 252 | bar_index[barIndex + 1], priceLowest * (1 - priceChangeRate * i_mfi_voffset) * (1 + mfi[barIndex + 1] / oscHighest * priceChangeRate * i_mfi_height), xloc.bar_index, extend.none, i_indicator_col , line.style_solid, 1)) 253 | 254 | if i_rsi_display 255 | array.push(a_lines, line.new(bar_index[barIndex], priceLowest * (1 - priceChangeRate * i_rsi_voffset) * (1 + rsi[barIndex] / oscHighest * priceChangeRate * i_rsi_height), 256 | bar_index[barIndex + 1], priceLowest * (1 - priceChangeRate * i_rsi_voffset) * (1 + rsi[barIndex + 1] / oscHighest * priceChangeRate * i_rsi_height), xloc.bar_index, extend.none, i_indicator_col , line.style_solid, 1)) 257 | array.push(a_lines, line.new(bar_index[barIndex], priceLowest * (1 - priceChangeRate * i_rsi_voffset) * (1 + rsi_sma[barIndex] / oscHighest * priceChangeRate * i_rsi_height), 258 | bar_index[barIndex + 1], priceLowest * (1 - priceChangeRate * i_rsi_voffset) * (1 + rsi_sma[barIndex + 1] / oscHighest * priceChangeRate * i_rsi_height), xloc.bar_index, extend.none, i_signal_col , line.style_solid, 1)) 259 | 260 | if i_cci_display 261 | array.push(a_lines, line.new(bar_index[barIndex], priceLowest * (1 - priceChangeRate * i_cci_voffset) * (1 + cci[barIndex] / oscHighest * priceChangeRate * i_cci_height), 262 | bar_index[barIndex + 1], priceLowest * (1 - priceChangeRate * i_cci_voffset) * (1 + cci[barIndex + 1] / oscHighest * priceChangeRate * i_cci_height), xloc.bar_index, extend.none, i_indicator_col , line.style_solid, 1)) 263 | array.push(a_lines, line.new(bar_index[barIndex], priceLowest * (1 - priceChangeRate * i_cci_voffset) * (1 + cci_sma[barIndex] / oscHighest * priceChangeRate * i_cci_height), 264 | bar_index[barIndex + 1], priceLowest * (1 - priceChangeRate * i_cci_voffset) * (1 + cci_sma[barIndex + 1] / oscHighest * priceChangeRate * i_cci_height), xloc.bar_index, extend.none, i_signal_col , line.style_solid, 1)) 265 | 266 | if nzVolume 267 | if i_vol_type != 'None' 268 | array.push(a_hist, box.new (bar_index[barIndex] + i_vol_hoffset, priceHighest * (1 + priceChangeRate * i_vol_voffset), 269 | bar_index[barIndex] + i_vol_hoffset, priceHighest * (1 + priceChangeRate * i_vol_voffset) * (1 + nzVolume[barIndex] / volumeHighest * priceChangeRate * i_vol_height), i_vol_type == 'Buying/Selling Volume' ? color.new(i_pos_col, 0) : bullCandle[barIndex] ? color.new(i_pos_col, 0) : color.new(i_neg_col, 0), 2, bgcolor = i_vol_type == 'Buying/Selling Volume' ? color.new(i_pos_col, 0) : bullCandle[barIndex] ? color.new(i_pos_col, 0) : color.new(i_neg_col, 0))) 270 | if i_vol_type == 'Buying/Selling Volume' 271 | array.push(a_hist, box.new (bar_index[barIndex] + i_vol_hoffset, priceHighest * (1 + priceChangeRate * i_vol_voffset), 272 | bar_index[barIndex] + i_vol_hoffset, priceHighest * (1 + priceChangeRate * i_vol_voffset) * (1 + S[barIndex] / volumeHighest * priceChangeRate * i_vol_height), color.new(i_neg_col, 0), 2, bgcolor = color.new(i_neg_col, 0))) 273 | // Voumme MA 274 | if i_vol_display 275 | array.push(a_lines, line.new(bar_index[barIndex] + i_vol_hoffset, priceHighest * (1 + priceChangeRate * i_vol_voffset) * (1 + nzVolume[barIndex] / volumeHighest * priceChangeRate * i_vol_height / volumeMARate[barIndex]), 276 | bar_index[barIndex + 1] + i_vol_hoffset, priceHighest * (1 + priceChangeRate * i_vol_voffset) * (1 + nzVolume[barIndex + 1] / volumeHighest * priceChangeRate * i_vol_height / volumeMARate[barIndex + 1]), xloc.bar_index, extend.none, i_neu_col, line.style_solid, 1)) 277 | 278 | //_____________________________ Overlay Charts End 279 | 280 | //_____________________________ Overlay Charts Table Start 281 | 282 | var table tbl = table.new(position=i_tbl_position, columns=2, rows=5, border_width=2) 283 | 284 | // Color 285 | col_pchg = pchg > i_pchg_250 ? i_pos_col : pchg < (-i_pchg_250) ? i_neg_col : i_neu_col 286 | col_rsi = rsi > i_rsi_ob ? i_pos_col : rsi < i_rsi_os ? i_neg_col : i_neu_col 287 | col_mfi = mfi > i_mfi_ob ? i_pos_col : mfi < i_mfi_os ? i_neg_col : i_neu_col 288 | col_cci = cci > i_cci_ob ? i_pos_col : cci < i_cci_os ? i_neg_col : i_neu_col 289 | col_vol = volume > vol_sma ? i_pos_col : i_neu_col 290 | 291 | // Function to populate cells in the table 292 | cell(int column, int row, string txt, color color) => 293 | table.cell(tbl, column, row, text = txt, text_color = color, text_halign=text.align_left, bgcolor = color.new(color, 90), text_size=i_tbl_text_size) 294 | 295 | // Check if it's the last bar 296 | if barstate.islast 297 | cell(0, 0, "%Chg", col_pchg) 298 | cell(0, 1, "RSI", col_rsi) 299 | cell(0, 2, "MFI", col_mfi) 300 | cell(0, 3, "CCI", col_cci) 301 | cell(0, 4, "Vol", col_vol) 302 | 303 | cell(1, 0, str.tostring(pchg, '#.##'), col_pchg) 304 | cell(1, 1, str.tostring(rsi, '#.##'), col_rsi) 305 | cell(1, 2, str.tostring(mfi, '#.##'), col_mfi) 306 | cell(1, 3, str.tostring(cci, '#.##'), col_cci) 307 | cell(1, 4, str.tostring((volume / 100000), '#.##') + ' L', col_vol) 308 | 309 | //_____________________________ Overlay Charts Table Start 310 | 311 | //_____________________________ Code End 312 | 313 | // Readme First: 314 | // 315 | // About: 316 | // This is a Momentum Investing Strategy Setup shared by trader Ankush Bajaj. 317 | // The original video is based on the daily timeframe for long-term investment. 318 | // This strategy can also be adapted for lower timeframes. 319 | // To adapted the strategy for lower timeframes like 5 minutes, change the 'Above/Below %' to 2 or 4 or adjust as needed according your timeframe. 320 | // Example: For 5 min timeframe use 'Above/Below %' as 2. For 1hr timeframe use 'Above/Below %' as 4. 321 | // Also adjust the 'MA Multiplier (x)' value. Default is 5x. This can be adjusted to 2 times, 3 times etc. 322 | // 323 | // Strategy Reference Video: 324 | // Video Title: "Momentum Investing Strategies | Understand Different Types of Momentum Strategies | Ep 141" 325 | // Video Link: https://www.youtube.com/watch?v=-uEEmnFtDIw 326 | // Video Title: "Momentum Investing using Technical Indicators | Ep 142 | Samco Securities" 327 | // Video Link: https://www.youtube.com/watch?v=zmpsx7BpzvU&t=1154s 328 | // 329 | // Strategy Type: Momentum 330 | // Bias: Strongly Directional 331 | // Trading Style: Investment 332 | // Instrument: Any 333 | // Original Symbol: Any 334 | // Timeframe: Daily (default) 335 | // 336 | // Indicator Used and Settings: 337 | // 1. % Change of last 250 candle 338 | // 2. RSI 14 339 | // 3. MFI 14 340 | // 4. CCI 20 341 | // 5. Volume 20 EMA 342 | // 343 | // Long Entry Rules (As per the video): 344 | // - Daily Timeframe 345 | // - % Change of 250 Candle > 8 346 | // - RSI above 60 347 | // - MFI above 60 348 | // - CCI above 100 349 | // - Volume > EMA 20 of Volume * 5 350 | // - Market Cap > 1000 Crore 351 | // - Price > Rs.50 352 | // 353 | // Short Entry Rules (Not mentioned in the video): 354 | // - Daily Timeframe 355 | // - % Change of 250 Candle < -8 356 | // - RSI below 40 357 | // - MFI below 40 358 | // - CCI below -100 359 | // - Volume > EMA 20 of Volume * 5 360 | // - Market Cap > 1000 Crore 361 | // - Price > Rs.50 -------------------------------------------------------------------------------- /Momentum Setup - Ankush Bajaj Momentum Investing Setup/Readme First.txt: -------------------------------------------------------------------------------- 1 | Readme First: 2 | 3 | About: 4 | This is a Momentum Investing Strategy Setup shared by trader Ankush Bajaj. 5 | The original video is based on the daily timeframe for long-term investment. 6 | This strategy can also be adapted for lower timeframes. 7 | To adapted the strategy for lower timeframes like 5 minutes, change the 'Above/Below %' to 2 or 4 or adjust as needed according your timeframe. 8 | Example: For 5 min timeframe use 'Above/Below %' as 2. For 1hr timeframe use 'Above/Below %' as 4. 9 | Also adjust the 'MA Multiplier (x)' value. Default is 5x. This can be adjusted to 2 times, 3 times etc. 10 | 11 | Strategy Reference Video: 12 | Video Title: "Momentum Investing Strategies | Understand Different Types of Momentum Strategies | Ep 141" 13 | Video Link: https://www.youtube.com/watch?v=-uEEmnFtDIw 14 | Video Title: "Momentum Investing using Technical Indicators | Ep 142 | Samco Securities" 15 | Video Link: https://www.youtube.com/watch?v=zmpsx7BpzvU&t=1154s 16 | 17 | Strategy Type: Momentum 18 | Bias: Strongly Directional 19 | Trading Style: Investment 20 | Instrument: Any 21 | Original Symbol: Any 22 | Timeframe: Daily (default) 23 | 24 | Indicator Used and Settings: 25 | 1. % Change of last 250 candle 26 | 2. RSI 14 27 | 3. MFI 14 28 | 4. CCI 20 29 | 5. Volume 20 EMA 30 | 31 | Long Entry Rules (As per the video): 32 | - Daily Timeframe 33 | - % Change of 250 Candle > 8 34 | - RSI above 60 35 | - MFI above 60 36 | - CCI above 100 37 | - Volume > EMA 20 of Volume * 5 38 | - Market Cap > 1000 Crore 39 | - Price > Rs.50 40 | 41 | Short Entry Rules (Not mentioned in the video): 42 | - Daily Timeframe 43 | - % Change of 250 Candle < -8 44 | - RSI below 40 45 | - MFI below 40 46 | - CCI below -100 47 | - Volume > EMA 20 of Volume * 5 48 | - Market Cap > 1000 Crore 49 | - Price > Rs.50 -------------------------------------------------------------------------------- /Momentum Setup - RSI Directional Momentum/[Readme] Momentum Setup - RSI Directional Momentum.txt: -------------------------------------------------------------------------------- 1 | 2 | // Read Me First 3 | // 4 | // Indicator Title: "Momentum Setup - RSI Directional Momentum Scanner" 5 | // 6 | // Overview 7 | // - Upgraded From: "Momentum Setup: RSI Confirmed Direction Scanner". 8 | // - Improvements: Optimized for speed, refined signals, better performance. 9 | // 10 | // Features 11 | // - Scanning Methods: 12 | // - Continuous Break: RSI breakout signals. 13 | // - Continuous Retracement: Fibonacci retracement after break. 14 | // - Flip Break: Failed break flips trade direction. 15 | // - Flip Retracement: Failed retracement flips trade. 16 | // - Divergence: Price vs. RSI divergence. 17 | // - Hidden Divergence: Trend continuation signals. 18 | // 19 | // Note: Read tooltips for more clarity. 20 | // 21 | // Questions?: Message the author on TradingView: https://www.tradingview.com/u/Arun_K_Bhaskar/ 22 | // 23 | // More Indicators: Free TradingView indicators and source code on GitHub: https://github.com/ArunKBhaskar/PineScript 24 | -------------------------------------------------------------------------------- /Momentum Setup - RSI Directional Momentum/[Screenshot] Momentum Setup - RSI Directional Momentum 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArunKBhaskar/PineScript/c6821225c466494b01eee08f9dd88bf84d2b24ba/Momentum Setup - RSI Directional Momentum/[Screenshot] Momentum Setup - RSI Directional Momentum 1.png -------------------------------------------------------------------------------- /Momentum Setup - RSI Directional Momentum/[Screenshot] Momentum Setup - RSI Directional Momentum 2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArunKBhaskar/PineScript/c6821225c466494b01eee08f9dd88bf84d2b24ba/Momentum Setup - RSI Directional Momentum/[Screenshot] Momentum Setup - RSI Directional Momentum 2.png -------------------------------------------------------------------------------- /Momentum Setup - Vijay Thakare Option Buying Scalping Setup/Momentum Setup - Vijay Thakare Option Buying Scalping Setup with Scanner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArunKBhaskar/PineScript/c6821225c466494b01eee08f9dd88bf84d2b24ba/Momentum Setup - Vijay Thakare Option Buying Scalping Setup/Momentum Setup - Vijay Thakare Option Buying Scalping Setup with Scanner.png -------------------------------------------------------------------------------- /Momentum Setup - Vijay Thakare Option Buying Scalping Setup/Readme First.txt: -------------------------------------------------------------------------------- 1 | Readme First: 2 | 3 | About: 4 | This is a BANKNIFTY option buying or scalping setup shared by trader Vijay S. Thakare on YouTube. 5 | 6 | Strategy Reference Video: 7 | Vijay Thakare at Traders Carnival Seminar: 8 | Video Title: "Vijay Thakare: An Excellent Option Scalper Sharing His Knowledge @ Traders Carnival" 9 | Video Link: https://www.youtube.com/watch?v=6INokexfeLc 10 | 11 | Explanation Video from His YouTube Channel: 12 | Video Title: "Setup Video" 13 | Video Link: https://www.youtube.com/watch?v=KK5j1dgklIY&t=9150s 14 | 15 | Strategy Type: Momentum 16 | Bias: Strongly Directional 17 | Trading Style: Scalping 18 | Instrument: Option - Buying 19 | Original Symbol: NSE:BANKNIFTY (Works with other symbols as well) 20 | Timeframe: 5 minute 21 | 22 | Risk Reward Ratio: 1:2 23 | Stop Loss: Rs. 20 on the premium chart 24 | Target: Rs. 40 on the premium chart 25 | 26 | Charts Referred: 27 | - BANKNIFTY Futures Chart 28 | - BANKNIFTY Options Premium Chart 29 | 30 | Indicator Used and Settings: 31 | 1. EMA: Close, 20, 50, 100, 200 32 | 2. VWAP: Daily VWAP 33 | 3. MACD: Fast Length - 3, Slow Length - 9, Signal Smoothing - 15 34 | 4. Stochastic: %K Length - 5, %K Smoothing - 3, %D Smoothing - 3 35 | 36 | Long Entry Rules: 37 | - Close above VWAP 38 | - Close above Supertrend (Not in original strategy. It avoids many false signals.) 39 | - MACD above 0 40 | - Stochastic above 40 41 | - Consider VWAP, EMA 20, 50, 100, 200 are closer to each other 42 | - Rising volume (optional) 43 | 44 | Short Entry Rules: 45 | - Close below VWAP 46 | - Close below Supertrend (Not in original strategy. It avoids many false signals.) 47 | - MACD below 0 48 | - Stochastic below 60 49 | - Consider VWAP, EMA 20, 50, 100, 200 are closer to each other 50 | - Rising volume (optional) 51 | 52 | Update 09 June 2024 53 | 1. Added Supertrend filter. 54 | 2. Added TWAP to use it with Symbols without Volume. 55 | 3. Removed indicator values Table. 56 | 4. Two types of scanners are available. One generates continuous signals and one generates flip signals. 57 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TradingView Pine Script Code Collection 2 | This is a collection of TradingView Pine Script codes which are not published in TradingView. 3 | 4 | # How to add the Pine Script Code to TradingView Chart? 5 | 1. Open TradingView chart. 6 | 2. Click "Pine Editor" at the bottom. 7 | 3. Copy indicator code and Paste it in Pine Editor. 8 | 4. Click "Save" in Pine Editor. 9 | 5. Click "Add to Chart" in Pine Editor. 10 | 6. Your indicator will be displayed on the chart. 11 | 12 | # Open-source script 13 | This repository contains scripts created by the various authors, shared openly under the terms of the Mozilla Public License 2.0. The license details can be found at https://mozilla.org/MPL/2.0/. 14 | By making the script open-source, the authors encourages collaboration and scrutiny, allowing users to understand and verify the underlying indicators. 15 | 16 | # Disclaimer 17 | The information and publications are not intended to be, and do not constitute, financial, investment, trading, or any other form of advice or recommendations supplied or endorsed by the publisher or the creators of this script. Users are advised to exercise their own judgment and seek professional advice before making any financial decisions. 18 | 19 | # Donation 20 | If you find any indicator that improves your trading or helps you make money, consider donating-if you wish. 21 | UPI ID: arunkbhaskar@apl 22 | -------------------------------------------------------------------------------- /Trend Following Setup - Sideways Market Skipper Scanner/Indicator - Trend Following Setup - Sideways Market Skipper.txt: -------------------------------------------------------------------------------- 1 | // This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ 2 | // © Arun_K_Bhaskar 3 | 4 | //@version=5 5 | indicator(title='Trend Following Setup - Sideways Market Skipper', shorttitle='Sideways Skip', overlay=false, max_bars_back=500) 6 | 7 | //_____________________________ Menu Supertrend Start 8 | 9 | g_st = '█████████████████ Supertrend █████████████████' 10 | //bool i_st_display = input.bool(defval=true, title='Display', group=g_st) 11 | int i_st_atr_period = input.int(defval=10, title="ATR Length", minval=1, group=g_st) 12 | float i_st_factor = input.float(defval=3.0, title="Factor", minval=0.01, step=0.01, group=g_st) 13 | 14 | //_____________________________ Menu Supertrend End 15 | 16 | //_____________________________ Menu Range Start 17 | 18 | g_r = '███████████████ Volatility Range ███████████████' 19 | 20 | tt_r = 21 | "• 'Auto ATR': Automatically sets the range based on the ATR value." + 22 | "\n• The range adjusts automatically when switching between symbols." + 23 | "\n• The default ATR timeframe is 1 hour." + 24 | "\n• For a Supertrend Long Crossover, the range is defined by adding the ATR value." + 25 | "\n• For a Supertrend Short Crossunder, the range is defined by subtracting the ATR value." + 26 | "\n\n• Type Points: Manually enter the points for different symbols to define the volatility range." + 27 | "\n• For example, the points are 60 for NIFTY and 120 for BANKNIFTY." 28 | 29 | tt_tp = "Applicable only when 'Range Type' is selected as 'Type Points'." 30 | 31 | tt_atr_tf = 32 | "• This uses the ATR value of the given timeframe." + 33 | "\n• The default ATR timeframe is 1 hour." 34 | 35 | bool i_atr_range_display = input.bool(defval=true, title='Display', group=g_r) 36 | string i_atr_range_choice = input.string(defval='Auto ATR', title='Range Type', options=['Auto ATR', 'Type Points'], tooltip=tt_r, group=g_r) 37 | float i_atr_range_points = input.float(defval=120, title="Type Points", minval=0.01, tooltip=tt_tp, group=g_r) 38 | 39 | //string i_atr_range_timeframe = input.timeframe(defval='60', title='ATR Timeframe', tooltip=tt_atr_tf, group=g_r) 40 | int i_atr_range_length = input.int(defval=14, title='ATR Length', minval=1, group=g_r) 41 | string i_atr_range_smoothing = input.string(title="ATR Smoothing", defval="RMA", options=["RMA", "SMA", "EMA", "WMA"], group=g_r) 42 | float i_atr_range_multiplier = input.float(defval=1.5, title="ATR Multiplier", minval=1, step=0.5, group=g_r) 43 | int i_atr_range_sma_length = input.int(defval=14, title='ATR SMA Length', minval=1, group=g_r) 44 | 45 | //_____________________________ Menu Range End 46 | 47 | //_____________________________ Menu Additional Fiters Start 48 | 49 | g_af = '███████████████ Additional Fiters ███████████████' 50 | tt_pchg = 51 | "• If '% Change Above/Below +/-' is 4, it means relative volume is considered when the price change is above 4%." + 52 | "\n• A value of 4% is positive for bullish scenarios and negative for bearish scenarios." + 53 | "\n• The percentage change is calculated using cumulative percentage change, so there might be a minor difference between the actual and displayed percentage change." 54 | tt_vpchg = 55 | "• If 'Volume % Change Above' is 0, it means Relative Volume is considered when today's volume is greater than the previous day's volume." + 56 | "\n• For 'Screening Method' choice 'Retracement to EMA,' the 'Apply Volume % Change Filter' can be unchecked." + 57 | "\n• A 'Volume % Change Above' 300% or more often indicates a major breakout, which may happen today or the next day." + 58 | "\n• The volume percentage change is calculated using cumulative percentage change, so there might be a minor difference between the actual and displayed percentage change." 59 | tt_atr = 60 | "• ATR helps filter out longer or more volatile signal candles." 61 | tt_atr_mul = 62 | "• Higher multiplier value filters a longer or more volatile signal candle." 63 | tt_bf = 64 | "• If the input is '80', it means the body covers over 80% of the candle." 65 | tt_bs = 66 | "• 2 means the candle is 2 times larger than the previous candle." 67 | tt_vol = 68 | "• Filter out a candle when its volume is greater than the SMA of the volume." 69 | tt_rv = 70 | "• Filter out a candle when its volume is greater than the Relative Volume." 71 | tt_tf = 72 | "• Filter out a signals between the given Time." 73 | 74 | bool i_pchg_filter = input.bool(defval=false, title='Apply % Change Filter', tooltip=tt_pchg, group=g_af) 75 | float i_pchg_above_below = input.float(defval=2, title='% Change Above/Below +/-', minval=0, group=g_af) 76 | 77 | bool i_vol_pchg_filter = input.bool(defval=false, title='Apply Volume % Change Filter', tooltip=tt_vpchg, group=g_af) 78 | float i_vol_pchg_above = input.float(defval=0, title='Volume % Change Above', minval=0, group=g_af) 79 | 80 | bool i_atr_filter = input.bool(defval=true, title='Apply ATR Filter', tooltip=tt_atr, group=g_af) 81 | int i_atr_length = input.int(defval=14, minval=1, title='ATR Length', group=g_af) 82 | float i_atr_multi = input.float(defval=1, title='ATR Multiplier', minval=1, group=g_af) 83 | 84 | bool i_body_filter = input.bool(defval=false, title='Apply Body % Filter', tooltip=tt_bf, group=g_af) 85 | float i_body_percent = input.float(defval=80, title='Body % Above', minval=0, maxval=100, group=g_af) / 100 86 | 87 | bool i_body_size_filter = input.bool(defval=false, title='Apply Body Size Filter', tooltip=tt_bs, group=g_af) 88 | int i_body_size_multiplier = input.int(defval=2, title='Body Size Multiplier (x)', minval=0, group=g_af) 89 | 90 | bool i_volume_filter = input.bool(defval=false, title='Apply Volume Filter', tooltip=tt_vol, group=g_af) 91 | int i_vol_sma_length = input.int(defval=20, minval=1, title='Volume SMA Length', group=g_af) 92 | 93 | bool i_rel_vol_filter = input.bool(defval=false, title='Apply Relative Volume Filter', tooltip=tt_rv, group=g_af) 94 | int i_rel_vol_avg_vol_len = input.int(defval=90, title='Relative Volume Length', minval=2, group=g_af) 95 | float i_rel_vol_avg_vol_multi = input.float(defval=5, title='Rel Vol SMA Multiplier', minval=0, group=g_af) 96 | 97 | bool i_time_filter = input.bool(defval=false, title='Apply Time Filter', tooltip=tt_tf, group=g_af) 98 | int i_hour_1 = input.int(defval=9, minval=0, title='Time From', inline='t_1', group=g_af) 99 | int i_minute_1 = input.int(defval=15, minval=0, title=':', inline='t_1', group=g_af) 100 | int i_hour_2 = input.int(defval=10, minval=0, title='Time To ', inline='t_2', group=g_af) 101 | int i_minute_2 = input.int(defval=15, minval=0, title=':', inline='t_2', group=g_af) 102 | 103 | //_____________________________ Menu Additional Fiters End 104 | 105 | //_____________________________ Menu Table Start 106 | 107 | g_dtb = '█████████████████ Data Table █████████████████' 108 | bool i_tbl_data_show = input.bool(defval=true, title='Display Table', group=g_dtb) 109 | string i_tbl_data_pos = input.string(defval=position.bottom_right, title='Position', options=[position.top_left, position.top_center, position.top_right, position.middle_left, position.middle_center, position.middle_right, position.bottom_left, position.bottom_center, position.bottom_right], group=g_dtb) 110 | string i_tbl_data_txt_size = input.string(defval=size.normal, title='Size', options=[size.auto, size.tiny, size.small, size.normal, size.large, size.huge], group=g_dtb) 111 | 112 | //_____________________________ Menu Table End 113 | 114 | //_____________________________ Chart Settings Start 115 | 116 | g_ch = '███████████████ Chart Settings ███████████████' 117 | color i_pos_color = input.color(defval=#26A69A, title='Positive Mid', group=g_ch) 118 | color i_pos_light_color = input.color(defval=#ACE5DC, title='Positive Light', group=g_ch) 119 | color i_neg_light_color = input.color(defval=#FCCBCD, title='Negative Light', group=g_ch) 120 | color i_neg_color = input.color(defval=#FF5252, title='Negative Mid', group=g_ch) 121 | color i_indicator_color = input.color(defval=#2962FF, title='Indicator', group=g_ch) 122 | color i_signal_color = input.color(defval=#FF6D00, title='Signal', group=g_ch) 123 | color i_neu_color = input.color(defval=#D1D4DC, title='Neutral Light', group=g_ch) 124 | color i_neu_mid_color = input.color(defval=#2A2E39, title='Neutral Mid', group=g_ch) 125 | color i_neu_dark_color = input.color(defval=#141516, title='Neutral Dark', group=g_ch) 126 | 127 | //_____________________________ Chart Settings End 128 | 129 | //_____________________________ 1. Supertrend Start 130 | 131 | [supertrend, direction] = ta.supertrend(i_st_factor, i_st_atr_period) 132 | supertrend := barstate.isfirst ? na : supertrend 133 | 134 | // Plot Supertrend 135 | upTrend = plot(series=direction < 0 ? supertrend : na, title="Supertrend Up", color=i_pos_color, style=plot.style_linebr, force_overlay=true) 136 | downTrend = plot(series=direction < 0 ? na : supertrend, title="Supertrend Down", color=i_neg_color, style=plot.style_linebr, force_overlay=true) 137 | bodyMiddle = plot(series=barstate.isfirst ? na : (open + close) / 2, title="Body Middle", display=display.none, force_overlay=true) 138 | fill(plot1=bodyMiddle, plot2=upTrend, color=color.new(i_pos_color, 90), fillgaps=false) 139 | fill(plot1=bodyMiddle, plot2=downTrend, color=color.new(i_neg_color, 90), fillgaps=false) 140 | 141 | //_____________________________ 1. Supertrend End 142 | 143 | //_____________________________ 2. ATR Start 144 | 145 | ma_function_atr(source, length) => 146 | switch i_atr_range_smoothing 147 | 'RMA' => ta.rma(source, length) 148 | 'SMA' => ta.sma(source, length) 149 | 'EMA' => ta.ema(source, length) 150 | 'WMA' => ta.wma(source, length) 151 | 152 | atr = ma_function_atr(ta.tr(true), i_atr_range_length) 153 | atr_sma = ta.sma(atr, i_atr_range_sma_length) 154 | plot(series=atr, title="ATR", color=i_indicator_color) 155 | plot(series=atr_sma, title="ATR SMA", color=i_signal_color) 156 | 157 | // Range Source 158 | range_input = i_atr_range_choice == 'Auto ATR' ? (atr * i_atr_range_multiplier) : i_atr_range_points 159 | range_source = i_atr_range_choice == 'Type Points' ? i_atr_range_points :range_input 160 | 161 | //_____________________________ 2. ATR End 162 | 163 | //_____________________________ Cumulative Percentage Change Start 164 | 165 | // Function to calculate Daily Cumulative Percentage Change of Close Price 166 | cumulative_percentage_change() => 167 | var float _cum_pct_change = na 168 | _is_new_day = ta.change(time('D')) != 0 ? 1 : 0 169 | _daily_pct_change = na(close[1]) ? 0 : (close - close[1]) / close[1] * 100 170 | _cum_pct_change := _is_new_day ? _daily_pct_change : (na(_cum_pct_change) ? _daily_pct_change : (_cum_pct_change + _daily_pct_change)) 171 | _cum_pct_change 172 | 173 | // Calculate current cumulative percentage change 174 | cum_pchg = cumulative_percentage_change() 175 | 176 | //_____________________________ Cumulative Percentage Change End 177 | 178 | //_____________________________ Cumulative Volume Percentage Change Start 179 | 180 | // Function to calculate Daily Cumulative Volume 181 | cumulative_volume() => 182 | var float _cum_vol = na 183 | _is_new_day = ta.change(time('D')) != 0 ? 1 : 0 184 | _cum_vol := _is_new_day ? volume : (na(_cum_vol) ? volume : (_cum_vol + volume)) 185 | _cum_vol 186 | 187 | // Calculate current and previous day cumulative volumes 188 | var float current_cum_vol = na 189 | var float prev_cum_vol = na 190 | 191 | if ta.change(time('D')) != 0 192 | prev_cum_vol := current_cum_vol 193 | current_cum_vol := volume 194 | else 195 | current_cum_vol += volume 196 | 197 | // Calculate Cumulative Volume Percentage Change 198 | cum_vol_pchg = (current_cum_vol - nz(prev_cum_vol, current_cum_vol)) / nz(prev_cum_vol, current_cum_vol) * 100 199 | 200 | //_____________________________ Cumulative Volume Percentage Change End 201 | 202 | //_____________________________ Additional Filters Start 203 | 204 | // % Change Filter 205 | bool pchg_above_filter = true 206 | bool pchg_below_filter = true 207 | if i_pchg_filter 208 | pchg_above_filter := cum_pchg > i_pchg_above_below 209 | pchg_below_filter := cum_pchg < -i_pchg_above_below 210 | 211 | // Volume % Change Filter 212 | bool vol_pchg_filter = true 213 | if i_vol_pchg_filter 214 | vol_pchg_filter := cum_vol_pchg >= i_vol_pchg_above 215 | 216 | // ATR Filter 217 | bool atr_filter = true 218 | if i_atr_filter 219 | atr_filter := (high - low) > ta.atr(i_atr_length) * i_atr_multi 220 | 221 | // Body Percent Filter 222 | bool body_filter = true 223 | if i_body_filter 224 | body_filter := (math.abs(close - open)) / (high - low) >= i_body_percent 225 | 226 | // Body Size Filter 227 | bool body_size_filter = true 228 | if i_body_size_filter 229 | body_size_filter := (math.abs(close - open)) / (high - low) >= i_body_percent and (high - low) >= (high[1] - low[1]) * i_body_size_multiplier 230 | 231 | // Volume SMA Filter 232 | bool volume_filter = true 233 | if i_volume_filter 234 | volume_filter := volume > ta.sma(volume, i_vol_sma_length) 235 | 236 | // Continuous Signals Filter 237 | average_volume = ta.sma(volume, i_rel_vol_avg_vol_len) 238 | relative_volume = volume / average_volume[1] 239 | rel_vol_sma_multiplier = ta.sma(relative_volume, i_rel_vol_avg_vol_len) * i_rel_vol_avg_vol_multi 240 | 241 | bool rel_vol_filter = true 242 | if i_rel_vol_filter 243 | rel_vol_filter := relative_volume > rel_vol_sma_multiplier 244 | 245 | // Time Filter 246 | bool time_filter = true 247 | if i_time_filter 248 | time_filter := (hour > i_hour_1 or (hour == i_hour_1 and minute >= i_minute_1)) and (hour < i_hour_2 or (hour == i_hour_2 and minute < i_minute_2)) 249 | 250 | //_____________________________ Additional Filters End 251 | 252 | //_____________________________ Signals Start 253 | 254 | // Condition 1 255 | short_cont = ta.crossunder(close, supertrend) and barstate.isconfirmed 256 | long_cont = ta.crossover(close, supertrend) and barstate.isconfirmed 257 | 258 | // Get Volatility Range After Cross 259 | var top_price = float(na) 260 | var bottom_price = float(na) 261 | 262 | if (short_cont) 263 | bottom_price := close - range_source 264 | top_price := na // Reset top_price to avoid plotting it 265 | 266 | if (long_cont) 267 | top_price := close + range_source 268 | bottom_price := na // Reset bottom_price to avoid plotting it 269 | 270 | // Condition 2 271 | short_break_cond = 272 | close < bottom_price and 273 | open > close and 274 | atr > atr_sma and 275 | pchg_below_filter and 276 | vol_pchg_filter and 277 | atr_filter and 278 | body_filter and 279 | body_size_filter and 280 | volume_filter and 281 | rel_vol_filter and 282 | time_filter and 283 | barstate.isconfirmed 284 | 285 | long_break_cond = 286 | close > top_price and 287 | open < close and 288 | atr > atr_sma and 289 | pchg_above_filter and 290 | vol_pchg_filter and 291 | atr_filter and 292 | body_filter and 293 | body_size_filter and 294 | volume_filter and 295 | rel_vol_filter and 296 | time_filter and 297 | barstate.isconfirmed 298 | 299 | // Short Signal 300 | var short_current_state = 0 301 | bear_previous_state = nz(short_current_state[1]) 302 | short_current_state := bear_previous_state == 2 ? 0 : bear_previous_state 303 | if short_cont and short_current_state == 0 304 | short_current_state := 1 305 | if short_break_cond and short_current_state == 1 306 | short_current_state := 2 307 | 308 | bool short_break_trigger = short_current_state == 2 ? true : false 309 | 310 | // Long Signal 311 | var long_current_state = 0 312 | bull_previous_state = nz(long_current_state[1]) 313 | long_current_state := bull_previous_state == 2 ? 0 : bull_previous_state 314 | if long_cont and long_current_state == 0 315 | long_current_state := 1 316 | if long_break_cond and long_current_state == 1 317 | long_current_state := 2 318 | 319 | bool long_break_trigger = long_current_state == 2 ? true : false 320 | 321 | // Plot Supertrend Cross Bar 322 | barcolor(color=short_cont ? i_neg_light_color : long_cont ? i_pos_light_color : na, title='Supertrend Cross Candle') 323 | 324 | // Plot Break Signal 325 | plotshape(series=long_break_trigger ? 3 : na, title='Long Signal', style=shape.triangleup, location=location.belowbar, color=i_pos_light_color, size=size.tiny, force_overlay=true) 326 | plotshape(series=short_break_trigger ? 3 : na, title='Short Signal', style=shape.triangledown, location=location.abovebar, color=i_neg_light_color, size=size.tiny, force_overlay=true) 327 | barcolor(color=short_break_trigger ? i_neg_light_color : long_break_trigger ? i_pos_light_color : na, title='Signal Candle') 328 | 329 | // Plot Historical Range 330 | plot(series=i_atr_range_display and i_atr_range_display and top_price == top_price[1] ? top_price : na, title='Top Range', color=i_pos_color, linewidth=1, style=plot.style_steplinebr, offset=-1, force_overlay=true) 331 | plot(series=i_atr_range_display and i_atr_range_display and bottom_price == bottom_price[1] ? bottom_price : na, title='Bottom Range', color=i_neg_color, linewidth=1, style=plot.style_steplinebr, offset=-1, force_overlay=true) 332 | 333 | //_____________________________ Signals End 334 | 335 | //_____________________________ Data Table Start 336 | 337 | // To String 338 | day_pchg_str = str.tostring(cum_pchg,"#.##") + ' %' 339 | volume_pchg_str = str.tostring(cum_vol_pchg,"#.##") + ' %' 340 | day_volume_str = str.tostring(current_cum_vol/100000,"#.##") + ' L' 341 | prev_day_volume_str = str.tostring(prev_cum_vol/100000,"#.##") + ' L' 342 | 343 | // Color 344 | bgcolor_1 = i_neu_dark_color 345 | bgcolor_2 = i_neu_mid_color 346 | 347 | pchg_col = cum_pchg > 0 ? i_pos_color : i_neg_color 348 | vol_pchg_col = cum_vol_pchg > 0 ? i_pos_color : i_neg_color 349 | prev_vol_pchg_col = prev_cum_vol < current_cum_vol ? i_neg_color : i_pos_color 350 | 351 | // Plot Table 352 | var table tbl_data = table.new(position=i_tbl_data_pos, columns=2, rows=4, border_width=1, force_overlay=true) 353 | 354 | if barstate.islast and i_tbl_data_show 355 | table.cell(table_id=tbl_data, column=0, row=0, text="%Chg", text_color=i_neu_color, text_halign=text.align_left, bgcolor=bgcolor_1, text_size=i_tbl_data_txt_size) 356 | table.cell(table_id=tbl_data, column=1, row=0, text=day_pchg_str, text_color=pchg_col, text_halign=text.align_right, bgcolor=bgcolor_1, text_size=i_tbl_data_txt_size) 357 | 358 | table.cell(table_id=tbl_data, column=0, row=1, text="Vol %Chg", text_color=i_neu_color, text_halign=text.align_left, bgcolor=bgcolor_2, text_size=i_tbl_data_txt_size) 359 | table.cell(table_id=tbl_data, column=1, row=1, text=volume_pchg_str, text_color=vol_pchg_col, text_halign=text.align_right, bgcolor=bgcolor_2, text_size=i_tbl_data_txt_size) 360 | 361 | table.cell(table_id=tbl_data, column=0, row=2, text="Vol", text_color=i_neu_color, text_halign=text.align_left, bgcolor=bgcolor_1, text_size=i_tbl_data_txt_size) 362 | table.cell(table_id=tbl_data, column=1, row=2, text=day_volume_str, text_color=vol_pchg_col, text_halign=text.align_right, bgcolor=bgcolor_1, text_size=i_tbl_data_txt_size) 363 | 364 | table.cell(table_id=tbl_data, column=0, row=3, text="PD Vol", text_color=i_neu_color, text_halign=text.align_left, bgcolor=bgcolor_2, text_size=i_tbl_data_txt_size) 365 | table.cell(table_id=tbl_data, column=1, row=3, text=prev_day_volume_str, text_color=prev_vol_pchg_col, text_halign=text.align_right, bgcolor=bgcolor_2, text_size=i_tbl_data_txt_size) 366 | 367 | //_____________________________ Data Table End 368 | 369 | //_____________________________ Code End 370 | 371 | // Readme First: 372 | // 373 | // Trend Following Setup - Sideways Market Skipper Scanner 374 | // 375 | // Long Signal Logic: 376 | // - Close crosses above the Supertrend. 377 | // - Add ATR value (with multiplier) to the close to identify the potential sideways or volatility range. 378 | // - When the price crosses this range, it's considered a breakout. 379 | // - The ATR should be rising or the volatility is increasing. 380 | // 381 | // Short Signal Logic: 382 | // - Close crosses below the Supertrend. 383 | // - Substract ATR value (with multiplier) to the close to identify the potential sideways or volatility range. 384 | // - When the price crosses this range, it's considered a breakdown. 385 | // - The ATR should be rising or the volatility is increasing. 386 | // 387 | // Entry: Enter after the retracement once the signal is generated. 388 | -------------------------------------------------------------------------------- /Trend Following Setup - Sideways Market Skipper Scanner/Readme First.txt: -------------------------------------------------------------------------------- 1 | // Readme First: 2 | // 3 | // Trend Following Setup - Sideways Market Skipper Scanner 4 | // 5 | // Long Signal Logic: 6 | // - Close crosses above the Supertrend. 7 | // - Add ATR value (with multiplier) to the close to identify the potential sideways or volatility range. 8 | // - When the price crosses this range, it's considered a breakout. 9 | // - The ATR should be rising or the volatility is increasing. 10 | // 11 | // Short Signal Logic: 12 | // - Close crosses below the Supertrend. 13 | // - Substract ATR value (with multiplier) to the close to identify the potential sideways or volatility range. 14 | // - When the price crosses this range, it's considered a breakdown. 15 | // - The ATR should be rising or the volatility is increasing. 16 | // 17 | // Entry: Enter after the retracement once the signal is generated. -------------------------------------------------------------------------------- /Trend Following Setup - Sideways Market Skipper Scanner/Screenshot - Trend Following Setup - Sideways Market Skipper Scanner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArunKBhaskar/PineScript/c6821225c466494b01eee08f9dd88bf84d2b24ba/Trend Following Setup - Sideways Market Skipper Scanner/Screenshot - Trend Following Setup - Sideways Market Skipper Scanner.png -------------------------------------------------------------------------------- /[Screener] Market Profile with Screener (Based on [RS]Market Profile by RicardoSantos).txt: -------------------------------------------------------------------------------- 1 | // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ 2 | // © Arun_K_Bhaskar 3 | 4 | // Acknowledgement & Reference 5 | // Trader: 'RicardoSantos' 6 | // Indicator Title: '[RS]Market Profile' 7 | // Indicator Link: 'https://www.tradingview.com/script/uoysXxWM-RS-Market-Profile/' 8 | 9 | //@version=5 10 | indicator(title='Market Profile with Screener (Based on [RS]Market Profile by RicardoSantos)', shorttitle='Market Profile Screener', overlay=true, max_lines_count=300, max_boxes_count=300) 11 | 12 | //_____________________________ Market Profile Start 13 | 14 | // ||-- Inputs: 15 | g_mp='Market Profile' 16 | string i_session_timeframe = input.string(defval='5D', title='Timeframe', group=g_mp) 17 | float i_percent_of_tpo = input.float(defval=0.7, title='TPO %', group=g_mp) 18 | int i_sessions = input.int(defval=1, title='Show Last', minval=0, maxval=40, group=g_mp) 19 | color i_poc_col = input.color(defval=#EA738D, title='Point of Control', group=g_mp) 20 | color i_va_col = input.color(defval=#89ABE3, title='Value Area', group=g_mp) 21 | color i_open_col = input.color(defval=color.silver, title='Open', group=g_mp) 22 | int i_mp_transp = input.int(defval=100, title='Transparency', minval=0, maxval=100, group=g_mp) 23 | 24 | // ||-- Extra Functions: 25 | f_line_stack(_array, _max_elements, _new_element) => 26 | int _size = array.size(_array) 27 | if _size >= _max_elements 28 | line.delete(array.pop(_array)) 29 | array.unshift(_array, _new_element) 30 | f_open_session_line(_x1, _y1, _x2, _y2) => 31 | line.new(_x1, _y1, _x2, _y2, xloc=xloc.bar_time, color=i_open_col, style=line.style_dashed) 32 | 33 | f_box_stack(_array, _max_elements, _new_element) => 34 | int _size = array.size(_array) 35 | if _size >= _max_elements 36 | box.delete(array.pop(_array)) 37 | array.unshift(_array, _new_element) 38 | 39 | f_poc_box(_x1, _y1, _x2, _y2) => 40 | box.new(_x1, _y1, _x2, _y2, border_color=i_poc_col, xloc=xloc.bar_time, bgcolor=color.new(i_poc_col, i_mp_transp)) 41 | f_vah_box(_x1, _y1, _x2, _y2) => 42 | box.new(_x1, _y1, _x2, _y2, border_color=i_va_col, xloc=xloc.bar_time, bgcolor=color.new(i_va_col, i_mp_transp)) 43 | 44 | var line[] open_session_lines = array.new_line(0) 45 | var box[] poc_boxes = array.new_box(0) 46 | var box[] vah_boxes = array.new_box(0) 47 | 48 | float tf_high = high 49 | float tf_low = low 50 | float tf_close = close 51 | 52 | // ||-- Bars since session started: 53 | isnewsession = ta.change(time(i_session_timeframe)) != 0 54 | 55 | var int session_bar_counter = 0 56 | var int previous_session_start = na 57 | var int previous_session_end = na 58 | var int session_time_range = na 59 | 60 | if isnewsession 61 | session_bar_counter := 0 62 | previous_session_start := previous_session_end 63 | previous_session_end := time 64 | session_time_range := previous_session_end - previous_session_start 65 | session_time_range 66 | else 67 | session_bar_counter += 1 68 | session_bar_counter 69 | 70 | // ||-- session high, low, range: 71 | var float session_high = tf_high 72 | var float session_low = tf_low 73 | var float session_range = tf_high - tf_low 74 | 75 | // ||-- recalculate session high, low and range: 76 | if session_bar_counter == 0 77 | session_high := tf_high 78 | session_low := tf_low 79 | session_range := tf_high - tf_low 80 | session_range 81 | if tf_high > session_high[1] 82 | session_high := tf_high 83 | session_range := session_high - session_low 84 | session_range 85 | if tf_low < session_low[1] 86 | session_low := tf_low 87 | session_range := session_high - session_low 88 | session_range 89 | 90 | // ||-- define tpo section range: 91 | tpo_section_range = session_range / 20 92 | 93 | // ||-- function to get the frequency a specified range is visited: 94 | f_frequency_of_range(_src, _upper_range, _lower_range, _length) => 95 | _adjusted_length = _length < 1 ? 1 : _length 96 | _frequency = 0 97 | for _i = 0 to _adjusted_length - 1 by 1 98 | if _src[_i] >= _lower_range and _src[_i] < _upper_range 99 | _frequency += 1 100 | _frequency 101 | _return = nz(_frequency, 0) // _adjusted_length 102 | _return 103 | 104 | // ||-- frequency the tpo range is visited: 105 | tpo_00 = f_frequency_of_range(tf_close, session_high, session_high - tpo_section_range * 1, session_bar_counter) 106 | tpo_01 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 1, session_high - tpo_section_range * 2, session_bar_counter) 107 | tpo_02 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 2, session_high - tpo_section_range * 3, session_bar_counter) 108 | tpo_03 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 3, session_high - tpo_section_range * 4, session_bar_counter) 109 | tpo_04 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 4, session_high - tpo_section_range * 5, session_bar_counter) 110 | tpo_05 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 5, session_high - tpo_section_range * 6, session_bar_counter) 111 | tpo_06 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 6, session_high - tpo_section_range * 7, session_bar_counter) 112 | tpo_07 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 7, session_high - tpo_section_range * 8, session_bar_counter) 113 | tpo_08 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 8, session_high - tpo_section_range * 9, session_bar_counter) 114 | tpo_09 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 9, session_high - tpo_section_range * 10, session_bar_counter) 115 | tpo_10 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 10, session_high - tpo_section_range * 11, session_bar_counter) 116 | tpo_11 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 11, session_high - tpo_section_range * 12, session_bar_counter) 117 | tpo_12 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 12, session_high - tpo_section_range * 13, session_bar_counter) 118 | tpo_13 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 13, session_high - tpo_section_range * 14, session_bar_counter) 119 | tpo_14 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 14, session_high - tpo_section_range * 15, session_bar_counter) 120 | tpo_15 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 15, session_high - tpo_section_range * 16, session_bar_counter) 121 | tpo_16 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 16, session_high - tpo_section_range * 17, session_bar_counter) 122 | tpo_17 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 17, session_high - tpo_section_range * 18, session_bar_counter) 123 | tpo_18 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 18, session_high - tpo_section_range * 19, session_bar_counter) 124 | tpo_19 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 19, session_high - tpo_section_range * 20, session_bar_counter) 125 | tpo_20 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 20, session_high - tpo_section_range * 21, session_bar_counter) 126 | 127 | // ||-- function to retrieve a specific tpo value 128 | f_get_tpo_count(_value) => 129 | _return = switch (_value) 130 | 0 => tpo_00 131 | 1 => tpo_01 132 | 2 => tpo_02 133 | 3 => tpo_03 134 | 4 => tpo_04 135 | 5 => tpo_05 136 | 6 => tpo_06 137 | 7 => tpo_07 138 | 8 => tpo_08 139 | 9 => tpo_09 140 | 10 => tpo_10 141 | 11 => tpo_11 142 | 12 => tpo_12 143 | 13 => tpo_13 144 | 14 => tpo_14 145 | 15 => tpo_15 146 | 16 => tpo_16 147 | 17 => tpo_17 148 | 18 => tpo_18 149 | 19 => tpo_19 150 | 20 => tpo_20 151 | => 0.0 152 | 153 | tpo_sum = 0.0 154 | current_poc_position = 0.0 155 | current_poc_value = 0.0 156 | 157 | for _i = 0 to 20 by 1 158 | _get_tpo_value = f_get_tpo_count(_i) 159 | tpo_sum += _get_tpo_value 160 | if _get_tpo_value >= current_poc_value 161 | current_poc_position := _i 162 | current_poc_value := _get_tpo_value 163 | current_poc_value 164 | 165 | poc_upper = session_high - tpo_section_range * current_poc_position 166 | poc_lower = session_high - tpo_section_range * (current_poc_position + 1) 167 | 168 | // ||-- get value area high/low 169 | vah_position = current_poc_position 170 | val_position = current_poc_position 171 | current_sum = current_poc_value 172 | 173 | for _i = 0 to 20 by 1 174 | if current_sum < tpo_sum * i_percent_of_tpo 175 | vah_position := math.max(0, vah_position - 1) 176 | current_sum += f_get_tpo_count(math.round(vah_position)) 177 | current_sum 178 | if current_sum < tpo_sum * i_percent_of_tpo 179 | val_position := math.min(20, val_position + 1) 180 | current_sum += f_get_tpo_count(math.round(val_position)) 181 | current_sum 182 | 183 | vah_value = session_high - tpo_section_range * vah_position 184 | val_value = session_high - tpo_section_range * (val_position + 1) 185 | 186 | if isnewsession 187 | f_box_stack(vah_boxes, i_sessions, f_vah_box(previous_session_end, vah_value[1], time_close(i_session_timeframe), val_value[1])) 188 | f_box_stack(poc_boxes, i_sessions, f_poc_box(previous_session_end, poc_upper[1], time_close(i_session_timeframe), poc_lower[1])) 189 | f_line_stack(open_session_lines, i_sessions, f_open_session_line(previous_session_end, open, time_close(i_session_timeframe), open)) 190 | 191 | // Function to get the pivot value 192 | vahl_pivot_value(src) => 193 | ta.valuewhen(session_bar_counter == 0, src[1], 0) 194 | 195 | // Get VAH and VAL pivots 196 | vah_pivot = vahl_pivot_value(vah_value) 197 | val_pivot = vahl_pivot_value(val_value) 198 | poc_pivot = vahl_pivot_value(math.avg(poc_upper, poc_lower)) 199 | 200 | // Calculate percentage between VAH and VAL 201 | va_percent = ((vah_pivot - val_pivot) / val_pivot) * 100 202 | poc_percent = ((close - poc_pivot) / poc_pivot) * 100 203 | //_____________________________ Market Profile End 204 | 205 | 206 | //_____________________________ Screener Start 207 | 208 | // Note: 209 | // - TradingView allows up to 40 requests per indicator, so keep the number of symbols below 40. 210 | // - Too many requests and complex calculations may slow down the indicator. 211 | // - You can combine multiple indicators in one script, like Close crossing above EMA 20, RSI crossing 60, etc. 212 | 213 | //_____________________________ Menu Screener Table Start 214 | 215 | g_tb = 'Screener : Table' 216 | tt_is = //"• Input exactly 40 symbols, nothing more or less." + 217 | "• Total characters cannot exceed 4096." + 218 | "\n• Use comma as delimiter without any space." + 219 | "\n• Eg: 'EXCHANGE:SYMBOL_A,EXCHANGE:SYMBOL_B'" 220 | 221 | string i_symbols = input.text_area( 222 | defval='NSE:ADANIPOWER,NSE:ARVIND,NSE:ASHOKA,NSE:BANKINDIA,NSE:BLS,NSE:BOMDYEING,NSE:CUB,NSE:DBL,NSE:DELTACORP,NSE:ENGINERSIN,NSE:GIPCL,NSE:GMDCLTD,NSE:GPPL,NSE:HINDCOPPER,NSE:INDIACEM,NSE:INOXWIND,NSE:IPL,NSE:IRCON,NSE:ITI,NSE:JAMNAAUTO,NSE:JKTYRE,NSE:KESORAMIND,NSE:LEMONTREE,NSE:MOIL,NSE:MRPL,NSE:NLCINDIA,NSE:ONMOBILE,NSE:PFC,NSE:PPLPHARMA,NSE:PTC,NSE:RAILTEL,NSE:RCF,NSE:RVNL,NSE:SHRIRAMPPS,NSE:TI,NSE:WELCORP,NSE:L_TFH,NSE:WOCKPHARMA,NSE:ZOMATO', 223 | title="Paste Symbols", tooltip=tt_is, group=g_tb) 224 | 225 | float i_va_above = input.float(defval=0, title='VA % Between', minval=0, maxval=100, inline='1', group=g_tb) 226 | float i_va_below = input.float(defval=3, title='', minval=0, maxval=100, inline='1', group=g_tb) 227 | 228 | float i_ltp_above = input.float(defval=-10, title='LTP % Between', inline='2', group=g_tb) 229 | float i_ltp_below = input.float(defval=10, title='', inline='2', group=g_tb) 230 | 231 | 232 | int i_tbl_disp_rows = input.int(defval=15, title='Display Rows', minval=0, maxval=100, group=g_tb) 233 | string i_tbl_position = input.string(defval=position.bottom_left, title='Position', options=[position.top_left, position.top_center, position.top_right, position.middle_left, position.middle_center, position.middle_right, position.bottom_left, position.bottom_center, position.bottom_right], group=g_tb) 234 | string i_tbl_text_size = input.string(defval=size.small, title='Size', options=[size.auto, size.tiny, size.small, size.normal, size.large, size.huge], group=g_tb) 235 | 236 | color i_tbl_neu_col = input.color(defval=#B2B5BE, title='Color', group=g_tb) 237 | 238 | //_____________________________ Menu Screener Table End 239 | 240 | //_______________________ Get Symbols Start 241 | 242 | // Acknowledgement & Reference 243 | // Trader: 'allanster' 244 | // Indicator Title: 'How To Input CSV List Of Symbol Data Used For Screener' 245 | // Indicator Link: 'https://www.tradingview.com/script/KfqHqHUH-How-To-Input-CSV-List-Of-Symbol-Data-Used-For-Screener/' 246 | 247 | feed(back) => // extract tickerid and decrement list of ticker IDs 248 | loop = back // declare string variable to hold content list 249 | getT = string(na) // declare string variable to hold tickerid 250 | if str.length(loop) == 0 // if list is empty 251 | getT := string(na) // assign na to tickerid variable 252 | loop := string(na) // assign na to list of ticker Ids variable 253 | else // else extract first tickerid 254 | getP = nz(str.pos(loop, ','), str.length(loop)) // get position of first comma or last character 255 | getT := str.substring(loop, 0, getP) // get tickerid in first position of list 256 | loop := str.replace(loop, getT + ',', '') // clear tickerid + delimiter character from list 257 | [getT, loop] // return tickerid in first position & truncated list 258 | 259 | [tid_001, out_001] = feed(i_symbols), [tid_002, out_002] = feed(out_001), [tid_003, out_003] = feed(out_002), [tid_004, out_004] = feed(out_003), 260 | [tid_005, out_005] = feed(out_004), [tid_006, out_006] = feed(out_005), [tid_007, out_007] = feed(out_006), [tid_008, out_008] = feed(out_007), 261 | [tid_009, out_009] = feed(out_008), [tid_010, out_010] = feed(out_009), [tid_011, out_011] = feed(out_010), [tid_012, out_012] = feed(out_011), 262 | [tid_013, out_013] = feed(out_012), [tid_014, out_014] = feed(out_013), [tid_015, out_015] = feed(out_014), [tid_016, out_016] = feed(out_015), 263 | [tid_017, out_017] = feed(out_016), [tid_018, out_018] = feed(out_017), [tid_019, out_019] = feed(out_018), [tid_020, out_020] = feed(out_019), 264 | [tid_021, out_021] = feed(out_020), [tid_022, out_022] = feed(out_021), [tid_023, out_023] = feed(out_022), [tid_024, out_024] = feed(out_023), 265 | [tid_025, out_025] = feed(out_024), [tid_026, out_026] = feed(out_025), [tid_027, out_027] = feed(out_026), [tid_028, out_028] = feed(out_027), 266 | [tid_029, out_029] = feed(out_028), [tid_030, out_030] = feed(out_029), [tid_031, out_031] = feed(out_030), [tid_032, out_032] = feed(out_031), 267 | [tid_033, out_033] = feed(out_032), [tid_034, out_034] = feed(out_033), [tid_035, out_035] = feed(out_034), [tid_036, out_036] = feed(out_035), 268 | [tid_037, out_037] = feed(out_036), [tid_038, out_038] = feed(out_037), [tid_039, out_039] = feed(out_038), [tid_040, out_040] = feed(out_039) 269 | 270 | //_______________________ Get Symbols End 271 | 272 | // _____________________________ Screener Start 273 | 274 | // Acknowledgement & Reference 275 | // Trader: 'MUQWISHI' 276 | // Indicator Title: 'Candlestick Patterns Screener [By MUQWISHI]' 277 | // Indicator Link: 'https://www.tradingview.com/script/xiWQuGOq-Candlestick-Patterns-Screener-By-MUQWISHI/' 278 | 279 | // Function for Screener Indicator Calculation 280 | 281 | screener_condition = va_percent > i_va_above and va_percent <= i_va_below and poc_percent <= i_ltp_below and poc_percent >= i_ltp_above 282 | 283 | truncate(number, decimals) => 284 | factor = math.pow(10, decimals) 285 | int(number * factor) / factor 286 | 287 | indicator_calculation() => 288 | // Initialize variables 289 | percent = float(na) 290 | _time = int(na) 291 | pchg = float(na) 292 | 293 | if screener_condition 294 | percent := truncate(va_percent, 2) 295 | _time := time 296 | pchg := truncate(poc_percent, 2) 297 | 298 | [_time, percent, pchg] 299 | 300 | // Function to format time 301 | format_time(x) => 302 | timezone = syminfo.timezone 303 | timeframe.isintraday ? str.format_time(x, "HH:mm dd-MM-yyyy", timezone) : str.format_time(x, "dd-MM-yyyy", timezone) 304 | 305 | // Function to extract symbol name 306 | symbol(s) => 307 | array.get(str.split(s, ":"), 1) 308 | 309 | // Matrix setup 310 | var matrix = matrix.new(0, 4, na) 311 | 312 | // Function to add rows to the matrix 313 | mtxFun(symbol, _time, percent, pchg) => 314 | matrix.add_row(matrix, 0, array.from(symbol, _time, percent, pchg)) 315 | 316 | // Screener function to collect data 317 | screener(s) => 318 | sym = ticker.modify(s, syminfo.session) 319 | [_time, percent, pchg] = request.security(sym, timeframe.period, indicator_calculation()) 320 | 321 | // Check if the signal is not na and the time matches 322 | if _time == time 323 | mtxFun(symbol(s), format_time(_time), str.tostring(percent), str.tostring(pchg)) 324 | 325 | // Call Screener function for multiple symbols 326 | screener(tid_001), screener(tid_002), screener(tid_003), screener(tid_004), screener(tid_005), screener(tid_006), screener(tid_007), 327 | screener(tid_008), screener(tid_009), screener(tid_010), screener(tid_011), screener(tid_012), screener(tid_013), screener(tid_014), 328 | screener(tid_015), screener(tid_016), screener(tid_017), screener(tid_018), screener(tid_019), screener(tid_020), screener(tid_021), 329 | screener(tid_022), screener(tid_023), screener(tid_024), screener(tid_025), screener(tid_026), screener(tid_027), screener(tid_028), 330 | screener(tid_029), screener(tid_030), screener(tid_031), screener(tid_032), screener(tid_033), screener(tid_034), screener(tid_035), 331 | screener(tid_036), screener(tid_037), screener(tid_038), screener(tid_039), screener(tid_040) 332 | 333 | // Trim excess rows in the matrix 334 | if matrix.rows(matrix) > i_tbl_disp_rows 335 | while matrix.rows(matrix) > i_tbl_disp_rows 336 | matrix.remove_row(matrix, matrix.rows(matrix)-1) 337 | 338 | // Plot Table 339 | // Create table with specified properties 340 | var table tbl = table.new(position=i_tbl_position, columns=4, rows=102, border_width=1) 341 | 342 | tt_tbl = "Time: Signal generation time.\n" + 343 | "% VAHL: Percentage between VAH & VAL.\n" + 344 | "% LTP: Percentage change from POC mid to LTP." 345 | 346 | // Function to populate cells in the table 347 | cell(col, row, txt, color) => 348 | table.cell(tbl, col, row, text = txt, text_color = color, text_halign=text.align_left, bgcolor = color.new(color, 80), text_size=i_tbl_text_size, tooltip=tt_tbl) 349 | 350 | // Check if it's the last bar 351 | if barstate.islast 352 | // Clear existing data in the table 353 | table.clear(tbl, 0, 0, 3, 101) 354 | 355 | // Set headers for the table 356 | cell(0, 0, "Symbol", i_tbl_neu_col) 357 | cell(1, 0, "Time", i_tbl_neu_col) 358 | cell(2, 0, "% VAHL" , i_tbl_neu_col) 359 | cell(3, 0, "% LTP" , i_tbl_neu_col) 360 | 361 | j = 1 362 | // Populate table with matrix data 363 | if matrix.rows(matrix) > 0 364 | for i = 0 to matrix.rows(matrix) - 1 365 | // Populate cells in the table 366 | cell(0, j, matrix.get(matrix, i, 0), i_tbl_neu_col) 367 | cell(1, j, matrix.get(matrix, i, 1), i_tbl_neu_col) 368 | cell(2, j, matrix.get(matrix, i, 2), i_tbl_neu_col) 369 | cell(3, j, matrix.get(matrix, i, 3), i_tbl_neu_col) 370 | 371 | j += 1 372 | 373 | // _____________________________ Screener End 374 | // _____________________________ Code End 375 | -------------------------------------------------------------------------------- /[Screenshot] ICT Retracement to Order Block with Screener.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArunKBhaskar/PineScript/c6821225c466494b01eee08f9dd88bf84d2b24ba/[Screenshot] ICT Retracement to Order Block with Screener.jpg -------------------------------------------------------------------------------- /[Screenshot] Market Profile with Screener (Based on [RS]Market Profile by RicardoSantos).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArunKBhaskar/PineScript/c6821225c466494b01eee08f9dd88bf84d2b24ba/[Screenshot] Market Profile with Screener (Based on [RS]Market Profile by RicardoSantos).png --------------------------------------------------------------------------------