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

Re: Intraday Intensity



PureBytes Links

Trading Reference Links

As list maintainer Jimo says.... always, always, always check for divide
by zero. Every denominator. Every time. Unfortunately, the rocket
scientists who wrote TS6 removed the divide by zero checks from many of
the canned functions so you can't even trust them any more. You should
check the code of any function you use and rewrite if necessary. Anyway
to the issue at hand.

>  Correct example:
> 
>  Value1 = IFF(H - L <> 0, (C - O) / (H - L), 1)

That's one way to do it. Personally, I seldom use IFF statements and
prefer If, Then, Else logic. I also like to define a variable for most
subcalcs so I can reuse the numbers in the code without calculating them
again. I give the vars logical names so the code makes some sense when I
read it.

> {Intraday Intensity, 21-Day Normalized II Oscillator}
> 
> Input: Length(21);
> 
> Value1 = Average( 2*Close - High - Low / (High - Low)*Volume, Length) /
> Average(Volume, Length)*100;
> 
> Plot1(Value1, "II%");

Hmmmm, I'm going to read between the lines on what should be in the
numerator and what should be in the denominator. You need to be careful
tacking a multiplication on the end of a division. Use parens to make it
crystal clear what gets multiplied by what.

{unverified, just quickly typed into the email}
{Intraday Intensity, 21-Day Normalized II Oscillator}

Input: Length(21);
Var: DayRange(0), DayMove(0), MoveStren(0), StrenAve(0), VolAve(0),
     II(0);

DayRange = High - Low;
DayMove = 2*Close - High - Low;
If DayRange <> 0
 {reorder, vol * num, not vol * denom}
  then MoveStren = Volume * DayMove / DayRange
  else MoveStren = 0;
StrenAve = Average (MoveStren, Length);
VolAve = Average (Volume, Length);
{reorder, 100 * num, not 100 * denom}
If VolAve <> 0 
  then II = 100 * StrenAve / VolAve
  else II = 0;

Plot1(II, "II%");

-- 
  Dennis