Download MetaTrader 5

Libraries: Price_Compare

To add comments, please log in or register
Do you want to deposit to your account? Do this in any convenient way!
Automated-Trading
Admin
99085
Automated-Trading 2016.09.19 12:49 

Price_Compare:

This small cross-platform library allows to compare the 'double' values of the "price" conveniently and quickly.

Author: fxsaber

Alain Verleyen
Moderator
30702
Alain Verleyen 2017.01.26 09:58  
Automated-Trading:

Price_Compare:

Author: fxsaber

Interesting.

#define EPSILON (1.0e-7 + 1.0e-13)
Why is your EPSILON defined as this value ?


fxsaber
4397
fxsaber 2017.01.26 10:29  
Alain Verleyen:

Why is your EPSILON defined as this value ?

I do not remember...

Форум по трейдингу, автоматическим торговым системам и тестированию торговых стратегий

Альтернативные реализации стандартных функций/подходов

fxsaber, 2016.09.02 10:58

double MyNormalizeDouble( const double Value, const uint digits )
{
  static const double Points[] = {1.0e-0, 1.0e-1, 1.0e-2, 1.0e-3, 1.0e-4, 1.0e-5, 1.0e-6, 1.0e-7, 1.0e-8};
  const double point = digits > 8 ? 1.0e-8 : Points[digits];
  const long Integer = (long)Value; // чтобы не создавать крайне медленный относительный epsilon

  return((long)((Value > 0) ? (Value - Integer) / point + HALF_PLUS : (Value - Integer) / point - HALF_PLUS) * point + Integer);
}
To add comments, please log in or register