I have tried to write the underlying code (Pinescript from TradingView) in Prorealcode but i do not succeed.
The problem seems the way you have to have to call the S&P.
The code works like this:
It plots the difference between the asset in the chart corrected by an adaptable factor and the S&P.
Could you adapt this code for Prorealtime?
Regards
Bert Lamoree
//@version=5
indicator(‘Relative Strength’, shorttitle=’RS’, timeframe=”)
comparativeTickerId = input.symbol(‘SPX’, title=’Comparative Symbol’)
factor = input.int(10, minval=1, title=’Period’)
showMA = input(defval=false, title=’Show Moving Average’)
lenghtMA = input.int(10, minval=1, title=’Moving Average Period’)
baseSymbol = request.security(syminfo.tickerid, timeframe.period, close)
comparativeSymbol = request.security(comparativeTickerId, timeframe.period, close)
hline(0, color=color.black, linestyle=hline.style_dotted)
res=baseSymbol*factor-comparativeSymbol
plot(res, title=’RS’, color=color.new(#1155CC, 0))
sma_1 = ta.sma(res, lenghtMA)
plot(showMA ? sma_1 : na, color=color.new(color.gray, 0))