HARRISH DADE — Strategy by harrishdade

By version

Performance Metrics

Description

//version=5strategy("Nifty 15m ORB + 20 EMA + Volume - Signals Fixed", overlay=true, initial_capital=100000, default_qty_type=strategy.percent_of_equity, default_qty_value=25, process_orders_on_close=true)// 15-minute timeframe checkif timeframe.period != "15" runtime.error("Use this strategy on 15 minute timeframe only")// ORB 9:15–9:30 High/Lowvar float orbHigh = navar float orbLow = nanewDay = ta.change(time("D")) != 0if newDay orbHigh := na orbLow := nasessStart = 0915sessEnd = 0930hhmm = hour * 100 + minuteinORB = hhmm >= sessStart and hhmm ema20dnTrend = close = (avgVol * volMult)// ORB complete checkorbLocked = not na(orbHigh) and not na(orbLow) and not inORB// Entry conditions (for strategy)longCond = orbLocked and ta.crossover(close, orbHigh) and upTrend and enoughVolshortCond = orbLocked and ta.crossunder(close, orbLow) and dnTrend and enoughVol// Risk ManagementtargetPts = input.float(40.0, "Target Points", step=1.0)slPts = input.float(25.0, "Stoploss Points", step=1.0)// STRATEGY ENTRIESif longCond and strategy.position_size == 0 strategy.entry("LONG", strategy.long)if shortCond and strategy.position_size == 0 strategy.entry("SHORT", strategy.short)// STRATEGY EXITSif strategy.position_size > 0 strategy.exit("LONG EXIT", from_entry="LONG", limit=strategy.position_avg_price + targetPts, stop=strategy.position_avg_price - slPts)if strategy.position_size < 0 strategy.exit("SHORT EXIT", from_entry="SHORT", limit=strategy.position_avg_price - targetPts, stop=strategy.position_avg_price + slPts)// **FIXED BUY/SELL SIGNALS** - No barstate.isconfirmed, direct conditionsplotshape(longCond, title="BUY", style=shape.triangleup, location=location.belowbar, color=color.new(color.lime, 0), size=size.large, text="BUY", textcolor=color.white) plotshape(shortCond, title="SELL", style=shape.triangledown, location=location.abovebar, color=color.new(color.red, 0), size=size.large, text="SELL", textcolor=color.white)// Debug table - shows if conditions metif barstate.islast var table debugTable = table.new(position.top_right, 2, 6, bgcolor=color.white, border_width=1) table.cell(debugTable, 0, 0, "Condition", text_color=color.black, bgcolor=color.gray) table.cell(debugTable, 1, 0, "Status", text_color=color.black, bgcolor=color.gray) table.cell(debugTable, 0, 1, "ORB Locked", text_color=color.black) table.cell(debugTable, 1, 1, str.tostring(orbLocked), text_color=orbLocked ? color.green : color.red) table.cell(debugTable, 0, 2, "UpTrend", text_color=color.black) table.cell(debugTable, 1, 2, str.tostring(upTrend), text_color=upTrend ? color.green : color.red) table.cell(debugTable, 0, 3, "Enough Vol", text_color=color.black) table.cell(debugTable, 1, 3, str.tostring(enoughVol), text_color=enoughVol ? color.green : color.red)

Browse all 5,900+ TradingView Pine Script strategies

View on TradingView