/*[[ Name := $donchian_bar Author := Darma thanks to bheurekso for mentoring Link := http://www.darmasdt.com/ Separate Window := No First Color := Blue First Draw Type := Histogram First Symbol := 159 Use Second Data := Yes Second Color := Red Second Draw Type := Histogram Second Symbol := 159 ]]*/ Variable : shift(0); Variable : res(0),sup(0); Variable : jualres(false),belisup(false); SetLoopCount(0); // loop from first bar to current bar (with shift=0) For shift=Bars-Period-1 Downto 0 Begin res=iCustom("$donchian_no",MODE_SECOND,shift); sup=iCustom("$donchian_no",MODE_FIRST,shift); if l[shift]>sup and h[shift]>res then belisup=true else belisup=false; if h[shift]