程序问答   发布时间:2022-06-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了当 2 条移动平均线相互交叉时绘制标签 — Pinescript v4 (TradingView)大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决当 2 条移动平均线相互交叉时绘制标签 — Pinescript v4 (TradingView)?

开发过程中遇到当 2 条移动平均线相互交叉时绘制标签 — Pinescript v4 (TradingView)的问题如何解决?下面主要结合日常开发的经验,给出你关于当 2 条移动平均线相互交叉时绘制标签 — Pinescript v4 (TradingView)的解决方法建议,希望对你解决当 2 条移动平均线相互交叉时绘制标签 — Pinescript v4 (TradingView)有所启发或帮助;

LonesomeTheBlue 编写了一个非常漂亮的脚本,用于绘制不同时间范围内的移动平均线。在此处详细了解他的脚本:Moving Average MTF Live [Experimental] by LonesomeTheBlue

我正在尝试绘制“买入”和“卖出”标签,以便在这两个 MA 相互交叉时绘制“买入”和“卖出”标签,但在这样做时遇到了问题。

// This source code is subject to the terms of the Mozilla Public license 2.0 at https://mozilla.org/MPL/2.0/
// © LonesomeTheBlue

//@version=4
study("[CS] Moving Average MTF live [Experimental]",overlay = true)

tf = input('5',type = input.resolution)
fastlen = input(7)
slowlen = input(200)

// get HTF moving averages
emafast = security(syminfo.tickerID,tf,ema(close,fastlen),lookahead = true)
emafastcur = security(syminfo.tickerID,lookahead = false)
emaslow = security(syminfo.tickerID,slowlen),lookahead = true)
emaslowcur = security(syminfo.tickerID,lookahead = false)

// is this last bar?
islast = security(syminfo.tickerID,barstate.islast,lookahead = true)

//if not last bar then draw non-repaint historical moving average
plot(islast ? na : emafast,color = islast ? na : color.lime,linewidth = 2)
plot(islast ? na : emaslow,color = islast ? na : color.red,linewidth = 2)

//calculate and keep the beginning of line
lastbar_index = 0
lastbar_index := change(time(tf)) != 0 ? 0 : nz(lastbar_index[1]) + 1

// draw real time higher time frame moving averare
line emahtffast = line.new(bar_index,emafastcur,bar_index - lastbar_index,color = color.blue,wIDth = 0)
line emahtfslow = line.new(bar_index,emaslowcur,color = color.red,wIDth = 0)

// delete old lines if it's not the last one in htf periof
if change(time(tf)) == 0
    line.delete(emahtffast[1])
    line.delete(emahtfslow[1])
@H_403_12@ @H_403_12@

我尝试了以下方法但没有成功。不知道我做错了什么,但会感谢你们中的一位有才华的窥视者的任何帮助!提前致谢。

    // buy+sell conditions / styling
    buyCond = crossover(emahtffast,emahtfslow)
    sellCond = crossunder(emahtfslow,emahtffast)

    plotshape(buyCond,style=shape.triangleup,size=size.normal,location=location.belowbar,color=color.lime)
    plotshape(sellCond,style=shape.triangledown,location=location.abovebar,color=color.red)
@H_403_12@ @H_403_12@

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

algorithmic-tradingmoving-averagepine-script
  • 上一篇:我怎样才能使这个算法对拼图更有效下一篇:为什么这个表单验证似乎绕过了`eve

编程问答相关问答

在 R 中绘制不规则大小的对象(美学必须是长度为 1 或与数据相同)
我正在使用 R 中的 ggplot 库。是否可以在同一个图形上绘制不规则大小的对象? 假设我的数据是这
CRC16 CCITT Java 实现
有一个用 C 编写的函数来计算 CRC16 CCITT。它有助于从 RFID 阅读器读取数据 - 基本上工作正常。我想用 Java
如何使 R 将图形输出为 Excel 单元格中的值?
<a href="https://i.stack.imgur.com/e3Y8N.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/e3Y8N.png" alt="I am hoping t
使用动画 C# 更改网格的位置
WPF <pre><code>&lt;Grid Name=&#34;GhostGrid&#34;&gt; &lt;Image Source=&#34;img.jpg&#34;/&gt; &lt;/Grid&gt; </code></pre> 我
Flutter 文件选择器创建符号链接
我已经与这个问题斗争了一段时间,我似乎无处可去,我正在使用 <a href="https://pub.dev/packages/file_picker" re
有没有办法在 Paraview 中自动加载 csv 文件?
我正在使用 Paraview 显示存储在 csv 文件中的测井信息。 加载 csv 数据文件并添加“表到点”过滤器
如何利用 Spark 的管道在字符串中查找短语然后添加特征类别?
我想在 pyspark 数据框中的文本列中搜索短语。这是一个示例,向您展示我的意思。 <pre><code>sentenceData
notifyDatasetchanged 正在更新带有错误信息的列表适配器
<pre><code>public class ListAdapter extends BaseAdapter implements Filterable { Context context; private final String [] values;

大佬总结

以上是大佬教程为你收集整理的当 2 条移动平均线相互交叉时绘制标签 — Pinescript v4 (TradingView)全部内容,希望文章能够帮你解决当 2 条移动平均线相互交叉时绘制标签 — Pinescript v4 (TradingView)所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: