/*[[ Name := gann-trend-medium Author := Copyright © 2005, Nick Bilak Link := Separate Window := No First Color := yellow First Draw Type := Line Use Second Data := Yes Second Color := yellow Second Draw Type := Line ]]*/ Variables : depth(12),i(0),startBar(0),hiBar(0),loBar(0),firstRun(true),s(0); SetLoopCount(0); if firstRun then { i = Bars-depth-1; loBar=Lowest(MODE_LOW,i+depth-1,depth); hiBar=Highest(MODE_LOW,i+depth-1,depth); if loBar>hiBar then { startBar=hiBar; SetIndexValue(startBar,H[startBar]); SetIndexValue2(startBar,H[startBar]); } else { startBar=loBar; SetIndexValue(startBar,L[startBar]); SetIndexValue2(startBar,L[startBar]); }; firstRun=false; }; s=1; startbar=startbar-2; startbar++; for i = startBar downto 0 { if h[i]l[i+1] then { // skip inside bars s++; } else { if h[i]>h[i+s] and l[i]o[i] then { SetIndexValue(i,H[i]); SetIndexValue2(i,L[i]); s=1; } else { SetIndexValue(i,L[i]); SetIndexValue2(i,H[i]); s=1; } } else { if h[i]>h[i+s] and l[i]>l[i+s] then { //2 up bars SetIndexValue(i,H[i]); SetIndexValue2(i,H[i]); s=1; }; if l[i]