我的想法是,我希望查看未平仓合约数据以及价格图表,以便除了图表模式之外,还可以了解未平仓合约发生的情况。
\n印度 NSE 每天都会提供文件,其中包含所有收盘价和 F&O 数据的摘要,其中包含我想要添加到图表中的内容的详细信息。
\n是否可以编写 Pine 脚本代码来从外部文件读取并沿垂直轴显示此未平仓合约数据,类似于显示交易量概况的方式?
\n实时读取未平仓合约将是最好的方案,但由于 TradingView 没有印度 NSE 的 F&O 数据,甚至显示前一天的数据也能达到目的。
\n我尝试查看 input() 函数,但看起来它要么获取与资产类别相关的直接数据,要么可以与任何计算后导出的数据一起使用。但我无法弄清楚如何使用它来访问来自外部来源。
\n谢谢
\n我想在价格上绘制权益曲线,将该策略与简单的买入并持有进行比较。为了使图表有用,权益曲线可以从初始权益开始,或者与图表上的第一个价格一致,或者根本没有权益曲线,具体取决于手动输入。
使用下面的代码,我得到这个:
第 xx 行:无法在本地范围内使用“plot”。
第 xx 行:无法在本地范围内使用“plot”。
equitycurvetype = input(defval="No", title='Equity Curve Type', options=["No","Yes","Yes same start"])
if equitycurvetype == "Yes"
plot(strategy.equity, title="equity", color=color.red, linewidth=2, style=plot.style_areabr)
if equitycurvetype == "Yes same start"
plot(strategy.equity * close[bar_index]/strategy.initial_capital, title="equity", color=color.red, linewidth=2, style=plot.style_areabr)
Run Code Online (Sandbox Code Playgroud) 我想在每天的某个当地时间(例如 08:00 GMT+1)画一条垂直线。
自从我上一篇关于垂直线的文章以来, pine-script 已更新为包含vline(),但是,这里的问题是获取正确的时间。大多数服务器(针对外汇)似乎都位于美国,并且交易视图本地时间设置(显示在左下角)似乎完全独立于 pine-script 中所做的操作。
//@version=4
study("Time Adjusted Vertical Line", overlay=true)
vline(BarIndex, Color, LineStyle, LineWidth) => // Verticle Line, 54 lines maximum allowable per indicator
return = line.new(BarIndex, -1000, BarIndex, 1000, xloc.bar_index, extend.both, Color, LineStyle, LineWidth)
if(bar_index%10==0.0)
vline(bar_index, #FF8000ff, line.style_solid, 1) // Variable assignment not required
Run Code Online (Sandbox Code Playgroud)
我无法使上述工作正常,但我至少可以显示以下几行:
//@version=4
study(title="Time Based Session Bars", shorttitle="NowOpen", overlay=true)
line_height = 2 // We must define a height that reaches far above the highest price level in main …Run Code Online (Sandbox Code Playgroud) 一个console.log variables或函数结果如何pine-script?我想将pine-script脚本转换成javascript,并且要验证我要转换的脚本与原始脚本相同。如果此功能不存在,欢迎任何解决方法。谢谢!
我想计算简单移动平均线 (SMA) 的斜率。我已经尝试了以下数学上正确的代码。
rad2degree = 180/3.14159265359 //pi
sma2sample = sma(close,50)
slopeD = rad2degree*atan( (sma2sample[0] - nz(sma2sample[1]))/1 )
Run Code Online (Sandbox Code Playgroud)
然而,问题是每只股票的价值不同,所以slopeD价值不是在一个固定的范围内,在[-90 to 90]度数之间。哪个更合乎逻辑。
我相信我需要对日期进行标准化以使这个变量处于固定范围内,但我不知道如何。
我怎样才能规范化的范围slopeD?
我制作了一个自定义交易量指标,但是当应用于图表时,它不会像内置指标那样自动缩放,不会自动粘在图表面板的底部,也不能没有自己明确的额外刻度旁边。
有没有办法让它做所有这些事情?
我在原始指标代码中也没有找到任何帮助。例如,当我尝试应用 format.volume 时,它根本拒绝编译。
下面是我的代码,原始代码在下面:
//This inddicator will show volume inversely. So if you are looking at an Altcoin, it will show volume in BTC, if you are looking at for example BTC/USD it will show volume in USD and so on. Works with all altcoins and fiat pairs.
//I find this most useful when shopping for alts to quickly get an idea of their liquidity.
//title the indicator and dont use decimals. (Otherwise when viewing fiat volume you …Run Code Online (Sandbox Code Playgroud) 我在尝试清理代码时无法确定正确的实现,并且发现了一个似乎适合 For 循环的部分,但是,我收到以下错误:
Cannot use 'plot' in local scope.
Run Code Online (Sandbox Code Playgroud)
当尝试执行以下示例时:
a = 10
b = 5
for i = 1 to b
j = a * i
plot(highest(j), title="Resistance", color=b, linewidth=2, style=plot.style_line, transp=d, offset=-9999, trackprice=true)
Run Code Online (Sandbox Code Playgroud)
我原来的代码如下:
a=10
plot(highest(a*1), title="Resistance", color=color.green, linewidth=2, style=plot.style_line, transp=d, offset=-9999, trackprice=true)
plot(highest(a*2), title="Resistance", color=color.green, linewidth=2, style=plot.style_line, transp=d, offset=-9999, trackprice=true)
plot(highest(a*3), title="Resistance", color=color.green, linewidth=2, style=plot.style_line, transp=d, offset=-9999, trackprice=true)
plot(highest(a*4), title="Resistance", color=color.green, linewidth=2, style=plot.style_line, transp=d, offset=-9999, trackprice=true)
plot(highest(a*5), title="Resistance", color=color.green, linewidth=2, style=plot.style_line, transp=d, offset=-9999, trackprice=true)
Run Code Online (Sandbox Code Playgroud)
我最终希望绘图的数量(b 变量)可以从 0 …
我在用Tradingview Pinescript 4.0.
此消息参考: /sf/ask/4684880441/ Different-tradingview-4-0-indicators-for-the- Purpose-of-crea
基本上,我想做的是Tradingview 4.0 Pinescript Strategies与Tradingview Webhook Alert系统一起使用。
我见过的最接近的提供了如何做到这一点的提示可以在这个特定的视频中找到(针对不同的产品): https://support.mudrex.com/hc/en-us/articles/360050211072-Automating -来自交易策略的警报视图
它会使用类似下面的“评论”:
// Strategy.entry(id=tostring(randomNumber), long=false, comment="{"id" : " + tostring(randomNumber) + ", "action" : "reverse_short_to_long"}")
我需要从策略发送 JSON作为Web 警报的一部分。根据视频,人们会使用类似的东西:
{{ strategy.comment }}
Run Code Online (Sandbox Code Playgroud)
有没有任何可靠的例子来说明如何做到这一点?
在这些网站(https://coinalyze.net/ethereum-classic/liquidations/、BTC/USDT)上,我可以将以下指示添加到 grpah [ , , , , ]中。LiquidationsLong LiquidationsShort LiquidationsAggregated Liquidations COIN-margined ContractsAggregated Liquidations STABLECOIN-margined Contracts
合计清算量=币本位合约清算量+稳定币本位合约折算美元的清算量。目前仅包含 BTC/USD 和 BTC/USDT 合约。查看指标选项,您可以选择/取消选择单个合约。
=> 主要问题是如何获取用于加密货币清算的数据流(如果可能的话)从 Tradingview 或币安等交易所获取。
我尝试在https://www.tradingview.comAggregated liquidations上添加或直接Liquidations添加到期货下的加密货币图表中。我无法找到它的 pine-script 代码或其内置指示器,所以我相信数据是私有的,对我来说是死胡同。
是否可以从类似Binance或其他交易所获取用于加密货币清算的数据流?或者添加Aggregated liquidations到 TradingView 上的加密货币图表中?