Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1129

 

Please tell me. There are two buffers with values in the indicator.

Buf1[0]=12.00000;
Buf2[0]=0.00045;

Trying to get the value of the third buffer.

Buf3[0]=Buf2[0]/Buf1[0];

Nothing.

What am I doing wrong?

Thank you.

 
Oleg Bondarev:

Please tell me. There are two buffers with values in the indicator.

Trying to get the value of the third buffer.

Nothing.

What am I doing wrong?

Thank you.

You do not receive. You are writing it down.

 
Artyom Trishkin:

You do not receive. You are writing it down.

I don't get it.
 

You assign a value to the 3rd buffer. "And nothing" is what? )))

How are you trying to get this value?

 
Сергей Таболин:

You assign a value to the 3rd buffer. "And nothing" is what? )))

How are you trying to get this value?

I'm assigning a quotient from dividing the values of the second and first buffers.

An empty buffer is obtained.

Документация по MQL5: Основы языка / Операции и выражения / Арифметические операции
Документация по MQL5: Основы языка / Операции и выражения / Арифметические операции
  • www.mql5.com
Операция инкремента и декремента применяются только к переменным, к константам не применяются. Префиксныe инкремент (++i) и декремент (--k) применяются к переменной непосредственно перед использованием этой переменной в выражении. Могут возникнуть вычислительные проблемы при переносе вышеуказанного выражения из одной среды программирования в...
 
Oleg Bondarev:

I assign the quotient from dividing the values of the second and first buffers.

The buffer is empty.

Maybe it's not the buffer that is empty, but the graph?)

 
Oleg Bondarev:

I assign the quotient from dividing the values of the second and first buffers.

An empty buffer is obtained.

That's how it works.

void OnStart()
{
   double   Buf1[];
   double   Buf2[];
   double   Buf3[];
   
   ArrayResize(Buf1,1);
   ArrayResize(Buf2,1);
   ArrayResize(Buf3,1);
   
   Buf1[0]=12.00000;
   Buf2[0]=0.00045;
   
   Buf3[0]=Buf2[0]/Buf1[0];
   
   ArrayPrint(Buf3);
}
2020.04.18 21:19:09.970 test (EURUSD,H1)        0.00004
 
Сергей Таболин:

That's how it works.

Thank you, but I have a question. The buffers I have are indicative and look like.

Buf1[0]=Buf1[0]+delta1;
Buf2[0]=Buf2[0]+delta2;

Will it work in this form?

 
Oleg Bondarev:

Thank you, but I have a question. My buffers are indicative and have a view.

Will it work in this form?

The buffer is a regular array. I think you are writing longer questions than you could check with a simple example. Everything you wrote will work and can even be simplified.

Buf1[0]+=delta1;
Buf2[0]+=delta2;
 
Thank you all for your help!
Reason: