//@version=6 strategy("Session reclaim experiment", overlay = true, initial_capital = 10000, pyramiding = 0, default_qty_type = strategy.fixed, default_qty_value = 1, commission_type = strategy.commission.cash_per_order, commission_value = 1, slippage = 1, margin_long = 100, margin_short = 100) hours = input.session("0930-1600", "Session") zone = input.string("America/New_York", "IANA timezone") cutHour = input.int(15, "Cutoff hour", minval = 0, maxval = 23) cutMinute = input.int(45, "Cutoff minute", minval = 0, maxval = 59) stopTicks = input.int(60, "Stop ticks", minval = 1) targetTicks = input.int(60, "Target ticks", minval = 1) if not timeframe.isintraday runtime.error("Use an intraday chart") inside = not na(time(timeframe.period, hours, zone)) dayKey = year(time, zone) * 10000 + month(time, zone) * 100 + dayofmonth(time, zone) newSession = inside and (not inside[1] or dayKey != dayKey[1]) var float weighted = 0 var float total = 0 var bool badVolume = false if newSession weighted := 0 total := 0 badVolume := false if inside badVolume := badVolume or na(volume) if not na(volume) and volume > 0 weighted += hlc3 * volume total += volume vwap = inside and total > 0 and not badVolume ? weighted / total : na reclaim = ta.crossover(close, vwap) minutes = hour(time_close, zone) * 60 + minute(time_close, zone) cutoff = minutes >= cutHour * 60 + cutMinute if barstate.isconfirmed if inside and not newSession and not cutoff and reclaim if strategy.position_size == 0 strategy.entry("L", strategy.long) strategy.exit("X", "L", loss = stopTicks, profit = targetTicks) if cutoff or not inside strategy.close("L") plot(vwap, "Session estimate", color.blue)