/*[[ Name := Wisemen Author := David W. Thomas Link := davidwt@usa.net Notes := This displays as comments the bar info of the last 3 Wisemen and shows there occurrances in a histogram. Notes := The bar info includes the time of the bar, the high and the low. Notes := BE AWARE: the indicator only shows 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. Notes := The histogram uses addition/subtraction of the following values: Notes := +/- 1.0 for Wiseman 1 Notes := +/- 2.0 for Wiseman 2 Notes := +/- 4.0 for Wiseman 3 Notes := In other words it uses the simple OR'ing technique of single bit set values common in programming. Separate Window := Yes First Color := Green First Draw Type := Histogram First Symbol := 217 Use Second Data := Yes Second Color := Red Second Draw Type := Histogram Second Symbol := 218 Minimum Chart Limits := -5.000000 Maximum Chart Limits := 5.000000 ]]*/ 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 begin ws1state = "bull"; SetIndexValue(shift, 1.0); end else begin ws1state = "bear"; SetIndexValue2(shift, -1.0); end; 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]; SetIndexValue(shift, GetIndexValue(shift)+2.0); 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]; SetIndexValue2(shift, GetIndexValue2(shift)-2.0); end; // wiseman 3. if (iFractals(MODE_UPPER, shift) > 0) then begin ws3state = "bull"; ws3t = Time[shift]; ws3h = H[shift]; ws3l = L[shift]; SetIndexValue(shift, GetIndexValue(shift)+4.0); end; if (iFractals(MODE_LOWER, shift) > 0) then begin ws3state = "bear"; ws3t = Time[shift]; ws3h = H[shift]; ws3l = L[shift]; SetIndexValue2(shift, GetIndexValue2(shift)-4.0); end; loopbegin--; End;