【问题标题】:How can get version@4 of this scripts with same result of version@2如何获得与版本@2 相同结果的此脚本的版本@4
【发布时间】:2021-08-24 07:12:22
【问题描述】:

strategy("P&F头皮层", shorttitle="MEXlongOnly_strat", overlay=true)

时间范围 = 输入('1')

box = input('繁体')

boxsize = input(1, type=float)

反转 = 输入(1)

pnf = pointfigure(tickerid, 'close', box, boxsize, reversal)

pnf_open= security(pnf, timeframe , open)

pnf_close= security(pnf, timeframe , close)

p1 = plot(pnf_open, title="pnf_open", color=green)

p2 = plot(pnf_close, title="pnf_close",color=maroon)

base = pnf_close> pnf_open? pnf_close: pnf_open

p0 = plot(base, title="base", color=gray)

填充(p0, p1, color=green, transp=70)

填充(p0,p2,颜色=栗色,transp=70)

entry() => (base > pnf_open)

exit() => (base > pnf_close)

alertcondition(entry(), title='buy', message='buy!')

alertcondition(exit(), title='sell', message='sell!')

strategy.risk.allow_entry_in(strategy.direction.long)

strategy.entry("Long", long=true, when=entry())

strategy.entry("close", false, when=exit())

【问题讨论】:

    标签: pine-script


    【解决方案1】:

    为了清楚起见,请在发布代码时以代码块的形式发布。

    要更改脚本,请添加版本号并根据需要进行更改。本迁移指南应该会有所帮助。最简单的方法是按顺序进行,按顺序调试。本指南涵盖了从版本 2 到版本 3 的更改,请考虑在适当的时候使用 var 关键字,对于其他更详细的更改,请转到发行说明页面并尝试搜索任何给您带来麻烦的内容。

    https://www.tradingview.com/pine-script-docs/en/v4/appendix/Pine_version_3_migration_guide.html?highlight=converting

    【讨论】:

      猜你喜欢
      • 2018-10-12
      • 1970-01-01
      • 2019-06-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-11
      • 2011-10-19
      • 2010-11-11
      相关资源
      最近更新 更多