当低于阈值时,数组上/下索引以计算 StochK 的平均值的问题

问题描述

第一次使用数组,我已经掌握了它,但似乎无法正确配置:

本质上:

-当 StochK 低于阈值时

-> 将每个柱状 StochK 浮点值存储为数组

-计算每根柱线收盘的数组平均值,其中索引是一个切片(从 = 0 到 = 柱线)

-当 StochK > Stoch_bottomavg - 这是长期条件

我尝试了不同配置的堆,即 barsince + 1,在 longcondition 中清除数组,bar_x_under - 1 在切片的索引区域中,但仍然无法正常工作 - 请帮助并非常感谢

// Stoch Buy Condition - Create an average from values of Stoch under i_lower threshold
S_x_under = baRSSince(crossunder(StochK,i_lowerx))
var S_u = array.new_float(0,StochK) // <- start array at 1 elements (0)
if StochK < i_lowerx
    array.unshift(S_u,StochK) // <- push next value to 0,everything moves right
Stoch_bottom := array.avg(array.slice(S_u,S_x_under)) <- stoch 'bottom' is a single value as an average of all StochK values that occurred since crossunder

// longcondition is if StochK moves above the average determined by array
if (StochK >= Stoch_bottom and StochK[1] <= i_lowerx and RSI < i_upperx and rbought==false and sbought == false)
    longcondition :=true
    sbought := true
    check := true // this is just for another debug
    entryprice := open ```

解决方法

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

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

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

相关问答

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