OPEN-SOURCE SCRIPT
Kaiso EMA + FVG + Bias Toolkit

howBias = input.bool(true, "Show Daily Bias on H4 以下", group=groupBias)
biasOffset = input.int(20, "距離目前 K 棒", minval=5, maxval=200, group=groupBias)
candleGap = input.int(6, "D-2 / D-1 / D 間距", minval=2, maxval=50, group=groupBias)
candleWidth = input.int(2, "蠟燭寬度", minval=1, maxval=10, group=groupBias)
bullColor = input.color(color.white, "上漲蠟燭顏色", group=groupBias)
bearColor = input.color(color.blue, "下跌蠟燭顏色", group=groupBias)
wickColor = input.color(color.blue, "影線顏色", group=groupBias)
textColor = input.color(color.black, "文字顏色", group=groupBias)
prevHLColor = input.color(color.red, "前日高低顏色", group=groupBias)
ohlcLineColor = input.color(color.black, "O/H/L/C 線條顏色", group=groupBias)
isH4Below = timeframe.isintraday and timeframe.in_seconds(timeframe.period) <= 14400
d2O = request.security(syminfo.tickerid, "D", open[2], lookahead=barmerge.lookahead_on)
d2H = request.security(syminfo.tickerid, "D", high[2], lookahead=barmerge.lookahead_on)
d2L = request.security(syminfo.tickerid, "D", low[2], lookahead=barmerge.lookahead_on)
d2C = request.security(syminfo.tickerid, "D", close[2], lookahead=barmerge.lookahead_on)
d1O = request.security(syminfo.tickerid, "D", open[1], lookahead=barmerge.lookahead_on)
d1H = request.security(syminfo.tickerid, "D", high[1], lookahead=barmerge.lookahead_on)
d1L = request.security(syminfo.tickerid, "D", low[1], lookahead=barmerge.lookahead_on)
d1C = request.security(syminfo.tickerid, "D", close[1], lookahead=barmerge.lookahead_on)
dO = request.security(syminfo.tickerid, "D", open, lookahead=barmerge.lookahead_on)
var line[] biasLines = array.new_line()
var box[] biasBoxes = array.new_box()
var label[] biasLabels = array.new_label()
f_clearBias() =>
while array.size(biasLines) > 0
line.delete(array.pop(biasLines))
while array.size(biasBoxes) > 0
box.delete(array.pop(biasBoxes))
while array.size(biasLabels) > 0
label.delete(array.pop(biasLabels))
f_line(_x1, _y1, _x2, _y2, _col, _style, _width) =>
ln = line.new(_x1, _y1, _x2, _y2, color=_col, sty
biasOffset = input.int(20, "距離目前 K 棒", minval=5, maxval=200, group=groupBias)
candleGap = input.int(6, "D-2 / D-1 / D 間距", minval=2, maxval=50, group=groupBias)
candleWidth = input.int(2, "蠟燭寬度", minval=1, maxval=10, group=groupBias)
bullColor = input.color(color.white, "上漲蠟燭顏色", group=groupBias)
bearColor = input.color(color.blue, "下跌蠟燭顏色", group=groupBias)
wickColor = input.color(color.blue, "影線顏色", group=groupBias)
textColor = input.color(color.black, "文字顏色", group=groupBias)
prevHLColor = input.color(color.red, "前日高低顏色", group=groupBias)
ohlcLineColor = input.color(color.black, "O/H/L/C 線條顏色", group=groupBias)
isH4Below = timeframe.isintraday and timeframe.in_seconds(timeframe.period) <= 14400
d2O = request.security(syminfo.tickerid, "D", open[2], lookahead=barmerge.lookahead_on)
d2H = request.security(syminfo.tickerid, "D", high[2], lookahead=barmerge.lookahead_on)
d2L = request.security(syminfo.tickerid, "D", low[2], lookahead=barmerge.lookahead_on)
d2C = request.security(syminfo.tickerid, "D", close[2], lookahead=barmerge.lookahead_on)
d1O = request.security(syminfo.tickerid, "D", open[1], lookahead=barmerge.lookahead_on)
d1H = request.security(syminfo.tickerid, "D", high[1], lookahead=barmerge.lookahead_on)
d1L = request.security(syminfo.tickerid, "D", low[1], lookahead=barmerge.lookahead_on)
d1C = request.security(syminfo.tickerid, "D", close[1], lookahead=barmerge.lookahead_on)
dO = request.security(syminfo.tickerid, "D", open, lookahead=barmerge.lookahead_on)
var line[] biasLines = array.new_line()
var box[] biasBoxes = array.new_box()
var label[] biasLabels = array.new_label()
f_clearBias() =>
while array.size(biasLines) > 0
line.delete(array.pop(biasLines))
while array.size(biasBoxes) > 0
box.delete(array.pop(biasBoxes))
while array.size(biasLabels) > 0
label.delete(array.pop(biasLabels))
f_line(_x1, _y1, _x2, _y2, _col, _style, _width) =>
ln = line.new(_x1, _y1, _x2, _y2, color=_col, sty
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.