之字形斐波那契水平交叉

问题描述

如果有人能帮我解决这个问题,我会很感激,因为我不是真正的编码员。 基本上我想要我的代码做什么,当价格达到斐波那契水平时提醒我(由我预先估算,比方说 0,382 或 0,5)但是从 ZIG ZAG 指标的高点和低点。 因此,如果 Zig Zag 指标创建了一条新线(意味着从低点到近期高点)并且价格正在下跌,如果价格达到上次波动的 fib 水平,我的指标会提醒我。

我的想法是创建一个新的变量来存储 X:= ( 最近的高 - 最近的低 ) * 输入的 fib 水平 // 所以我们得到了我们想要跨越的值

如果价格与 var X 交叉,则提醒

我把锯齿形指标放在这里,如果有人能帮助我实现我的想法

//@version=4
study("Zig Zag High Low",overlay = true)
length = input(4,title = "High/Low length")
h = highest(high,length * 2 + 1)
l = lowest(low,length * 2 + 1)
f_isMin(len) => 
    l == low[len]
f_isMax(len) => 
    h == high[len]

var dirUp = false
var lastLow = high * 100
var lastHigh = 0.0
var timeLow = bar_index
var timeHigh = bar_index
var line li = na
f_drawLine() =>
    _li_color = dirUp ? color.teal : color.orange
    line.new(
         timeHigh - length,lastHigh,timeLow - length,lastLow,xloc.bar_index,color=_li_color,width=2
         )

if dirUp
    if (f_isMin(length) and low[length] < lastLow)
        lastLow := low[length]
        timeLow := bar_index
        line.delete(li)
        li := f_drawLine()

    if (f_isMax(length) and high[length] > lastLow)
        lastHigh := high[length]
        timeHigh := bar_index
        dirUp := false
        li := f_drawLine()

if not dirUp
    if (f_isMax(length) and high[length] > lastHigh)
        lastHigh := high[length]
        timeHigh := bar_index
        line.delete(li)
        li := f_drawLine()
    if f_isMin(length) and low[length] < lastHigh
        lastLow := low[length]
        timeLow := bar_index
        dirUp := true
        li := f_drawLine()
        if (f_isMax(length) and high[length] > lastLow)
            lastHigh := high[length]
            timeHigh := bar_index
            dirUp := false
            li := f_drawLine()

解决方法

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

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

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

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...