this is my first pine script…
- I enter var int array for pivotHigh.
- then I enter the function for ‘ph’.
- I entered the total size for the pivot height.
- I make a line for pivot height.
- I make if crossover price with the first, second and so on pivot high until the 5th pivot high.
I have entered ‘r1 = pivH.get(0).p and changed it to ta.crossover… there is still an error…
<`
var piv[] pivH = array.new<piv>()
r_size = 0
ph = ta.pivothigh(HH_source , 3, 1)
if time > chart.left_visible_bar_time
if time <= chart.right_visible_bar_time
if not na(ph)
for i = pivH.size() -1 to 0
get = pivH.get(i)
if ph >= get.p
pivH.remove(i)
pivH.unshift(piv.new(n -1, ph))
if barstate.islastconfirmedhistory
for i = 0 to pivH.size() -1
if i < 5
r_size := r_size + 1
line.new(pivH.get(i).b, pivH.get(i).p, n +8, pivH.get(i).p , color = color.red)
//Alert Function…
if r_size > 0 and r_size <= 1
if ta.crossover(close , pivH.get(0).p)
alert(message = "price: " + str.tostring(close) + ", vol: " + str.tostring(volume) + ", Resistant Breakout (" + str.tostring(pivH.get(0).p) + ")" , freq = alert.freq_once_per_bar)
if ta.crossunder(close , pivH.get(0).p)
alert("price: " + str.tostring(close) + ", vol: " + str.tostring(volume) + ", Resistant Reject (" + str.tostring(pivH.get(0).p) + ") = " + str.tostring(pivH.get(0).p - close) , alert.freq_once_per_bar)
if r_size > 1 and r_size <= 2
if ta.crossover(close , pivH.get(0).p)
alert(message = "price: " + str.tostring(close) + ", vol: " + str.tostring(volume) + ", Resistant Breakout (" + str.tostring(pivH.get(0).p) + ")" , freq = alert.freq_once_per_bar)
if ta.crossunder(close , pivH.get(0).p)
alert("price: " + str.tostring(close) + ", vol: " + str.tostring(volume) + ", Resistant Reject (" + str.tostring(pivH.get(0).p) + ") = " + str.tostring(pivH.get(0).p - close) , alert.freq_once_per_bar)
if ta.crossover( close > pivH.get(1).p)
alert(message = "price: " + str.tostring(close) + ", vol: " + str.tostring(volume) + ", Resistant Breakout (" + str.tostring(pivH.get(1).p) + ")" , freq = alert.freq_once_per_bar)
if ta.crossunder( close < pivH.get(1).p)
alert("price: " + str.tostring(close) + ", vol: " + str.tostring(volume) + ", Resistant Reject (" + str.tostring(pivH.get(1).p) + ") = " + str.tostring(pivH.get(1).p - close) , alert.freq_once_per_bar)
`>