Errors, bugs, questions - page 717

 
sergeev:
curwords = NULL
why then Print("next======",curwords.m_next!=NULL); does it not throw an error?
 
fellow:
why doesn't Print("next======",curwords.m_next!=NULL); throw an error?

because

curwords.m_next!=NULL


Do you zero references when creating objects?

It's not NULL when creating it.

The developers have given you the CheckPointer function.

 
MoneyJinn:
The element with index 0 is deleted, while the most recent element of the array should be deleted, i.e. with index (n-1), where n is the size of the array.
Wait. First, you wrote"ArrayResize() error when array size is reduced when ArraySetAsSeries() = true". That is, you had the most "fresh" element had an index of 0. Is this correct?
 

reset

int OnInit()
{
firstwords.m_next=NULL; firstwords.m_prev=NULL;

result is the same

try it yourself

 
fellow:

try it yourself

why should i try it :)

it works fine for me :))

 

Icons can be set up and displayed as required.

The terminal writes to the User folder. I specify the /portable key in the shortcut.

 
fellow:

reset

int OnInit()
{
firstwords.m_next=NULL; firstwords.m_prev=NULL;

result is the same

try it yourself.

Please write to servicedesk. Specify OS, bit rate and build of the terminal. Please attach the source code on which the problem is reproduced continuously - let's deal with it.

Общайтесь с разработчиками через Сервисдеск!
Общайтесь с разработчиками через Сервисдеск!
  • www.mql5.com
Ваше сообщение сразу станет доступно нашим отделам тестирования, технической поддержки и разработчикам торговой платформы.
 
Yedelkin:

OK. Then I'll take the nerve. So, the description of the Print() function says that "data of the double type are printed with the precision of 16 decimal digits after the point". In fact, it turns out that the Print() function outputs somewhat rounded data:

ND 0 victorg2 (EURUSD,M1) 11:04:42 Print(b)=200.0
MP 0 victorg2 (EURUSD,M1) 11:04:42 Print(DoubleToString(b,16))=199.999999999999999716

Thanks for bringing up the topic, a new, more complete example for the Print function has been added to the help:

Example:

void OnStart()
  {
//--- выведем DBL_MAX с помощью Print(), это равносильно PrintFormat(%%.16G,DBL_MAX)
   Print("---- как выглядит DBL_MAX -----");
   Print("Print(DBL_MAX)=",DBL_MAX);
//--- теперь выведем число DBL_MAX с помощью PrintFormat()
   PrintFormat("PrintFormat(%%.16G,DBL_MAX)=%.16G",DBL_MAX);
//--- Вывод в журнал "Эксперты"
// Print(DBL_MAX)=1.797693134862316e+308
// PrintFormat(%.16G,DBL_MAX)=1.797693134862316E+308
 
//--- посмотрим как выводится тип float
   float c=(float)M_PI; // нужно явно приводить к целевому типу
   Print("c=",c, "    Pi=",M_PI, "    (float)M_PI=",(float)M_PI);
// c=3.14159    Pi=3.141592653589793    (float)M_PI=3.14159
   
//--- покажем, что может произойти при арифметических операциях над вещественными типами
   double a=7,b=200;
   Print("---- перед арифметическими операциями");
   Print("a=",a,"   b=",b);
   Print("Print(DoubleToString(b,16))=",DoubleToString(b,16));
//--- разделим a на b (7/200)
   a=a/b;
//--- теперь как будто восстановим значение в переменной b
   b=7.0/a; // ожидается, что b=7.0/(7.0/200.0)=>7.0/7.0*200.0=200 - но это не так
//--- выведем вновь вычисленное значение b
   Print("----- после арифметических операций");
   Print("Print(b)=",b);
   Print("Print(DoubleToString(b,16))=",DoubleToString(b,16));
//--- вывод в журнал "Эксперты"
// Print(b)=200.0
// Print(DoubleToString(b,16))=199.9999999999999716 (видим, что на самом деле b уже не равно 200.0)   
 
//--- создадим очень маленькое значение epsilon=1E-013
   double epsilon=1 e-13;
   Print("---- создадим очень маленькое число");
   Print("epsilon=",epsilon); // получим   epsilon=1E-013
//--- теперь вычтем эпсилон из числа b и выведем снова значение в журнал "Эксперты"
   b=b-epsilon;
//--- выводим двумя способами
   Print("---- после вычитания epsilon из переменной b");
   Print("Print(b)=",b);
   Print("Print(DoubleToString(b,16))=",DoubleToString(b,16));
//--- вывод в журнал "Эксперты"
// Print(b)=199.9999999999999  (теперь значение b после вычитания эпсилон не может округлиться до 200)
// Print(DoubleToString(b,16))=199.9999999999998578
//    (теперь значение b после вычитания эпсилон не может округлиться до 200)
  }
 

how do I know the Point for two currencies?

for the current instrument:

double P1=Point();

say for currencies Symbol1, Symbol2?

 

The item size can be obtained with SymbolInfoDouble(symbol_name, property).

ENUM_SYMBOL_INFO_DOUBLE

Identifier

Description

Property type

SYMBOL_BID

Bid - best offer for sale

double

SYMBOL_ASK

Ask - best bid

double

SYMBOL_LAST

Price at which the last trade was executed

double

SYMBOL_POINT

Value of one pip

double

Reason: