//@version=5 strategy("Ultimate Bitcoin Scalping Strategy", overlay=true, initial_capital=10000, default_qty_type=strategy.percent_of_equity, default_qty_value=100) // Inputs emaFastLen = input.int(9, title="Fast EMA Length") emaSlowLen = input.int(20, title="Slow EMA Length") lookbackBars = input.int(20, title="Support/Resistance Lookback Bars") riskRewardRatio = input.float(2.0, title="Risk-to-Reward Ratio") // Indicators emaFast = ta.ema(close, emaFastLen) emaSlow = ta.ema(close, emaSlowLen) // Plotting EMAs plot(emaFast, color=color.blue, title="9 EMA") plot(emaSlow, color=color.red, title="20 EMA") // Support & Resistance Logic using recent high/low resistanceLevel = ta.highest(high, lookbackBars) supportLevel = ta.lowest(low, lookbackBars) // Crossover Conditions bullishCross = ta.crossover(emaFast, emaSlow) bearishCross = ta.crossunder(emaFast, emaSlow) // Proximity to S&P levels (Price near Support/Resistance) isNearSupport = (low <= supportLevel * 1.005) isNearResistance = (high >= resistanceLevel * 0.995) // Strategy Conditions longCondition = bullishCross and isNearSupport shortCondition = bearishCross and isNearResistance // Execution float longStopLoss = na float longTakeProfit = na float shortStopLoss = na float shortTakeProfit = na if (longCondition) longStopLoss := low - (ta.atr(14) * 0.5) longTakeProfit := close + ((close - longStopLoss) * riskRewardRatio) strategy.entry("Long", strategy.long) if (shortCondition) shortStopLoss := high + (ta.atr(14) * 0.5) shortTakeProfit := close - ((shortStopLoss - close) * riskRewardRatio) strategy.entry("Short", strategy.short) // Exit management if (strategy.position_size > 0) strategy.exit("Exit Long", "Long", stop=longStopLoss, limit=longTakeProfit) if (strategy.position_size < 0) strategy.exit("Exit Short", "Short", stop=shortStopLoss, limit=shortTakeProfit)