Discussions
»
Product and Service Development
»
MetaStock
»
Adding indicator - Accumulation / Distribution Line
Rank: Newbie
Groups: Registered, Registered Users Joined: 7/13/2007(UTC) Posts: 2
|
I am new to Metastock. I want to build Accumulation / Distribution Line, however I get an error that the following has occurred: division by zero 397; invalid exponentiation, invalid log; invalid power; modulus by zero; negative square root.
This is what I have as a formula (((C-L) - (H-C)) / (H-L)) * V
Assistance please
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
Itumly
The problem is that the H-L divisor can equal zero, and when it does MetaStock reports the "Division by zero" error. There are several ways to get around the problem and they all revolve around replacing zero with an acceptable value. In practice it doesn't seem to matter what value is substituted for zero. Note that placing a multiplier before the division as I have done usually allows one set of brackets to be removed but it is not a part of the solution.
The following three substitutes all appear to work so take your pick. The first adds 1 to H-L when it is zero, the second replaces H-L with 1 when it is zero, and the third uses the most recent previous value of H-L that is greater than zero.
V * ((C-L) - (H-C)) / ((H-L) + (H-L=0));
V * ((C-L) - (H-C)) / If(H-L=0,1,H-L);
V * ((C-L) - (H-C)) / ValueWhen(1,H-L>0,H-L);
Roy
MetaStock Tips & Tools
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users Joined: 7/13/2007(UTC) Posts: 2
|
Mstt,
Thank you for the reply. It is much appreciated. I will test all three.
Itu.
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Discussions
»
Product and Service Development
»
MetaStock
»
Adding indicator - Accumulation / Distribution Line
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.