/*[[ Name := Wisemen Comments Author := David W. Thomas Link := davidwt@usa.net Notes := This displays as comments the bar info of the last 3 Wisemen. Notes := The bar info includes the time of the bar, the high and the low. Notes := BE AWARE: the comments only show the information of prior bars, current bar is ignored. Notes := This especially affects reporting of Wiseman 2, since it will only show no less than 3 bars ago. Separate Window := No First Color := Blue First Draw Type := Line First Symbol := 217 Use Second Data := No Second Color := Red Second Draw Type := Line Second Symbol := 218 ]]*/ Input : AdditionalFilter(1); Variables : shift(0), prevbars(0), first(True), loopbegin(0), result(0), ao1(0), ao2(0),ao3(0), ao4(0), ao5(0), ws1state("none"), ws1t(0), ws1h(0), ws1l(0), ws2state("none"), ws2t(0), ws2h(0), ws2l(0), ws3state("none"), ws3t(0), ws3h(0), ws3l(0); SetLoopCount(0); // show comment on Wiseman 1. Comment("Wiseman 1: ", ws1state, " @ ", TimeToStr(ws1t), ", high=", ws1h, ", low=", ws1l, " \n", "Wiseman 2: ", ws2state, " @ ", TimeToStr(ws2t), ", high=", ws2h, ", low=", ws2l, " \n", "Wiseman 3: ", ws3state, " @ ", TimeToStr(ws3t), ", high=", ws3h, ", low=", ws3l, " \n"); // check conditions are ok. if Bars < 3 Or Bars = prevbars then exit; // check for additional bars loading or total reloading If Bars < prevbars or Bars-prevbars>1 Then first = True; prevbars = Bars; If first Then Begin // loopbegin prevent counting of counted bars exclude current loopbegin = Bars-30; first = False; End; loopbegin++; // loop from first bar to current bar (with shift=0) For shift=loopbegin Downto 1 Begin // wiseman 1. result = iCustom("Wiseman 1 trinary", AdditionalFilter, MODE_FIRST, shift); if (result != 0) then Begin if (result > 0) then ws1state = "bull" else ws1state = "bear"; ws1t = Time[shift]; ws1h = H[shift]; ws1l = L[shift]; End; // wiseman 2. ao1 = iAO(shift); ao2 = iAO(shift+1); ao3 = iAO(shift+2); ao4 = iAO(shift+3); ao5 = iAO(shift+4); // direction is either not determined yet or it is going up and AO bar 4 is the valley low. if ((ao5 > ao4) and (ao4 < ao3) and (ao3 < ao2) and (ao2 < ao1)) then begin ws2state = "bull"; ws2t = Time[shift]; ws2h = H[shift]; ws2l = L[shift]; end else // direction is either not determined yet or it is going down and AO bar 4 is the mountain peak. if ((ao5 < ao4) and (ao4 > ao3) and (ao3 > ao2) and (ao2 > ao1)) then begin ws2state = "bear"; ws2t = Time[shift]; ws2h = H[shift]; ws2l = L[shift]; end; // wiseman 3. if (iFractals(MODE_UPPER, shift) > 0) then begin ws3state = "bull"; ws3t = Time[shift]; ws3h = H[shift]; ws3l = L[shift]; end; if (iFractals(MODE_LOWER, shift) > 0) then begin ws3state = "bear"; ws3t = Time[shift]; ws3h = H[shift]; ws3l = L[shift]; end; loopbegin--; SetIndexValue(shift, 0); End;