"NK-Box"의 옵션으로 사용하는 지표입니다. "NK-Box"와 완전히 동일한 범위에 선을 그릴 수 있습니다.
NK-Box에서는 중간선과의 비교였지만, 이 지표에서는 중간선 이외의 계산된 선들 사이에 배경을 설정할 수 있습니다.
또한, 이전 기간과의 갭을 배경으로 표시할 수도 있습니다.
⇩ 위가 "Hist", 아래가 "Current"
NK-Box에서는 중간선과의 비교였지만, 이 지표에서는 중간선 이외의 계산된 선들 사이에 배경을 설정할 수 있습니다.
또한, 이전 기간과의 갭을 배경으로 표시할 수도 있습니다.
출처: TradingView
⇩ 위가 "Hist", 아래가 "Current"
[NOTICE & LICENSE]
・학습 및 정보 제공만을 목적으로 하며, 투자 조언이 아닙니다. 툴 사용으로 인해 발생한 경제적 손실에 대해 일절 책임을 지지 않습니다.
・Pine Script v6에서 동작을 확인했습니다. 향후 TradingView의 사양 변경에 따른 업데이트를 보장하지 않으며, 개별적인 설치 지원이나 수정 요청은 일절 받지 않습니다 (있는 그대로(As-is) 제공).
・MIT 라이선스가 적용됩니다.
// SPDX-FileCopyrightText: 2026 NK-report https://www.nk-report.com/
// SPDX-License-Identifier: MIT
//
// Disclaimer: This script is for educational purposes only and does not constitute investment advice.
//@version=6
// ※Gapをボックスで描画するため、max_boxes_count=500 を追加しています
indicator("NK-box_option1_Zone & Gap (History)", shorttitle="NK-opt1 Z&G (Hist)", overlay=true, max_boxes_count=500, max_lines_count=500)
// ==============================================================================
// 【01】 免責・ライセンス
// ==============================================================================
//
// 지표를 무료로 공개하고 있습니다: https://www.nk-report.com/p/kr-tradingview.html
//
// 면책 조항: 본 스크립트는 학습 및 정보 제공만을 목적으로 하며, 투자 조언이 아닙니다.
//
// 1. 본 코드는 2026년 기준 Pine Script v6에서 동작 확인을 마쳤습니다.
// 향후 사양 변경으로 인한 오류 등에 대해 개별적인 지원이나 수정은 제공하지 않습니다.
// 2. 본 스크립트는 일반적인 계산 로직을 바탕으로 LLM을 활용하여 독자적으로 작성된 것입니다.
// MIT 라이선스를 따릅니다.
// ------------------------------------------------------------------------------
// MIT License
//
// Copyright 2026 NK-report https://www.nk-report.com/
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
// ==============================================================================
// 【02】 UI設定と言語
// ==============================================================================
// 1. 言語辞書の定義(テキストの定数化)
// ※外国語版を作成する際は、このブロックの「右辺のテキスト」のみを翻訳してください
const string GRP_GENERAL = "▼ 기본 설정"
const string GRP_OFFSET = "▼ 그리기 위치 미세 조정 (오프셋)"
const string GRP_OPTION = "▼ 사용자 지정 영역 설정"
const string LBL_TF = "기준 기간"
const string TT_TF = "※ NK-box 본체와 동일한 기준 기간을 지정해 주세요."
const string OPT_TF_D = "1일"
const string OPT_TF_W = "1주"
const string OPT_TF_1M = "1개월"
const string OPT_TF_3M = "3개월"
const string OPT_TF_12M = "12개월"
const string LBL_OFS_L = "좌측 오프셋 조정 (봉 개수)"
const string LBL_OFS_R = "우측 오프셋 조정 (봉 개수)"
const string TT_OFS = "음수는 좌측으로, 양수는 우측으로 이동합니다.\n※ NK-box 본체와 동일한 수치를 지정해 주세요."
const string LBL_LINE_A = "라인 A 기준"
const string LBL_LINE_B = "라인 B 기준"
const string LBL_SHOW = "선 표시"
const string LBL_ZONE = "배경 채우기 (영역)"
const string LBL_GAP = "갭 (Gap) 하이라이트"
// 分析ラインの選択肢
const string OPT_MID = "미드라인"
const string OPT_OPEN = "시가"
const string OPT_CLOSE = "종가"
const string OPT_WCL = "가중 종가 (WCL)"
const string OPT_PIVOT = "피봇 (Pivot)"
const string OPT_MEDIAN = "바디 중간값 (Median)"
const string OPT_TWAP = "TWAP"
const string OPT_STY_S = "실선"
const string OPT_STY_D = "파선"
const string OPT_STY_DT = "점선"
// データウィンドウ用の表示名
const string LBL_DATA_A = "옵션 라인 A"
const string LBL_DATA_B = "옵션 라인 B"
// 2. UI(ユーザー入力画面)の構築
// ※言語辞書で定義した定数を呼び出してUIを構築します
i_tf_str = input.string(OPT_TF_1M, title=LBL_TF, options=[OPT_TF_D, OPT_TF_W, OPT_TF_1M, OPT_TF_3M, OPT_TF_12M], group=GRP_GENERAL, tooltip=TT_TF)
i_offset_left = input.int(-1, title=LBL_OFS_L, group=GRP_OFFSET, tooltip=TT_OFS)
i_offset_right = input.int(0, title=LBL_OFS_R, group=GRP_OFFSET, tooltip=TT_OFS)
// カスタムゾーン設定(ラインA)
i_type_a = input.string(OPT_TWAP, title=LBL_LINE_A, options=[OPT_MID, OPT_OPEN, OPT_CLOSE, OPT_WCL, OPT_PIVOT, OPT_MEDIAN, OPT_TWAP], group=GRP_OPTION)
i_show_a = input.bool(true, title=LBL_SHOW, group=GRP_OPTION, inline="linea")
i_col_a = input.color(color.orange, title="", group=GRP_OPTION, inline="linea")
i_wid_a = input.int(2, title="", minval=1, maxval=5, group=GRP_OPTION, inline="linea")
i_sty_a = input.string(OPT_STY_S, title="", options=[OPT_STY_S, OPT_STY_D, OPT_STY_DT], group=GRP_OPTION, inline="linea")
// カスタムゾーン設定(ラインB)
i_type_b = input.string(OPT_PIVOT, title=LBL_LINE_B, options=[OPT_MID, OPT_OPEN, OPT_CLOSE, OPT_WCL, OPT_PIVOT, OPT_MEDIAN, OPT_TWAP], group=GRP_OPTION)
i_show_b = input.bool(true, title=LBL_SHOW, group=GRP_OPTION, inline="lineb")
i_col_b = input.color(color.blue, title="", group=GRP_OPTION, inline="lineb")
i_wid_b = input.int(2, title="", minval=1, maxval=5, group=GRP_OPTION, inline="lineb")
i_sty_b = input.string(OPT_STY_S, title="", options=[OPT_STY_S, OPT_STY_D, OPT_STY_DT], group=GRP_OPTION, inline="lineb")
// ゾーン塗りつぶし設定
i_show_zone = input.bool(true, title=LBL_ZONE, group=GRP_OPTION, inline="zone")
i_col_zone = input.color(color.new(color.gray, 85), title="", group=GRP_OPTION, inline="zone")
// Gap (窓) 設定
i_show_gap = input.bool(true, title=LBL_GAP, group=GRP_OPTION, inline="gap")
i_col_gap_u = input.color(color.new(color.teal, 80), title="상승 갭", group=GRP_OPTION, inline="gap")
i_col_gap_d = input.color(color.new(color.red, 80), title="하락 갭", group=GRP_OPTION, inline="gap")
// ==============================================================================
// 【03】 全コード共通仕様(時間・インフラ処理)
// ==============================================================================
// UIで選択された定数をPine内部のシステム識別子に変換
string req_tf = switch i_tf_str
OPT_TF_D => "1D"
OPT_TF_W => "1W"
OPT_TF_1M => "1M"
OPT_TF_3M => "3M"
OPT_TF_12M => "12M"
// ==============================================================================
// 【04】 各カテゴリ共通仕様 (描画インフラと判定ロジック)
// ==============================================================================
bool is_new_period = timeframe.change(req_tf) or barstate.isfirst
f_get_style(sty_str) =>
sty_str == OPT_STY_S ? line.style_solid : sty_str == OPT_STY_D ? line.style_dashed : line.style_dotted
// プルダウンの選択肢に応じて純粋な数値を計算する専用関数
f_get_val(type_str, _o, _h, _l, _c) =>
float v = switch type_str
OPT_MID => (_h + _l) / 2.0
OPT_OPEN => _o
OPT_CLOSE => _c
OPT_WCL => (_h + _l + _c * 2.0) / 4.0
OPT_PIVOT => (_h + _l + _c) / 3.0
OPT_MEDIAN => (_o + _c) / 2.0
OPT_TWAP => (_o + _h + _l + _c) / 4.0
=> na
v
// ==============================================================================
// 【05】 このコード固有の計算仕様 (Specific Indicator Logic)
// ==============================================================================
var float curr_o = na
var float curr_h = na
var float curr_l = na
var float prev_o = na
var float prev_h = na
var float prev_l = na
var float prev_c = na
var int start_bar = na
// --- 描画エンジンへ引き渡すためのスナップショット変数(MVC分離用) ---
bool do_draw = false
int draw_start = na
int draw_end = na
float draw_o = na
float draw_h = na
float draw_l = na
float draw_c = na
float draw_gap_c = na
float draw_gap_o = na
if is_new_period
// ① 描画キューの生成:計算用の変数が新しい期間のもので上書きされる前に、描画用の確定値を退避させます。
if not na(prev_o) and not na(start_bar)
do_draw := true
draw_start := math.max(0, start_bar + i_offset_left)
draw_end := math.max(0, bar_index[1] + i_offset_right)
draw_o := prev_o
draw_h := prev_h
draw_l := prev_l
draw_c := prev_c
draw_gap_c := prev_c
draw_gap_o := curr_o
// ② 次の期間へのバケツリレー
prev_o := curr_o
prev_h := curr_h
prev_l := curr_l
prev_c := close[1]
curr_o := open
curr_h := high
curr_l := low
start_bar := bar_index
else
curr_h := math.max(curr_h, high)
curr_l := math.min(curr_l, low)
// ==============================================================================
// 【06】 描画と出力 (Rendering & Outputs)
// ==============================================================================
// 1. チャートへの視覚的出力(スタンプ描画)
if do_draw
// 【05】で退避したスナップショットを用いて、選択された2つの数値を計算します
float val_a = f_get_val(i_type_a, draw_o, draw_h, draw_l, draw_c)
float val_b = f_get_val(i_type_b, draw_o, draw_h, draw_l, draw_c)
// ラインの描画(線の表示がOFFでも、背景表示がONなら「見えない透明の線」を引いて背景のアンカーにします)
bool draw_line_a = i_show_a or i_show_zone
bool draw_line_b = i_show_b or i_show_zone
line l_a = draw_line_a ? line.new(draw_start, val_a, draw_end, val_a, color=i_show_a ? i_col_a : na, width=i_wid_a, style=f_get_style(i_sty_a)) : na
line l_b = draw_line_b ? line.new(draw_start, val_b, draw_end, val_b, color=i_show_b ? i_col_b : na, width=i_wid_b, style=f_get_style(i_sty_b)) : na
// 背景塗りつぶし
if i_show_zone and not na(l_a) and not na(l_b)
linefill.new(l_a, l_b, i_col_zone)
// Gap (窓) の描画
if i_show_gap and not na(draw_gap_c) and not na(draw_gap_o) and (draw_gap_c != draw_gap_o)
color gap_col = draw_gap_o > draw_gap_c ? i_col_gap_u : i_col_gap_d
float gap_top = math.max(draw_gap_c, draw_gap_o)
float gap_bot = math.min(draw_gap_c, draw_gap_o)
box.new(draw_start, gap_top, draw_end, gap_bot, border_color=na, bgcolor=gap_col)
// 2. データウィンドウへの出力
// 選択されたラインの値だけを出力し、本体のデータウィンドウを圧迫しないように設計しています
float out_a = f_get_val(i_type_a, prev_o, prev_h, prev_l, prev_c)
float out_b = f_get_val(i_type_b, prev_o, prev_h, prev_l, prev_c)
plot(out_a, title=LBL_DATA_A, color=i_col_a, display=display.data_window, editable=false)
plot(out_b, title=LBL_DATA_B, color=i_col_b, display=display.data_window, editable=false)
// SPDX-FileCopyrightText: 2026 NK-report https://www.nk-report.com/
// SPDX-License-Identifier: MIT
//
// Disclaimer: This script is for educational purposes only and does not constitute investment advice.
//@version=6
indicator("NK-box_option1_Zone & Gap (Current)", shorttitle="NK-opt1 Z&G (Curr)", overlay=true)
// ==============================================================================
// 【01】 免責・ライセンス
// ==============================================================================
//
// 지표를 무료로 공개하고 있습니다: https://www.nk-report.com/p/kr-tradingview.html
//
// 면책 조항: 본 스크립트는 학습 및 정보 제공만을 목적으로 하며, 투자 조언이 아닙니다.
//
// 1. 본 코드는 2026년 기준 Pine Script v6에서 동작 확인을 마쳤습니다.
// 향후 사양 변경으로 인한 오류 등에 대해 개별적인 지원이나 수정은 제공하지 않습니다.
// 2. 본 스크립트는 일반적인 계산 로직을 바탕으로 LLM을 활용하여 독자적으로 작성된 것입니다.
// MIT 라이선스를 따릅니다.
// ------------------------------------------------------------------------------
// MIT License
//
// Copyright 2026 NK-report https://www.nk-report.com/
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
// ==============================================================================
// 【02】 UI設定と言語
// ==============================================================================
// 1. 言語辞書の定義(テキストの定数化)
// ※外国語版を作成する際は、このブロックの「右辺のテキスト」のみを翻訳してください
const string GRP_GENERAL = "▼ 기본 설정"
const string GRP_OFFSET = "▼ 그리기 위치 미세 조정 (오프셋)"
const string GRP_OPTION = "▼ 사용자 지정 영역 설정"
const string LBL_TF = "기준 기간"
const string TT_TF = "※ NK-box 본체와 동일한 기준 기간을 지정해 주세요."
const string OPT_TF_D = "1일"
const string OPT_TF_W = "1주"
const string OPT_TF_1M = "1개월"
const string OPT_TF_3M = "3개월"
const string OPT_TF_12M = "12개월"
const string LBL_OFS_L = "좌측 오프셋 조정 (봉 개수 환산)"
const string LBL_OFS_R = "우측 오프셋 조정 (봉 개수 환산)"
const string TT_OFS = "음수는 좌측으로, 양수는 우측으로 이동합니다.\n※ Current 버전에서는 시간 계산(밀리초)을 통한 대략적인 이동입니다.\n※ NK-box 본체와 동일한 수치를 지정해 주세요."
const string LBL_LINE_A = "라인 A 기준"
const string LBL_LINE_B = "라인 B 기준"
const string LBL_SHOW = "선 표시"
const string LBL_ZONE = "배경 채우기 (영역)"
const string LBL_GAP = "갭 (Gap) 하이라이트"
// 分析ラインの選択肢
const string OPT_MID = "미드라인"
const string OPT_OPEN = "시가"
const string OPT_CLOSE = "종가"
const string OPT_WCL = "가중 종가 (WCL)"
const string OPT_PIVOT = "피봇 (Pivot)"
const string OPT_MEDIAN = "바디 중간값 (Median)"
const string OPT_TWAP = "TWAP"
const string OPT_STY_S = "실선"
const string OPT_STY_D = "파선"
const string OPT_STY_DT = "점선"
// データウィンドウ用の表示名
const string LBL_DATA_A = "옵션 라인 A"
const string LBL_DATA_B = "옵션 라인 B"
// 2. UI(ユーザー入力画面)の構築
// ※言語辞書で定義した定数を呼び出してUIを構築します
i_tf_str = input.string(OPT_TF_1M, title=LBL_TF, options=[OPT_TF_D, OPT_TF_W, OPT_TF_1M, OPT_TF_3M, OPT_TF_12M], group=GRP_GENERAL, tooltip=TT_TF)
i_offset_left = input.int(-1, title=LBL_OFS_L, group=GRP_OFFSET, tooltip=TT_OFS)
i_offset_right = input.int(0, title=LBL_OFS_R, group=GRP_OFFSET, tooltip=TT_OFS)
// カスタムゾーン設定(ラインA)
i_type_a = input.string(OPT_TWAP, title=LBL_LINE_A, options=[OPT_MID, OPT_OPEN, OPT_CLOSE, OPT_WCL, OPT_PIVOT, OPT_MEDIAN, OPT_TWAP], group=GRP_OPTION)
i_show_a = input.bool(true, title=LBL_SHOW, group=GRP_OPTION, inline="linea")
i_col_a = input.color(color.orange, title="", group=GRP_OPTION, inline="linea")
i_wid_a = input.int(2, title="", minval=1, maxval=5, group=GRP_OPTION, inline="linea")
i_sty_a = input.string(OPT_STY_S, title="", options=[OPT_STY_S, OPT_STY_D, OPT_STY_DT], group=GRP_OPTION, inline="linea")
// カスタムゾーン設定(ラインB)
i_type_b = input.string(OPT_PIVOT, title=LBL_LINE_B, options=[OPT_MID, OPT_OPEN, OPT_CLOSE, OPT_WCL, OPT_PIVOT, OPT_MEDIAN, OPT_TWAP], group=GRP_OPTION)
i_show_b = input.bool(true, title=LBL_SHOW, group=GRP_OPTION, inline="lineb")
i_col_b = input.color(color.blue, title="", group=GRP_OPTION, inline="lineb")
i_wid_b = input.int(2, title="", minval=1, maxval=5, group=GRP_OPTION, inline="lineb")
i_sty_b = input.string(OPT_STY_S, title="", options=[OPT_STY_S, OPT_STY_D, OPT_STY_DT], group=GRP_OPTION, inline="lineb")
// ゾーン塗りつぶし設定
i_show_zone = input.bool(true, title=LBL_ZONE, group=GRP_OPTION, inline="zone")
i_col_zone = input.color(color.new(color.gray, 85), title="", group=GRP_OPTION, inline="zone")
// Gap (窓) 設定
i_show_gap = input.bool(true, title=LBL_GAP, group=GRP_OPTION, inline="gap")
i_col_gap_u = input.color(color.new(color.teal, 80), title="상승 갭", group=GRP_OPTION, inline="gap")
i_col_gap_d = input.color(color.new(color.red, 80), title="하락 갭", group=GRP_OPTION, inline="gap")
// ==============================================================================
// 【03】 全コード共通仕様(時間・インフラ処理)
// ==============================================================================
// UIで選択された定数をPine内部のシステム識別子に変換
string req_tf = switch i_tf_str
OPT_TF_D => "1D"
OPT_TF_W => "1W"
OPT_TF_1M => "1M"
OPT_TF_3M => "3M"
OPT_TF_12M => "12M"
// 時間計算用の定数 (Current版のオフセット概算に使用)
const int MS_PER_SEC = 1000
// ==============================================================================
// 【04】 各カテゴリ共通仕様 (描画インフラと判定ロジック)
// ==============================================================================
bool is_new_period = timeframe.change(req_tf) or barstate.isfirst
f_get_style(sty_str) =>
sty_str == OPT_STY_S ? line.style_solid : sty_str == OPT_STY_D ? line.style_dashed : line.style_dotted
// プルダウンの選択肢に応じて純粋な数値を計算する専用関数
f_get_val(type_str, _o, _h, _l, _c) =>
float v = switch type_str
OPT_MID => (_h + _l) / 2.0
OPT_OPEN => _o
OPT_CLOSE => _c
OPT_WCL => (_h + _l + _c * 2.0) / 4.0
OPT_PIVOT => (_h + _l + _c) / 3.0
OPT_MEDIAN => (_o + _c) / 2.0
OPT_TWAP => (_o + _h + _l + _c) / 4.0
=> na
v
// ------------------------------------------------------------------------------
// オブジェクトの事前生成 (Current版専用インフラ)
// ------------------------------------------------------------------------------
// ラインの表示がOFFでも、ゾーン表示がONなら透明な線を引いてアンカーにします
bool req_line_a = i_show_a or i_show_zone
bool req_line_b = i_show_b or i_show_zone
var line l_a = line.new(na, na, na, na, xloc=xloc.bar_time, width=i_wid_a, style=f_get_style(i_sty_a), color=i_show_a ? i_col_a : na)
var line l_b = line.new(na, na, na, na, xloc=xloc.bar_time, width=i_wid_b, style=f_get_style(i_sty_b), color=i_show_b ? i_col_b : na)
var box b_gap = box.new(na, na, na, na, xloc=xloc.bar_time, border_color=na, bgcolor=na)
if barstate.isfirst
if i_show_zone
linefill.new(l_a, l_b, i_col_zone)
// ==============================================================================
// 【05】 このコード固有の計算仕様 (Specific Indicator Logic)
// ==============================================================================
var float temp_o = na
var float temp_h = na
var float temp_l = na
var float prev_o = na
var float prev_h = na
var float prev_l = na
var float prev_c = na
var int start_t = na
var int end_t = na
// 描画エンジンへ引き渡すためのフラグと変数
bool do_draw = false
int draw_start = na
int draw_end = na
float val_a = na
float val_b = na
float gap_c = na
float gap_o = na
if is_new_period
// ① 期間が切り替わった瞬間、今まで蓄積していたデータを「前期間の確定値」として昇格させる
prev_o := temp_o
prev_h := temp_h
prev_l := temp_l
prev_c := close[1]
// ② 新しい期間の高値・安値記録をスタート
temp_o := open
temp_h := high
temp_l := low
// ③ X軸(横幅)を今期間の開始時刻から未来の終了時刻に設定
start_t := time
int tc = time_close(req_tf)
end_t := not na(tc) ? tc : time + timeframe.in_seconds(req_tf) * MS_PER_SEC
else
// 期間中は裏で次の期間のための高値・安値を蓄積 (Y座標の高さには一切影響させません)
temp_h := math.max(temp_h, high)
temp_l := math.min(temp_l, low)
if not na(prev_o) and not na(start_t) and not na(end_t)
do_draw := true
int bar_ms = timeframe.in_seconds(timeframe.period) * MS_PER_SEC
draw_start := start_t + (i_offset_left * bar_ms)
draw_end := end_t + (i_offset_right * bar_ms)
// ユーザーが選択した2つのラインの「高さ(Y座標)」を専用関数で計算
val_a := f_get_val(i_type_a, prev_o, prev_h, prev_l, prev_c)
val_b := f_get_val(i_type_b, prev_o, prev_h, prev_l, prev_c)
gap_c := prev_c
gap_o := temp_o
// ==============================================================================
// 【06】 描画と出力 (Rendering & Outputs)
// ==============================================================================
// 1. チャートへの視覚的出力(オブジェクト座標の更新)
if do_draw
if req_line_a
line.set_xy1(l_a, draw_start, val_a)
line.set_xy2(l_a, draw_end, val_a)
if req_line_b
line.set_xy1(l_b, draw_start, val_b)
line.set_xy2(l_b, draw_end, val_b)
// Gap (窓) の描画(枠線なしで色のみ更新)
if i_show_gap and not na(gap_c) and not na(gap_o) and (gap_c != gap_o)
color gap_col = gap_o > gap_c ? i_col_gap_u : i_col_gap_d
float gap_top = math.max(gap_c, gap_o)
float gap_bot = math.min(gap_c, gap_o)
box.set_lefttop(b_gap, draw_start, gap_top)
box.set_rightbottom(b_gap, draw_end, gap_bot)
box.set_bgcolor(b_gap, gap_col)
else
// 窓がない場合、または非表示の場合は見えない場所へ退避
box.set_lefttop(b_gap, na, na)
box.set_rightbottom(b_gap, na, na)
// 2. データウィンドウへの出力 (辞書定数を参照)
// ※【05】で純粋な計算として算出済みの数値をそのまま出力します
plot(val_a, title=LBL_DATA_A, color=i_col_a, display=display.data_window, editable=false)
plot(val_b, title=LBL_DATA_B, color=i_col_b, display=display.data_window, editable=false)
* 원하는 색상으로 설정한 후, 설정 탭에서 '기본값으로 저장'을 눌러주세요.
* 새로 만들기 -> 지표 -> 붙여넣기 순서로 진행하지 않으면 정상적으로 표시되지 않을 수 있습니다.
