//@version=5 strategy("MambaFx 1-Minute Scalping Strategy", overlay=true, initial_capital=1000, default_qty_type=strategy.percent_of_equity, default_qty_value=10) // Inputs m5_ema_len = input.int(50, title="5M EMA Filter Length") m1_breakout_len = input.int(10, title="1M Breakout Lookback") rr_ratio = input.float(3.0, title="Risk-to-Reward Ratio") // 5M Context m5_close = request.security(syminfo.tickerid, "5", close[1], lookahead=barmerge.lookahead_off) m5_ema = request.security(syminfo.tickerid, "5", ta.ema(close, m5_ema_len)[1], lookahead=barmerge.lookahead_off) m5_bullish = m5_close > m5_ema m5_bearish = m5_close < m5_ema // 1M Breakout Levels m1_highs = request.security(syminfo.tickerid, "1", ta.highest(high, m1_breakout_len)[1], lookahead=barmerge.lookahead_off) m1_lows = request.security(syminfo.tickerid, "1", ta.lowest(low, m1_breakout_len)[1], lookahead=barmerge.lookahead_off) // Entry Conditions long_breakout = ta.crossover(close, m1_highs) short_breakout = ta.crossunder(close, m1_lows) buy_cond = m5_bullish and long_breakout and strategy.position_size == 0 sell_cond = m5_bearish and short_breakout and strategy.position_size == 0 // Stop Loss / Take Profit var float sl = na var float tp = na if buy_cond sl := m1_lows risk = close - sl if risk > 0 tp := close + risk * rr_ratio strategy.entry("Long", strategy.long) strategy.exit("Exit Long", "Long", stop=sl, limit=tp) if sell_cond sl := m1_highs risk = sl - close if risk > 0 tp := close - risk * rr_ratio strategy.entry("Short", strategy.short) strategy.exit("Exit Short", "Short", stop=sl, limit=tp) // Plot Breakout Levels plot(m5_bullish ? m1_highs : na, color=color.green, linewidth=2, title="1M High Breakout") plot(m5_bearish ? m1_lows : na, color=color.red, linewidth=2, title="1M Low Breakout") // Plot 5M EMA plot(m5_ema, color=color.orange, linewidth=2, title="5M EMA") // Buy/Sell Markers plotshape(buy_cond, title="BUY", style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small, text="BUY") plotshape(sell_cond, title="SELL", style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small, text="SELL")