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

RE: [amibroker] Percent - Math 101?



PureBytes Links

Trading Reference Links

If a is the start value and b is the end value then you could use

Percent Change = (b-a) / a

If the change is a decrease the answer is negative. If the change is an increase the answer is positive.

If you don't want to know the direction of the change you can get rid of itby squaring and then taking the square root.

Percent change = SQRT( (b-a)(b-a) ) / a


Original Message:
-----------------
From: tpresley@xxxx
Date: Wed, 07 Mar 2001 21:47:26 -0000
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Percent - Math 101?


<html><body>
<tt>
Maybe I'm forgetting my grade school math here, but is there an <BR>
easier way to calculate the percentage difference between two numbers?<BR>
<BR>
If I have two numbers, say:<BR>
<BR>
5, 7<BR>
<BR>
To calculate percentage I take the smaller and divide by the larger:<BR>
<BR>
5/7 = .7142857<BR>
<BR>
Then subract 1 = -.2857143<BR>
Get rid of the - sign and have .2857143 percent<BR>
<BR>
Problem is this assumes I know which is smaller and which is larger. <BR>
Reversing the numbers doesn't work, i.e., 7/5 doesn't work at all. So <BR>
I have this AFL formula:<BR>
<BR>
daypercent = iif(close > ref(close,-1), ref(close,-1) / close, <BR>
close / ref(close, -1));<BR>
<BR>
Isn't there an easier math technique to figure the percentage between <BR>
2 numbers regardless of which is larger?<BR>
<BR>
</tt>

<br>

<!-- |**|begin egp html banner|**| -->

<table border=0 cellspacing=0 cellpadding=2>
<tr bgcolor=#FFFFCC>
<td align=center><font size="-1" color=#003399><b>Yahoo! Groups Sponsor</b></font></td>
</tr>
<tr bgcolor=#FFFFFF>
<td width=470><br>Click Here to Find Software Faster</td>
</tr>
<tr><td><img alt="" width=1 height=1 src="http://us.adserver.yahoo.com/l?M=162801.1342103.2934627/D=egroupmail/S=1700007389:N/A=599088/rand=796413445";></td></tr>
</table>

<!-- |**|end egp html banner|**| -->



<br>
<tt>Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service</tt>
</br>

</body></html>

--------------------------------------------------------------------
Mail2Web - Check your email from the web at
http://www.mail2web.com/ .