//@version=6 strategy("Two/four crossover", overlay = true, initial_capital = 10000, pyramiding = 0, default_qty_type = strategy.fixed, default_qty_value = 1, commission_type = strategy.commission.cash_per_order, commission_value = 1, slippage = 1, margin_long = 100, margin_short = 100) fastLength = input.int(2, "Fast", minval = 1) slowLength = input.int(4, "Slow", minval = 2) if fastLength >= slowLength or not timeframe.isdaily runtime.error("Use daily bars and fast < slow") fast = ta.sma(close, fastLength) slow = ta.sma(close, slowLength) up = ta.crossover(fast, slow) down = ta.crossunder(fast, slow) if barstate.isconfirmed if up and strategy.position_size == 0 strategy.entry("L", strategy.long) if down and strategy.position_size > 0 strategy.close("L") plot(fast, "Fast", color.blue) plot(slow, "Slow", color.gray)