搜索
产品
社区
市场
新闻
经纪商
更多
CN
开始
社区
/
脚本
/
Custom MA Crossover with Volume
OPEN-SOURCE SCRIPT
Custom MA Crossover with Volume
由frndravinder提供
关注
关注
11小时前
2
添加到收藏
添加到收藏
11小时前
//
version
=5
indicator("Custom MA Crossover with Volume", overlay=true)
// User-defined moving average periods
fast_length = input.int(10, title="Fast MA Length")
slow_length = input.int(100, title="Slow MA Length")
// Calculate moving averages
fast_ma = ta.sma(close, fast_length)
slow_ma = ta.sma(close, slow_length)
// Calculate 10-day average volume
volume_avg = ta.sma(volume, 10)
// Define crossover conditions
bullish_crossover = ta.crossover(fast_ma, slow_ma) and volume > volume_avg
bearish_crossover = ta.crossunder(fast_ma, slow_ma) and volume > volume_avg
// Plot moving averages
plot(fast_ma, color=color.green, title="Fast MA")
plot(slow_ma, color=color.red, title="Slow MA")
// Plot buy and sell labels
if (bullish_crossover)
label.new(bar_index, na, "Buy", color=color.green, style=label.style_label_up, textcolor=color.white)
if (bearish_crossover)
label.new(bar_index, na, "Sell", color=color.red, style=label.style_label_down, textcolor=color.white)
// Display volume average for reference
plot(volume_avg, color=color.blue, title="10-Day Avg Volume", linewidth=1)
Cycles
开源脚本
本着真正的TradingView精神,此脚本的作者已将其开源,以便交易者可以理解和验证它。向作者致敬!您可以免费使用它,但在出版物中重复使用此代码受
网站规则
约束。 您可以收藏它以在图表上使用。
想在图表上使用此脚本?
添加到收藏
frndravinder
关注
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在
使用条款
阅读更多信息。