15 min orb — Strategy by CashPort
By version
Performance Metrics
- Author: version
- Symbol: CME_MINI:ES1!
- Timeframe: 1 minute
- Net P&L: +1,495.00 USD (+2.99%)
- Win Rate: 66.7%
- Profit Factor: 3.931
- Max Drawdown: 865.00 USD (1.73%)
- Total Trades: 3
Description
//version=5strategy("15min ORB Retest Strategy", overlay=true, default_qty_type=strategy.fixed, default_qty_value=2, initial_capital=50000, commission_type=strategy.commission.cash_per_contract, commission_value=2.50)// ========== INPUTS ==========entryLevel = input.string("Top/Bottom", "Entry Level", options=["Top/Bottom", "Midpoint"])stopPoints = input.float(5.0, "Stop Loss (Points)", minval=0.1)tpPoints = input.float(10.0, "Take Profit (Points)", minval=0.1)// ========== TIME SETTINGS (Mountain Time = UTC-7 or UTC-6 depending on DST) ==========// TradingView uses UTC, so adjust based on your MT offset// For simplicity, using session strings. Adjust if needed for DST.orbSession = "0600-0615:1234567" // 6:00-6:15 AM MT (adjust UTC offset as needed)tradeSession = "0700-0730:1234567" // 7:00-7:30 AM MT// ========== ORB BOX CALCULATION ==========var float boxHigh = navar float boxLow = navar float boxMid = navar bool boxSet = falsevar bool tradeToday = falsevar bool breakoutUp = falsevar bool breakoutDown = false// Detect ORB session (6:00-6:15 AM MT)inOrbSession = not na(time(timeframe.period, orbSession, "America/Denver"))if inOrbSession and not boxSet boxHigh := high boxLow := low boxSet := trueelse if inOrbSession and boxSet boxHigh := math.max(boxHigh, high) boxLow := math.min(boxLow, low)// Calculate midpointif not na(boxHigh) and not na(boxLow) boxMid := (boxHigh + boxLow) / 2// Reset dailyif ta.change(time('D')) boxSet := false tradeToday := false breakoutUp := false breakoutDown := false boxHigh := na boxLow := na boxMid := na// ========== DRAW BOX ==========var line topLine = navar line bottomLine = navar line midLine = naif boxSet and not na(boxHigh) if na(topLine) topLine := line.new(bar_index, boxHigh, bar_index + 1, boxHigh, color=color.green, width=2) bottomLine := line.new(bar_index, boxLow, bar_index + 1, boxLow, color=color.red, width=2) midLine := line.new(bar_index, boxMid, bar_index + 1, boxMid, color=color.gray, width=1, style=line.style_dashed) else line.set_x2(topLine, bar_index) line.set_x2(bottomLine, bar_index) line.set_x2(midLine, bar_index)// ========== BREAKOUT DETECTION ==========inTradeSession = not na(time(timeframe.period, tradeSession, "America/Denver"))// Breakout = 1m close outside boxif boxSet and not na(boxHigh) and not breakoutUp and not breakoutDown if close > boxHigh breakoutUp := true if close boxMid breakoutDown := false // Allow re-setup// ========== RETEST & ENTRY LOGIC ==========longCondition = falseshortCondition = falseif boxSet and inTradeSession and not tradeToday // LONG: breakout up, retest top or midpoint if breakoutUp if entryLevel == "Top/Bottom" and close = boxHigh - 0.25 longCondition := true if entryLevel == "Midpoint" and close = boxMid - 0.25 longCondition := true // SHORT: breakout down, retest bottom or midpoint if breakoutDown if entryLevel == "Top/Bottom" and close >= boxLow and close = boxMid and close <= boxMid + 0.25 shortCondition := true// ========== EXECUTE TRADES ==========if longCondition strategy.entry("Long", strategy.long) strategy.exit("TP/SL", "Long", stop=close - stopPoints, limit=close + tpPoints) tradeToday := trueif shortCondition strategy.entry("Short", strategy.short) strategy.exit("TP/SL", "Short", stop=close + stopPoints, limit=close - tpPoints) tradeToday := true// ========== PLOT SIGNALS ==========plotshape(longCondition, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small, title="Long Entry")plotshape(shortCondition, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small, title="Short Entry")