OPEN-SOURCE SCRIPT

Ansh Intraday Crypto Strategy v5

//version=6
strategy('Refined Intraday Crypto Strategy v5', overlay=true)

// Inputs
emaLength = input.int(55, title='EMA Length') // Custom EMA Length
rsiLength = input.int(14, title='RSI Length') // Custom RSI Length
rsiOverbought = input.int(70, title='RSI Overbought Level')
rsiOversold = input.int(30, title='RSI Oversold Level')
volumeMultiplier = input.float(3.0, title='Volume Multiplier (Above Average)') // Custom Volume Multiplier

// Indicators
ema = ta.ema(close, emaLength)
rsi = ta.rsi(close, rsiLength)
avgVolume = ta.sma(volume, 20)
isBullishTrend = close > ema
isBearishTrend = close < ema

// Volume Filter
volumeSpike = volume > avgVolume * volumeMultiplier

// Support/Resistance (Simplified)
support = ta.lowest(low, 20)
resistance = ta.highest(high, 20)

// Entry Conditions (Refined)
longCondition = isBullishTrend and close > support and rsi < rsiOversold and ta.crossover(rsi, rsiOversold) and volumeSpike and close > open
shortCondition = isBearishTrend and close < resistance and rsi > rsiOverbought and ta.crossunder(rsi, rsiOverbought) and volumeSpike and close < open

// Plotting
plot(ema, color=color.blue, title='55 EMA')

// Plot buy and sell signals with shape and labels
plotshape(longCondition, title='Long Signal', location=location.belowbar, color=color.green, style=shape.labelup, text='BUY')
plotshape(shortCondition, title='Short Signal', location=location.abovebar, color=color.red, style=shape.labeldown, text='SELL')

// Alerts
alertcondition(longCondition, title='Long Entry', message='Bullish Setup: Price > Support, RSI Oversold, Volume Spike, Bullish Candle')
alertcondition(shortCondition, title='Short Entry', message='Bearish Setup: Price < Resistance, RSI Overbought, Volume Spike, Bearish Candle')

// Strategy Entries and Exits for Backtesting
if longCondition
strategy.entry('Long', strategy.long)

if shortCondition
strategy.entry('Short', strategy.short)

// Optional: Close strategy positions based on conditions like stop-loss or take-profit
// Fixing the exit conditions for strategy.close
if isBullishTrend and close < ema
strategy.close('Long')

if isBearishTrend and close > ema
strategy.close('Short')

Clause de non-responsabilité