[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Counting Highs



PureBytes Links

Trading Reference Links

Hi Mike,

MK> If HH20Day <> 0 Then
MK> HH20Day = HH20Day + 1 ;

   This  statement  is  counting all of your days because on
   your  first  HH20day you make this variable equal to one,
   then  on  every  subsequent  bar,  because  it's  =  1 or
   greater,  you  are  incrementing  it.  So, it is counting
   bars rather than HH20days.
   
MK> If MarketPosition=0 and high=highest(h,20) then
MK> HH20day=1;

   Try this:

Vars:    MP(0); {MarketPosition}
         HH20Day(0);

MP = MarketPosition; {or I_Marketposition if not a Signal}

If (MP=0 AND MP[1]<>0) OR MP<>0 then HH20Day=0;
   {This  clears  your counter when you go flat or while you
   are in a trade}
   
If High=Highest(High,20) then HH20Day = HH20Day + 1;
   {starting  at zero when you go flat, this increments by 1
   every time you get a new 20 day high}


-- 
 Dave Nadeau
 Fort Collins, CO