aref razavi
aref razavi

Reputation: 422

pine script how to save multiple data of particular bar for compare in future?

I want to save high, low, open, close and one another value of a particular bar when a condition happened.

and next I want to compare that with current bar and calculate the distance to that point.

how can I save 5 float value in 2D array or something like that?

and how can I get the distance ?

thanks in advance

Upvotes: 0

Views: 328

Answers (1)

madness
madness

Reputation: 11

you can do this

var arrayname = array.new_float(0)
if condition 
    array.push(arrayname, high)
if barstate.islast 
    for i = 0 to array.size(arrayname) - 1
        compare block 

you can declare other arrays for open, close, and low and compare them with the last candle data

Upvotes: 1

Related Questions