0

I'm getting Nan's / na when I try to iterate the candles what am I doing wrong? Also it's giving me the wrong values for high and low?enter image description here Notice SPY is @ 398 but the screen shot shows 440

` //@version=5 indicator("TriangleWaves", "TriangleWaves", true)

// Input options
_candleLen = input(40, "Default Candle Length")
_calcDefLen = input(true, "Auto Calculate Candle Length")

float _cHi=na
float _cLow=na
_counter = 0
_debugText=""
while _counter < _candleLen
    if _counter == 0
        _cHi := high
        _cLow := low
    else
        _cHi := high[_counter]
        _cLow := low[_counter]
    if _counter <= 1
        _debugText:=_debugText + "\n Candle " + str.tostring(_counter) + " _cHi " + str.tostring(_cHi) + " _cLow " + str.tostring(_cLow)
    _counter := _counter+1

runtime.error(_debugText)
if barstate.islast
    myLabel = label.new(x=bar_index + 3, y=close, color=color.blue, textcolor=color.white, style=label.style_label_up, size=size.large)
    myLabel.set_text(_debugText)`

`

I expected the high and low of the candlesticks.

  • Which programming language are you using? Please [edit] your question to edit the tag list to include the programming language. – Progman Mar 21 '23 at 20:27

0 Answers0