Hi Apprentice and team,
Could you please translate this strategy from TradingView to LUA indicator please ?
strategy("P&F scalp strat V3", shorttitle="MEXlongOnly_strat V3", overlay=true)
timeframe = input('3')
box = input('Traditional')
boxsize = input(5, type=float)
reversal = input(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)
fill(p0, p2, color=green, transp=70)
fill(p0, p1, color=maroon, transp=70)
entry() => (base > pnf_close)
exit() => (base > pnf_open)
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())
Thank you in advance,
Yolerap