// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © AI_PIPS //@version=6 indicator("AIPIPS Session Killzones", overlay=true, max_boxes_count=500) asian = input.session("0000-0500", "Asian range") londonKill = input.session("0700-1000", "London killzone") newyorkKill = input.session("1330-1600", "NY killzone") showBoxes = input.bool(true, "Draw killzone boxes") sessionActive(sess) => time(timeframe.period, sess) var box asianBox = na var box londonBox = na var box nyBox = na fManageBox(active, ref) => if active if na(ref) ref := box.new(bar_index, low, bar_index, high, bgcolor=color.new(color.blue, 90)) else box.set_right(ref, bar_index) box.set_top(ref, math.max(box.get_top(ref), high)) box.set_bottom(ref, math.min(box.get_bottom(ref), low)) else if not active and not na(ref) box.delete(ref) ref := na ref if showBoxes asianBox := fManageBox(sessionActive(asian), asianBox) londonBox := fManageBox(sessionActive(londonKill), londonBox) nyBox := fManageBox(sessionActive(newyorkKill), nyBox) asianRangeHigh = request.security(syminfo.tickerid, "60", ta.highest(high, 6)) asianRangeLow = request.security(syminfo.tickerid, "60", ta.lowest(low, 6)) sweepAsianHigh = close > asianRangeHigh sweepAsianLow = close < asianRangeLow plotshape(sweepAsianHigh, title="Asian High Raid", text="AZH", style=shape.labeldown, color=color.new(color.purple, 0)) plotshape(sweepAsianLow, title="Asian Low Raid", text="AZL", style=shape.labelup, color=color.new(color.purple, 0)) bgcolor(sessionActive(londonKill) ? color.new(color.green, 92) : sessionActive(newyorkKill) ? color.new(color.red, 92) : na)