Hi guys, there’s a scalping strategy on trading view that’s been posted by one of the traders. I’d like to convert this into prorealtime code. The code is pasted below. I would greatly appreciate it if this can be done
//@version=2
// Name: P&F Mex Scalp strat
// Author: Ahsan
// Revision: 0.1
// Date: 11-Jun-2018
strategy(“P&F scalp strat”, shorttitle=”MEXlongOnly_strat”, overlay=true)
timeframe = input(‘3’)
box = input(‘Traditional’)
boxsize = input(25, 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, p1, color=green, transp=70)
fill(p0, p2, color=maroon, 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())