ICT - GAPS, Volume & Price Imbalances

Vulnerable_human_x · study · 30 行 · 点赞 4,293 · TradingView 原页

本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。

Pine Script

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Vulnerable_human_x
 
//@version=5
indicator("ICT - GAPs and Volume Imbalance", overlay=true)
 
showbull = input.bool(true, "Show Bullish Volume Imbalance", group="Volume Imbalance")
showbear = input.bool(true, "Show Bearish Volume Imbalance", group="Volume Imbalance")
bullimbalance = input.color(color.new(#00e640,10), "Bullish VI Color", group="Volume Imbalance")
bearimbalance = input.color(color.new(#e30000,10), "Bearish VI Color", group="Volume Imbalance")
 
showgaps = input.bool(true, "Show Gaps in Price", group="GAP")
gapcolor = input.color(color.new(#3ed8c3, 70), "GAP Color", group="GAP")
 
viboxextend = input.int(1, "Box Length", group="Volume Imbalance")
gapboxextend = input.int(1, "Box Length", group="GAP")
 
//Volume Imbalance
if open > close[1] and low <= high[1] and close > close[1] and open > open[1] and showbull
    box.new(left=bar_index-1, top=math.min(open,close), right=bar_index + viboxextend, bottom=math.max(close[1],open[1]), bgcolor=bullimbalance, border_color=bullimbalance, text="VI+", text_halign=text.align_right, text_valign=text.align_bottom, text_size=size.tiny, text_color=color.white)
 
if open < close[1] and open < open[1] and high >= low[1] and close < close[1] and showbear
    box.new(left=bar_index-1, top=math.min(close[1],open[1]), right=bar_index + viboxextend, bottom=math.max(open,close), bgcolor=bearimbalance, border_color=bearimbalance,text="VI-", text_halign=text.align_right, text_valign=text.align_bottom, text_size=size.tiny, text_color=color.white)
 
 
//Gap
if high[1] < low and showgaps
    box.new(left=bar_index-1, top=low, right=bar_index + gapboxextend, bottom=high[1], bgcolor=gapcolor, border_color=gapcolor, text="GAP+", text_halign=text.align_right, text_valign=text.align_bottom, text_size=size.tiny, text_color=color.white)
else if low[1] > high and showgaps
    box.new(left=bar_index-1, top=low[1], right=bar_index + gapboxextend, bottom=high, bgcolor=gapcolor, border_color=gapcolor, text="GAP-", text_halign=text.align_right, text_valign=text.align_bottom, text_size=size.tiny, text_color=color.white)

← 返回列表