Sure - please do follow the NormalizeDouble() recommendation, may not be apparent at first but I have hit subtle bugs when it was omitted.
Good luck with you trading and ongoing coding
I am unfamiliar with NormalizeDouble().. how would I use that in the code? I didn't notice it in your adjustments. Will the win_ratio code work?
double win_ratio = (TesterStatistics(STAT_PROFIT_TRADES) / TesterStatistics(STAT_LOSS_TRADES))
Dividing an enum by an enum like that? It feels off, but that's the best way I could think it up.
Now I'm worried about that NormalizeDouble() comment. And Thanks! I appreciate your help!
double win_ratio = (TesterStatistics(STAT_PROFIT_TRADES) / TesterStatistics(STAT_LOSS_TRADES));
This explanation confused me further:
Yes this works - normalizes to 4 decimal places
if(NormalizeDouble(balance, 1) > NormalizeDouble(0.0, 1) ) //Recommendation (example only of 1 decimal place) - apply to all double comparisons
Best to do this every time you compare doubles
Actually this is not dividing an enum - the TesterStatistics() receives an enum but returns a double
Actually this is not dividing an enum - the TesterStatistics() returns a double
Do the Enums need to be normalized? Or can they remain floating?
No Enums are integers.
Only doubles, floats, i.e. all fractional numbers need to have accuracy applied when comparing
So this isn't overkill?
double min_dd = (TesterStatistics(STAT_EQUITY_DD) + TesterStatistics(STAT_BALANCE_DD) / 2);
if(NormalizeDouble(min_dd, 4) > NormalizeDouble(0.0, 1) )
NormalizeDouble(min_dd, 4) = (NormalizeDouble(1.0, 1) / NormalizeDouble(min_dd, 4) );
No I think it's good. Maybe you could normalize it once and then compare, but personally I prefer leave the numbers as is, and to normalize with every comparison to avoid bugs like I had in the past.
Also in different situations you may like to use different numbers of decimal places, so you can choose that at comparison time if you leave the number as is
No I think it's good. Maybe you could normalize it once and then compare, but personally I prefer to normalize with every comparison to avoid bugs like I had in the past
I guess that answers my last reply. LOL. Thanks again. I'm normalizing the crud out of it now. I've revised this EA soooo many times. On the market, it's like 2.6, but on my computer it's well over 20-30. I think it's 2.9.5 or something.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.