I have a script and its code is simple:
theHigh = high
theLow = low
theOpen = open
theClose = close
[PDH,PDL,PDO,PDC] = request.security(syminfo.tickerid, “D”, [theHigh[1], theLow[1], theOpen[1], theClose[1]])
However, if I change my chart type to, let’s say, renko, then PD levels are incorrect.
Is there any way I can calculate the data based off and only off candlesticks no matter what the chart type is?
You can create a new ticker id with ticker.standard
and then pass it to the security()
function. This way it would always get data from the standard candlestick chart.
ticker.standard
Creates a ticker to request data from a standard chart that is unaffected > by modifiers like extended session, dividend adjustment, currency conversion, and the calculations of non-standard chart types: Heikin Ashi, Renko, etc. Among other things, this makes it possible to retrieve standard chart values when the script is running on a non-standard chart.ticker.standard(symbol) → simple string
tick_standard = ticker.standard(syminfo.tickerid)
[PDH,PDL,PDO,PDC] = request.security(tick_standard, “D”, [theHigh[1], theLow[1], theOpen[1], theClose[1]])
For the non-standard charts you can read this.