Rank: Newbie
Groups: Registered, Registered Users, Subscribers Joined: 3/21/2011(UTC) Posts: 1
|
I wrote a simple c# program to calculate some indicators including will%R.
The problem is that although i use the correct formula, my results are a bit different from the ones metastock WillR(n) function produces.
i use this formula for calculating willR:
(HHV(H,5) - C) / (HHV(H,5) - LLV(L,5)) * -100
i calculate all components of the formula correctly. i am sure because i checked all of them.
For example for my spesific candlestick the values are like that:
HHV(H,5) : 78.475
C : 78.275
LLV(L,5) : 77.825
So:
my result is (78.475 - 78.275) / (78.475 - 77.825) *-100
= 0.2/0.65 *-100
= 30.769230769230...
but metastock gives me -30.7687
how can i produce exactly the same result as metastock produces?
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers, Unverified Users Joined: 10/28/2004(UTC) Posts: 3,111 Location: Perth, Western Australia
Was thanked: 16 time(s) in 16 post(s)
|
MS uses single digit precision (floats) and these are often rounded/truncated as values get passed around in MS. If you absolutely require higher precision than MS offers then you will require the MDK, noting that even if you are dealing with double precision values outside of MS, these are automagically cast back to floats or singles in MS.
wabbit [:D]
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
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.