// Conditions longCondition = ta.crossover(smaShort, smaLong) and rsi > rsiOversold and macdLine > signalLine shortCondition = ta.crossunder(smaShort, smaLong) and rsi < rsiOverbought and macdLine < signalLine
// Position Sizing based on Risk capital = strategy.equity riskAmount = capital * (riskPerc / 100) stopLossValue = riskAmount / (stopLossPerc / 100) positionSize = stopLossValue / close
// Entry Signals if (longCondition) strategy.entry("Long", strategy.long, qty=positionSize) if alertOnSignal alert("Swing Trading: Long Position Opened", alert.freq_once)
if (shortCondition) strategy.entry("Short", strategy.short, qty=positionSize) if alertOnSignal alert("Swing Trading: Short Position Opened", alert.freq_once)