pine-script - 用文本替换带有 plotshape 的箭头
问题描述
我有这个脚本,当移动平均线交叉时添加一个箭头,但想显示标签向上/标签向下。
study(title="MA 5/10 Strategy", shorttitle="MA Strategy 5/10", overlay=true)
exponential = input(true, title="Exponential MA")
src = close
ma5 = exponential ? ema(src, 5) : sma(src, 5)
ma10 = exponential ? ema(src, 10) : sma(src, 10)
buy_cond = cross(ma5, ma10) and ma5 > ma10
sell_cond = cross(ma5, ma10) and ma5 < ma10
plotarrow(buy_cond ? 1 : 0, colordown=lime, maxheight=25, minheight=15)
plotarrow(sell_cond ? -1 : 0, colorup=red, maxheight=25, minheight=15)
plot( ma5, color=green, style=line, title="5", linewidth=1)
plot( ma10, color=red, style=line, title="10", linewidth=1)
alertcondition(buy_cond, title = "Go Long", message = "Go Long")
alertcondition(sell_cond, title = "Go Short", message = "Go Short")
解决方案
推荐阅读
- javascript - 如何在没有按钮的情况下控制 React-Bootstrap Dropdown 的可见性?
- c++ - 将通用引用转换为可调用的 void 指针,反之亦然
- sql - 使用局部变量时选项重新编译更快
- google-data-studio - Google Data Studio:不要在时间序列图表中显示空值
- spring - 我可以将@ConditionalProperty 与我的自定义注释一起使用以避免重复配置吗?
- javascript - 等待反应和反应角色
- google-kubernetes-engine - 如何在 GKE 上将 opa 部署为 side car 后找到 OPA url
- javascript - 在 React Native 中使用返回无法访问的代码
- ruby-on-rails - 为包含的方法调用 super 会导致“无超类方法”错误 - ActiveSupport
- python - WebScraping w/ Beautiful Soup:如何返回列表中的空元素?