昨天我试图创建一个指标,该指标在H1蜡烛中创建一条短线。
类似TradingView上的标准枢轴点。
示例:
答案 0 :(得分:0)
我有一些枢轴点的实现,可以画一些线。也许这并不是您所要的,但我希望它将对您有帮助:
//@version=3
study("Pivot Points, Traditional (today)", overlay=true)
daylyClose = security(tickerid, "D", close)
daylyHigh = security(tickerid, "D", high)
daylyLow = security(tickerid, "D", low)
pivot = (daylyClose + daylyHigh + daylyLow) / 3
r1 = pivot * 2 - daylyLow
r2 = pivot + (daylyHigh - daylyLow)
r3 = pivot * 2 + (daylyHigh - 2 * daylyLow)
r4 = pivot * 3 + (daylyHigh - 3 * daylyLow)
r5 = pivot * 4 + (daylyHigh - 4 * daylyLow)
s1 = pivot * 2 - daylyHigh
s2 = pivot - (daylyHigh - daylyLow)
s3 = pivot * 2 - (2 * daylyHigh - daylyLow)
s4 = pivot * 3 - (3 * daylyHigh - daylyLow)
s5 = pivot * 4 - (4 * daylyHigh - daylyLow)
plot(pivot, style= stepline)
plot(r1, style= stepline)
plot(r2, style= stepline)
plot(r3, style= stepline)
plot(r4, style= stepline)
plot(r5, style= stepline)
plot(s1, style= stepline)
plot(s2, style= stepline)
plot(s3, style= stepline)
plot(s4, style= stepline)
plot(s5, style= stepline)
注1:我的脚本适用于日内解析-在日解析上,它每天都会更改。
注2:这仅适用于现有的柱形-历史和实时。它无法为将来划清界限。
答案 1 :(得分:0)
您还可以使用Compiling and linking the model (Visual C++).
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.9.11
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x86'
"Testing 32-bit compilation"
dsmodel.c
dsmodel.c(1): fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory
Error generating Dymosim.
函数并将颜色更改为Compiling and linking the model (Visual C++).
ERROR: Cannot determine the location of the VS Common Tools folder.
"Testing 32-bit compilation"
'cl' is not recognized as an internal or external command,
operable program or batch file.
Error generating Dymosim.
(以“隐藏”绘制的线条)来绘制较短的水平线
plot()
na
查看//@version=2
study("Horizontal line", overlay=false)
counter = nz(counter[1]) == 6 ? 0 : nz(counter[1]) + 1
line_color = counter < 5 ? orange : na
plot(10, color=line_color)
系列的前一个值(后退1个步骤),如果不存在{的前一个值,则nz(counter[1])
函数返回counter
{1}}(例如在市场开始时)
您可以通过将nz()
的{{1}}参数更改为0.0
将其覆盖在蜡烛图上。
在某些情况下,这很好,但不幸的是,如果将线的值设置为counter
或overlay
,则会导致自动缩放的问题,因为绘制的线仍然存在,即使它是不可见的。我通常将值设置为study()
或true
来解决此问题。