我想画出前几天的所有高点和低点,直到股票开始

问题描述 投票:0回答:1

我想画出任务开始前所有天的高潮和低谷。我尝试了如何用python编写...但这不起作用。帮助我如何动态绘制所有这些线而无需手动编写]

//@version=4
study("My Script", overlay=true)
y = 0
for i = 0 to 10
       y := y + 1
    hh := floor(security(tickerid, "D", high[y]))+0
    ll := ceil(security(tickerid, "D", low[y]))+0
    plot(hh, style=plot.style_line, title="Resistance Line", color=color.blue, show_last=1, linewidth=2, trackprice=true)
    plot(ll, style=plot.style_line, title="Resistance Line", color=color.blue, show_last=1, linewidth=2, trackprice=true)```
pine-script stock trading metatrader4 tradingview-api
1个回答
0
投票

此功能有一个内置指示器,称为Donchian Channels。我给我我的自定义版本,使您可以分别设置高点和低点的周期(柱线数)。

//@version=4
study(title = "Donchian Channels", shorttitle = "DC", overlay = true)

Ulen = input(90, title = "Upper Channel", type = input.integer, minval = 3)
Llen = input(7, title = "Lower Channel", type = input.integer, minval = 3)

upper = highest(high, Ulen)
lower = lowest(low, Llen)
median = avg(upper, lower)

plot(upper, title = "Upper Channel", color = color.new(#4caf50, 0), linewidth = 2)
plot(lower, title = "Lower Channel", color = color.new(#f44336, 0), linewidth = 2)
plot(median, title = "Median", color = color.new(#ff9800, 0), linewidth = 2)
© www.soinside.com 2019 - 2024. All rights reserved.