我想在电视排行榜上画一条线,代表一个季度一个季度给定公司的收益。我自己输入每家公司的收入值没有问题,但是需要一些帮助来创建该行,输入内容是季度收益发布和相关的收益数字。想法是使收益线本身在图表上并具有自己的比例,就像在激活“覆盖主图表”选项时使用“比较->添加符号”时一样。这样做的目的是观察收益随着时间的增长(或缺乏),并观察其如何指导股价。
答案 0 :(得分:1)
这显示了季度收益,估计和股息。它将以比例尺 None 覆盖,因此它独立于图表的比例尺。
//@version=4
// Unsupported security call feature. No guarantee it will work in the future.
study("Earnings", "", true, scale = scale.none)
earnings = security("ESD:" + syminfo.prefix + "_" + syminfo.ticker + "_EARNINGS", "3M", close[1], lookahead = barmerge.lookahead_on)
estimate = security("ESD:" + syminfo.prefix + "_" + syminfo.ticker + "_EARNINGS", "3M", open[1], lookahead = barmerge.lookahead_on)
dividends = security("ESD:" + syminfo.prefix + "_" + syminfo.ticker + "_DIVIDENDS", "3M", close[1], lookahead = barmerge.lookahead_on)
plot(earnings, "Earnings")
plot(estimate, "Estimate", transp = 75)
plot(dividends, "Dividends", color.orange)
[EDIT 2019.09.03 12:29 — LucF] 现在所有线路都已连接。如果您希望返回阶梯效果,请遵循代码中的注释。我在宿舍上加了点。您可以通过取消选中脚本的 Settings / Inputs 中的复选框来删除它们。
//@version=4
// Unsupported security call feature. No guarantee it will work in the future.
study("Earnings", "", true, scale = scale.none)
plotDots = input(true, "Plot dots")
// In order to plot in staircases instead, use "gaps = barmerge.gaps_off".
earnings = security("ESD:" + syminfo.prefix + "_" + syminfo.ticker + "_EARNINGS", "3M", close[1], gaps = barmerge.gaps_on, lookahead = barmerge.lookahead_on)
estimate = security("ESD:" + syminfo.prefix + "_" + syminfo.ticker + "_EARNINGS", "3M", open[1], gaps = barmerge.gaps_on, lookahead = barmerge.lookahead_on)
dividends = security("ESD:" + syminfo.prefix + "_" + syminfo.ticker + "_DIVIDENDS", "3M", close[1], gaps = barmerge.gaps_on, lookahead = barmerge.lookahead_on)
// Plot lines.
plot(earnings, "Earnings")
plot(estimate, "Estimate", transp = 75)
plot(dividends, "Dividends", color.orange)
// Plot dots.
plot(plotDots ? earnings : na, "Earnings", style = plot.style_circles, linewidth = 3)
plot(plotDots ? estimate : na, "Estimate", transp = 75, style = plot.style_circles, linewidth = 3)
plot(plotDots ? dividends : na, "Dividends", color.orange, style = plot.style_circles, linewidth = 3)