'how i can use array.set in Pine Script for tradingview indicator

i have a source code of indicator and i want to customize for myself

in this code we define function and arrays:

var float[] _array = array.new_float( i_maxLength, na )
_pivot = ( _prevHigh + _prevLow + _prevClose ) / 3
array.set( _array, 0, _pivot)

R6 Level Formula is:

array.set( _array, 6 + i_maxLevels, (_prevHigh / _prevLow) * (_prevClose) )

this code calculate Resistance Level with Camerilla Methods, but when we want to calculate Support Level 6 we need to Resitance Level 6, The S6 Formula is:

S6 = Close – (R6 – Close)

for calculate S1 to S5 Level we used array:

S1=

array.set( _array, 1, _prevClose - 1.1 * ( _prevHigh - _prevLow ) / 12 )

and S5 is=

array.set( _array, 5,(_prevClose - 1.1 * ( _prevHigh - _prevLow ) / 2 ) - 1.168 * ((_prevClose - 1.1 * ( _prevHigh - _prevLow ) / 4 ) - (_prevClose - 1.1 * ( _prevHigh - _prevLow ) / 2 )))

How can I calculate S6? I didnt know how can use R6 in S6 Formula!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source