// Volatility: Bollinger Bands basis = ta.sma(close, bbLength) dev = ta.stdev(close, bbLength) upperBand = basis + 2 * dev lowerBand = basis - 2 * dev
// —————— Strategy Logic —————— // Long Conditions longCondition = close > ema200 and // Long-term bullish ta.crossover(emaFast, emaSlow) and // EMA crossover rsi > 50 and // Momentum rising close > lowerBand and // Bounce from lower Bollinger Band macdLine > signalLine // MACD bullish
// Short Conditions shortCondition = close < ema200 and // Long-term bearish ta.crossunder(emaFast, emaSlow) and // EMA crossunder rsi < 50 and // Momentum weakening close < upperBand and // Rejection from upper Bollinger Band macdLine < signalLine // MACD bearish