BUYVIPonly — Strategy by vipulgupta0728
By version
Performance Metrics
- Author: version
- Symbol: MCX:SILVER1!
- Timeframe: 1 hour
- Net P&L: +13,782,000.00 INR (+1,378.20%)
- Win Rate: 37.0%
- Profit Factor: 1.393
- Max Drawdown: 2,939,400.00 INR (72.54%)
- Total Trades: 365
- Sharpe Ratio: 0.353
Description
//version=5strategy("Buy-Only: 40 EMA + BB(0.7) [with TP reset]", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10)// === INPUTS ===emaLength = input.int(40, title="EMA Length")bbStdDev = input.float(0.7, title="Bollinger Bands StdDev")rr_ratio = input.float(3.0, title="Reward-to-Risk Ratio") // 3:1 RR// === INDICATORS ===ema = ta.ema(close, emaLength)dev = bbStdDev * ta.stdev(close, emaLength)upperBB = ema + devlowerBB = ema - devplot(ema, color=color.orange, title="EMA 40")plot(upperBB, color=color.teal, title="Upper BB")plot(lowerBB, color=color.teal, title="Lower BB")// === STATE VARIABLES ===var float longSL = navar float longTP = navar bool waitForNewCross = false // ema and not waitForNewCross and strategy.position_size == 0if buyCondition strategy.entry("Buy", strategy.long) longSL := lowerBB longTP := close + (close - lowerBB) * rr_ratio// === SL SHIFT TO EMA IF PRICE CLOSES ABOVE UPPER BB ===if (strategy.position_size > 0 and close > upperBB) longSL := ema// === EXIT LOGIC ===if (strategy.position_size > 0) if close = longTP strategy.close("Buy", comment="TP Hit") waitForNewCross := true // Block next trade// === RESET ENTRY CONDITION ===// Wait for crossover below EMA then new close above itif waitForNewCross and ta.crossunder(close, ema) waitForNewCross := false