【发布时间】: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