New code

New code

//@version=5
indicator("Custom Stock Analysis", overlay=true)

// Inputs
sma_length = input.int(20, title="SMA Length")
volume_multiplier = input.float(1.5, title="Volume Multiplier for Unusual Volume")

// Data Calculations
sma = ta.sma(close, sma_length) // Simple Moving Average
volatility = high - low // Daily Volatility
avg_volume = ta.sma(volume, sma_length) // Average Volume
unusual_volume = volume > (volume_multiplier * avg_volume) // Unusual Volume

// Plot SMA
plot(sma, color=color.orange, title="20-SMA")

// Plot Close Price
plot(close, color=color.blue, title="Close Price", linewidth=2)

// Highlight Unusual Volume
bgcolor(unusual_volume ? color.new(color.red, 80) : na, title="Unusual Volume Background")

// Plot Volatility as a Separate Indicator
hline(0, "Baseline", color=color.gray)
plot(volatility, color=color.purple, title="Volatility")

Read More

Share:

Latest News