MirPapa_Library_ICT

GetHTFoffsetToLTFoffset(_offset, _chartTf, _htfTf)
GetHTFoffsetToLTFoffset
description Adjust an HTF offset to an LTF offset by calculating the ratio of timeframes.
Parameters:
_offset (int): int The HTF bar offset (0 means current HTF bar).
_chartTf (string): string The current chart’s timeframe (e.g., "5", "15", "1D").
_htfTf (string): string The High Time Frame string (e.g., "60", "1D").
return int The corresponding LTF bar index. Returns 0 if the result is negative.
IsConditionState(_type, _isBull, _level, _open, _close, _open1, _close1, _low1, _low2, _low3, _low4, _high1, _high2, _high3, _high4)
IsConditionState
description Evaluate a condition state based on type for COB, FVG, or FOB.
Overloaded: first signature handles COB, second handles FVG/FOB.
Parameters:
_type (string): string Condition type ("cob", "fvg", "fob").
_isBull (bool): bool Direction flag: true for bullish, false for bearish.
_level (int): int Swing level (only used for COB).
_open (float): float Current bar open price (only for COB).
_close (float): float Current bar close price (only for COB).
_open1 (float): float Previous bar open price (only for COB).
_close1 (float): float Previous bar close price (only for COB).
_low1 (float): float Low 1 bar ago (only for COB).
_low2 (float): float Low 2 bars ago (only for COB).
_low3 (float): float Low 3 bars ago (only for COB).
_low4 (float): float Low 4 bars ago (only for COB).
_high1 (float): float High 1 bar ago (only for COB).
_high2 (float): float High 2 bars ago (only for COB).
_high3 (float): float High 3 bars ago (only for COB).
_high4 (float): float High 4 bars ago (only for COB).
return bool True if the specified condition is met, false otherwise.
IsConditionState(_type, _isBull, _pricePrev, _priceNow)
IsConditionState
description Evaluate FVG or FOB condition based on price movement.
Parameters:
_type (string): string Condition type ("fvg", "fob").
_isBull (bool): bool Direction flag: true for bullish, false for bearish.
_pricePrev (float): float Previous price (for FVG/FOB).
_priceNow (float): float Current price (for FVG/FOB).
return bool True if the specified condition is met, false otherwise.
IsSwingHighLow(_isBull, _level, _open, _close, _open1, _close1, _low1, _low2, _low3, _low4, _high1, _high2, _high3, _high4)
IsSwingHighLow
description Public wrapper for isSwingHighLow.
Parameters:
_isBull (bool): bool Direction flag: true for bullish, false for bearish.
_level (int): int Swing level (1 or 2).
_open (float): float Current bar open price.
_close (float): float Current bar close price.
_open1 (float): float Previous bar open price.
_close1 (float): float Previous bar close price.
_low1 (float): float Low 1 bar ago.
_low2 (float): float Low 2 bars ago.
_low3 (float): float Low 3 bars ago.
_low4 (float): float Low 4 bars ago.
_high1 (float): float High 1 bar ago.
_high2 (float): float High 2 bars ago.
_high3 (float): float High 3 bars ago.
_high4 (float): float High 4 bars ago.
return bool True if swing condition is met, false otherwise.
AddBox(_left, _right, _top, _bot, _xloc, _colorBG, _colorBD)
AddBox
description Draw a rectangular box on the chart with specified coordinates and colors.
Parameters:
_left (int): int Left bar index for the box.
_right (int): int Right bar index for the box.
_top (float): float Top price coordinate for the box.
_bot (float): float Bottom price coordinate for the box.
_xloc (string): string X-axis location type (e.g., xloc.bar_index).
_colorBG (color): color Background color for the box.
_colorBD (color): color Border color for the box.
return box Returns the created box object.
Addline(_x, _y, _xloc, _color, _width)
Addline
description Draw a vertical or horizontal line at specified coordinates.
Parameters:
_x (int): int X-coordinate for start (bar index).
_y (int): float Y-coordinate for start (price).
_xloc (string): string X-axis location type (e.g., xloc.bar_index).
_color (color): color Line color.
_width (int): int Line width.
return line Returns the created line object.
Addline(_x, _y, _xloc, _color, _width)
Parameters:
_x (int)
_y (float)
_xloc (string)
_color (color)
_width (int)
Addline(_x1, _y1, _x2, _y2, _xloc, _color, _width)
Parameters:
_x1 (int)
_y1 (int)
_x2 (int)
_y2 (int)
_xloc (string)
_color (color)
_width (int)
Addline(_x1, _y1, _x2, _y2, _xloc, _color, _width)
Parameters:
_x1 (int)
_y1 (int)
_x2 (int)
_y2 (float)
_xloc (string)
_color (color)
_width (int)
Addline(_x1, _y1, _x2, _y2, _xloc, _color, _width)
Parameters:
_x1 (int)
_y1 (float)
_x2 (int)
_y2 (int)
_xloc (string)
_color (color)
_width (int)
Addline(_x1, _y1, _x2, _y2, _xloc, _color, _width)
Parameters:
_x1 (int)
_y1 (float)
_x2 (int)
_y2 (float)
_xloc (string)
_color (color)
_width (int)
AddlineMid(_type, _left, _right, _top, _bot, _xloc, _color, _width)
AddlineMid
description Draw a midline between top and bottom for FVG or FOB types.
Parameters:
_type (string): string Type identifier: "fvg" or "fob".
_left (int): int Left bar index for midline start.
_right (int): int Right bar index for midline end.
_top (float): float Top price of the region.
_bot (float): float Bottom price of the region.
_xloc (string): string X-axis location type (e.g., xloc.bar_index).
_color (color): color Line color.
_width (int): int Line width.
return line or na Returns the created line or na if type is not recognized.
GetHtfFromLabel(_label)
GetHtfFromLabel
description Convert a Korean HTF label into a Pine Script timeframe string via handler library.
Parameters:
_label (string): string The Korean label (e.g., "5분", "1시간").
return string Returns the corresponding Pine Script timeframe (e.g., "5", "60").
IsChartTFcomparisonHTF(_chartTf, _htfTf)
IsChartTFcomparisonHTF
description Determine whether a given HTF is greater than or equal to the current chart timeframe.
Parameters:
_chartTf (string): string Current chart timeframe (e.g., "5", "15", "1D").
_htfTf (string): string HTF timeframe (e.g., "60", "1D").
return bool True if HTF ≥ chartTF, false otherwise.
CreateBoxData(_type, _isBull, _useLine, _top, _bot, _xloc, _colorBG, _colorBD, _offset, _htfTf, htfBarIdx, _basePoint)
CreateBoxData
description Create and draw a box and optional midline for given type and parameters. Returns success flag and BoxData.
Parameters:
_type (string): string Type identifier: "fvg", "fob", "cob", or "sweep".
_isBull (bool): bool Direction flag: true for bullish, false for bearish.
_useLine (bool): bool Whether to draw a midline inside the box.
_top (float): float Top price of the box region.
_bot (float): float Bottom price of the box region.
_xloc (string): string X-axis location type (e.g., xloc.bar_index).
_colorBG (color): color Background color for the box.
_colorBD (color): color Border color for the box.
_offset (int): int HTF bar offset (0 means current HTF bar).
_htfTf (string): string HTF timeframe string (e.g., "60", "1D").
htfBarIdx (int): int HTF bar_index (passed from HTF request).
_basePoint (float): float Base point for breakout checks.
return tuple(bool, BoxData) Returns a boolean indicating success and the created BoxData struct.
ProcessBoxDatas(_datas, _useMidLine, _closeCount, _colorClose)
ProcessBoxDatas
description Process an array of BoxData structs: extend, record volume, update stage, and finalize boxes.
Parameters:
_datas (array<BoxData>): array<BoxData> Array of BoxData objects to process.
_useMidLine (bool): bool Whether to update the midline endpoint.
_closeCount (int): int Number of touches required to close the box.
_colorClose (color): color Color to apply when a box closes.
return void No return value; updates are in-place.
BoxData
Fields:
_isActive (series bool)
_isBull (series bool)
_box (series box)
_line (series line)
_basePoint (series float)
_boxTop (series float)
_boxBot (series float)
_stage (series int)
_isStay (series bool)
_volBuy (series float)
_volSell (series float)
_result (series string)
LineData
Fields:
_isActive (series bool)
_isBull (series bool)
_line (series line)
_basePoint (series float)
_stage (series int)
_isStay (series bool)
_result (series string)
더해짐
GetHTFrevised(_tf, _case)
GetHTFrevised
description
Retrieve a specific bar value from a Higher Time Frame (HTF) series.
Supports current and historical OHLC values, based on a case identifier.
Parameters:
_tf (string): The target HTF string (examples: "60", "1D").
_case (string): A case string determining which OHLC value and bar offset to request:
"b" → HTF bar_index
"o" → HTF open
"h" → HTF high
"l" → HTF low
"c" → HTF close
"o1" → HTF open one bar ago
"h1" → HTF high one bar ago
"l1" → HTF low one bar ago
"c1" → HTF close one bar ago
… up to "o5", "h5", "l5", "c5" for five bars ago.
return
Returns the requested HTF value or na if _case does not match any condition.
GetHTFrevised(_tf)
Parameters:
_tf (string)
업데이트됨
IsSwingHighLow(_isBull, _level, _open, _close, _open1, _close1, _low1, _low2, _low3, _low4, _high1, _high2, _high3, _high4, _upperBand1, _lowerBand1)
IsSwingHighLow
description Public wrapper for isSwingHighLow.
Parameters:
_isBull (bool): bool Direction flag: true for bullish, false for bearish.
_level (int): int Swing level (1 or 2).
_open (float): float Current bar open price.
_close (float): float Current bar close price.
_open1 (float): float Previous bar open price.
_close1 (float): float Previous bar close price.
_low1 (float): float Low 1 bar ago.
_low2 (float): float Low 2 bars ago.
_low3 (float): float Low 3 bars ago.
_low4 (float): float Low 4 bars ago.
_high1 (float): float High 1 bar ago.
_high2 (float): float High 2 bars ago.
_high3 (float): float High 3 bars ago.
_high4 (float): float High 4 bars ago.
return bool True if swing condition is met, false otherwise.
_upperBand1 (float)
_lowerBand1 (float)
더해짐
IsStateSwing(_isBull, _level, _low, _low1, _low2, _low3, _low4, _high, _high1, _high2, _high3, _high4)
IsSwingHighLow
description Public wrapper for isSwingHighLow.
Parameters:
_isBull (bool): bool Direction flag: true for bullish, false for bearish.
_level (int): int Swing level (1 or 2).
_low (float)
_low1 (float): float Low 1 bar ago.
_low2 (float): float Low 2 bars ago.
_low3 (float): float Low 3 bars ago.
_low4 (float): float Low 4 bars ago.
_high (float)
_high1 (float): float High 1 bar ago.
_high2 (float): float High 2 bars ago.
_high3 (float): float High 3 bars ago.
_high4 (float): float High 4 bars ago.
return bool True if swing condition is met, false otherwise.
없어짐
IsSwingHighLow(_isBull, _level, _open, _close, _open1, _close1, _low1, _low2, _low3, _low4, _high1, _high2, _high3, _high4, _upperBand1, _lowerBand1)
IsSwingHighLow
description Public wrapper for isSwingHighLow.
Libreria Pine
In pieno spirito TradingView, l'autore ha pubblicato questo codice Pine come libreria open-source in modo che altri programmatori Pine della nostra comunità possano riutilizzarlo. Complimenti all'autore! È possibile utilizzare questa libreria privatamente o in altre pubblicazioni open-source, ma il riutilizzo di questo codice in una pubblicazione è regolato dal nostro Regolamento.
Declinazione di responsabilità
Libreria Pine
In pieno spirito TradingView, l'autore ha pubblicato questo codice Pine come libreria open-source in modo che altri programmatori Pine della nostra comunità possano riutilizzarlo. Complimenti all'autore! È possibile utilizzare questa libreria privatamente o in altre pubblicazioni open-source, ma il riutilizzo di questo codice in una pubblicazione è regolato dal nostro Regolamento.