首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >无凹形偏移的William Fractals

无凹形偏移的William Fractals
EN

Stack Overflow用户
提问于 2022-10-19 13:06:08
回答 1查看 40关注 0票数 0

是否有办法从图形中移除偏移量,换句话说,我们需要如何修改(upFractal)条件,以便我可以在没有任何偏移量的情况下使用without使其工作起来就像偏移量(-6)存在一样,即使它被延迟了?

代码语言:javascript
运行
复制
//@version=5
indicator("Williams Fractals", shorttitle="Fractals", format=format.price, precision=0, overlay=true)
// Define "n" as the number of periods and keep a minimum value of 2 for error handling.
n = input.int(title="Periods", defval=6, minval=2)


// UpFractal
bool upflagDownFrontier = true
bool upflagUpFrontier0 = true
bool upflagUpFrontier1 = true
bool upflagUpFrontier2 = true
bool upflagUpFrontier3 = true
bool upflagUpFrontier4 = true

for i = 1 to n
    upflagDownFrontier := upflagDownFrontier and (high[n-i] < high[n])
    upflagUpFrontier0 := upflagUpFrontier0 and (high[n+i] < high[n])
    upflagUpFrontier1 := upflagUpFrontier1 and (high[n+1] <= high[n] and high[n+i + 1] < high[n])
    upflagUpFrontier2 := upflagUpFrontier2 and (high[n+1] <= high[n] and high[n+2] <= high[n] and high[n+i + 2] < high[n])
    upflagUpFrontier3 := upflagUpFrontier3 and (high[n+1] <= high[n] and high[n+2] <= high[n] and high[n+3] <= high[n] and high[n+i + 3] < high[n])
    upflagUpFrontier4 := upflagUpFrontier4 and (high[n+1] <= high[n] and high[n+2] <= high[n] and high[n+3] <= high[n] and high[n+4] <= high[n] and high[n+i + 4] < high[n])
flagUpFrontier = upflagUpFrontier0 or upflagUpFrontier1 or upflagUpFrontier2 or upflagUpFrontier3 or upflagUpFrontier4

upFractal = (upflagDownFrontier and flagUpFrontier)

plotshape(upFractal) //this doens't put the plotshape in the right position, would it be a way to put it without using offset? if you add offset -6 it would be. ```
EN

回答 1

Stack Overflow用户

发布于 2022-10-19 13:24:34

如果不想使用plotshape(),则可以使用label

代码语言:javascript
运行
复制
if (upFractal)
    label.new(bar_index-6, high, "W", yloc = yloc.abovebar)

6酒吧的延迟将永远在那里。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74125877

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档