OPEN-SOURCE SCRIPT

MA + Volume Strategy

//version=5
strategy("MA + Volume Strategy", overlay=true)

// Parameters
maLength = input.int(50, title="MA Length", minval=1)
volLength = input.int(20, title="Volume MA Length", minval=1)

// Calculating Moving Average and Volume Average
ma = ta.sma(close, maLength)
volMa = ta.sma(volume, volLength)

// Plot the Moving Average
plot(ma, title="Moving Average", color=color.blue, linewidth=2)

// Buy Condition: Price crosses above the MA and Volume > Volume MA
buyCondition = ta.crossover(close, ma) and volume > volMa

// Sell Condition: Price crosses below the MA and Volume > Volume MA
sellCondition = ta.crossunder(close, ma) and volume > volMa

// Strategy entry/exit
if (buyCondition)
strategy.entry("Buy", strategy.long)

if (sellCondition)
strategy.close("Buy")

// Plot volume with volume average for reference
plot(volume, title="Volume", color=color.green, style=plot.style_histogram, transp=70)
plot(volMa, title="Volume Moving Average", color=color.red)
Bill Williams Indicators

Open-source Skript

Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun das Script auch andere Trader verstehen und prüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden. Die Nutzung dieses Codes in einer Veröffentlichung wird in unseren Hausregeln reguliert. Sie können es als Favoriten auswählen, um es in einem Chart zu verwenden.

Möchten Sie dieses Skript auf einem Chart verwenden?

Haftungsausschluss