var PHlist = array.new_float(3,PH0) var PLlist = array.new_float(3,PL0) var indexH = array.new_int(3,bar_index) var indexL = array.new_int(3,bar_index)
if phset == true array.push(PHlist,PH0) array.remove(PHlist,0) array.push(indexH,bar_index) array.remove(indexH,0) if plset == true array.push(PLlist,PL0) array.remove(PLlist,0) array.push(indexL,bar_index) array.remove(indexL,0)
DT = time - time[1] var label h1 = na label.delete (h1) h1 := label.new(PH1index-20 ,highest(high,30),xloc=xloc.bar_index ,yloc=yloc.price ,color=color.lime, style=label.style_label_down) label.set_text(h1,tostring(PHlist)) var label h2 = na label.delete (h2) h2 := label.new(PL1index-20 ,lowest(low,30),xloc=xloc.bar_index ,yloc=yloc.price ,color=color.aqua, style=label.style_label_up) label.set_text(h2,tostring(PLlist))
H_head = PH_1 < HH and PH_2 < HH and PH_1*1000 < PH_2*(1000 + PCount) and PH_1*1000 > PH_2*(1000 - PCount) and plset == true and (HH - atr * BCount *0.1) > PH_2 L_head = PL_1 > LL and PL_2 > LL and PL_1*1000 < PL_2*(1000 + PCount) and PL_1*1000 > PL_2*(1000 - PCount) and phset == true and (LL + atr * BCount*0.1) < PL_2
if H_head var line line1 = na line.delete(line1) line1 := line.new(PH1index, PH_1, HHindex, HH, extend=extend.none, width=3, color=color.blue) var line line2 = na line.delete(line2) line2 := line.new(HHindex, HH, PH2index, PH_2, extend=extend.none, width=3, color=color.blue)
if L_head var line line3 = na line.delete(line3) line3 := line.new(PL1index, PL_1, LLindex, LL, extend=extend.none, width=3, color=color.orange) var line line4 = na line.delete(line4) line4 := line.new(LLindex, LL, PL2index, PL_2, extend=extend.none, width=3, color=color.orange)
プログラミングなんかやったこともないが、NA0TAさんの記事読んでるとシステムトレード学びたくなってくる。