Hi Guys, i need some help regarding formulas used in Forex statistics. I am trying to make some sense from formulas and results from myfxbook. But so far i have been able o get only half the result.
If someone knows something about forex statistics and how to calculate a couple of forex formulas which i need, that would help a lot.
And also please recheck my formulas
I'll use pseudo language for better understanding.
explanation: sqrt - square root
sum - sum of elements (element 1 + element 2 +...+ element n);
count - count of all specific elements
pow - expression with power of 2 *100 - for the results needed in percents, I multiply result with 100
N - count of all transactions
Data that match with myfxbook:
1. Standard deviation = ( sqrt( (sum( pow(profit-mean) ) )/N )
2. HPR (Holding Period Return) = for each transaction I made calculation as (balance+profit)/balance
not sure if this is correct, but since ahpr result matches with myfxbook I assume that hpr is correct (which doesn't mean that I'm right)
3. AHPR (Arithmetical Holding Return Period) = ( sum(hpr) / count(hpr)-1 )*100
Data that does not match with myfxbook
1. GHPR (Geometric Holding Period return) = ( (balance+profit)/balance )^(1/N)
2. Sharpe Ratio = Besides Z-score biggest problem was calculating sharpe ratio. The problem occures with input parameters for mathematical formula.
I used this one: Sharpe Ratio=(AHPR-(1+RFR))/SD
where: AHPR - average holding period returns;
RFR - risk-free rate;
SD - standard deviation.
I found this data at http://articles.mql4.com/471
RFR is the input that I couldn't figure it out.
3. Z-score = This one gave me biggest headache. I used formula from the same page as for Sharpe Ratio:
Z=(N*(R-0.5)-P)/((P*(P-N))/(N-1))^(1/2)
N - total amount of trades in a series;
R - total amount of series of profitable and losing trades;
P = 2*W*L;
W - total amount of profitable trades in the series;
L - total amount of losing trades in the series.
At first the idea was that two or more consecutive trades in the same sign (+ or -) creates series. Than when the result didn't match, I added zeros in calculation, first I counted them as positive trades, than as negative, than I tried to expand condition for series on three or more consecutive trades to create series, after that four or more....
No matter what I tried, nothing has given me the same result as one on myfxbook.
4. Profit Factor = This one should be simple, sum (positive profits) / sum(negative profits)
Then result which I got was not so much different from myfxbook, but again it was not the same...
5. Expectancy = I never figure it out how this one works. I did use formula for mathematical expectancy, but it turned out that I needed some other formulas to calculate expectancy in money and pips
6. Gain = This one really got on my nerves, it's simple profit in percentage (gain). I calculated gain for every transaction on my account and created sum of all those gains and the result was still incorrect. It was almost the same, but it's not.
7. Gain calculations for specific periods = As one on myfxbook I wanted to calculate my gain for specific time span, used the same method as for all time gains, and the results are not even close. I guess that all mygain calcuations I used were not correct.
8. ROI = I never figure it out how to calculate ROI for specific time frame: monthly weekly or from the time i have began to trade
If someone knows something about forex statistics and how to calculate a couple of forex formulas which i need, that would help a lot.
And also please recheck my formulas
I'll use pseudo language for better understanding.
explanation: sqrt - square root
sum - sum of elements (element 1 + element 2 +...+ element n);
count - count of all specific elements
pow - expression with power of 2 *100 - for the results needed in percents, I multiply result with 100
N - count of all transactions
Data that match with myfxbook:
1. Standard deviation = ( sqrt( (sum( pow(profit-mean) ) )/N )
2. HPR (Holding Period Return) = for each transaction I made calculation as (balance+profit)/balance
not sure if this is correct, but since ahpr result matches with myfxbook I assume that hpr is correct (which doesn't mean that I'm right)
3. AHPR (Arithmetical Holding Return Period) = ( sum(hpr) / count(hpr)-1 )*100
Data that does not match with myfxbook
1. GHPR (Geometric Holding Period return) = ( (balance+profit)/balance )^(1/N)
2. Sharpe Ratio = Besides Z-score biggest problem was calculating sharpe ratio. The problem occures with input parameters for mathematical formula.
I used this one: Sharpe Ratio=(AHPR-(1+RFR))/SD
where: AHPR - average holding period returns;
RFR - risk-free rate;
SD - standard deviation.
I found this data at http://articles.mql4.com/471
RFR is the input that I couldn't figure it out.
3. Z-score = This one gave me biggest headache. I used formula from the same page as for Sharpe Ratio:
Z=(N*(R-0.5)-P)/((P*(P-N))/(N-1))^(1/2)
N - total amount of trades in a series;
R - total amount of series of profitable and losing trades;
P = 2*W*L;
W - total amount of profitable trades in the series;
L - total amount of losing trades in the series.
At first the idea was that two or more consecutive trades in the same sign (+ or -) creates series. Than when the result didn't match, I added zeros in calculation, first I counted them as positive trades, than as negative, than I tried to expand condition for series on three or more consecutive trades to create series, after that four or more....
No matter what I tried, nothing has given me the same result as one on myfxbook.
4. Profit Factor = This one should be simple, sum (positive profits) / sum(negative profits)
Then result which I got was not so much different from myfxbook, but again it was not the same...
5. Expectancy = I never figure it out how this one works. I did use formula for mathematical expectancy, but it turned out that I needed some other formulas to calculate expectancy in money and pips
6. Gain = This one really got on my nerves, it's simple profit in percentage (gain). I calculated gain for every transaction on my account and created sum of all those gains and the result was still incorrect. It was almost the same, but it's not.
7. Gain calculations for specific periods = As one on myfxbook I wanted to calculate my gain for specific time span, used the same method as for all time gains, and the results are not even close. I guess that all mygain calcuations I used were not correct.
8. ROI = I never figure it out how to calculate ROI for specific time frame: monthly weekly or from the time i have began to trade