//@version=5 strategy("Results Session Breakout Strategy", overlay=true, initial_capital=100000, default_qty_type=strategy.percent_of_equity, default_qty_value=10) // Inputs volLength = input.int(20, title="Volume MA Period", minval=1) volMult = input.float(2.0, title="Volume Spike Multiplier", minval=1.0, step=0.1) atrLength = input.int(14, title="ATR Period", minval=1) atrMult = input.float(1.5, title="Range ATR Multiplier", minval=0.5, step=0.1) breakoutLength = input.int(10, title="Breakout Lookback Period", minval=1) slAtrMult = input.float(1.5, title="Stop Loss (ATR Multiplier)", minval=0.1, step=0.1) tpAtrMult = input.float(3.0, title="Take Profit (ATR Multiplier)", minval=0.1, step=0.1) // Indicator Calculations avgVolume = ta.sma(volume, volLength) volSpike = volume > (avgVolume * volMult) atrVal = ta.atr(atrLength) barRange = high - low volExp = barRange > (atrVal * atrMult) highestHigh = ta.highest(high, breakoutLength)[1] lowestLow = ta.lowest(low, breakoutLength)[1] // Setup Conditions longCondition = volSpike and volExp and (close > open) and (close > highestHigh) shortCondition = volSpike and volExp and (close < open) and (close < lowestLow) // Trade Execution if (longCondition) stopLoss = close - (atrVal * slAtrMult) takeProfit = close + (atrVal * tpAtrMult) strategy.entry("Long", strategy.long) strategy.exit("Exit Long", "Long", stop=stopLoss, limit=takeProfit) if (shortCondition) stopLoss = close + (atrVal * slAtrMult) takeProfit = close - (atrVal * tpAtrMult) strategy.entry("Short", strategy.short) strategy.exit("Exit Short", "Short", stop=stopLoss, limit=takeProfit) // Visualizations plot(highestHigh, title="Breakout High Level", color=color.green, linewidth=1) plot(lowestLow, title="Breakout Low Level", color=color.red, linewidth=1) plotshape(longCondition, title="Earnings Bullish Breakout", style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small) plotshape(shortCondition, title="Earnings Bearish Breakdown", style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small)