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

 
It's like a secret, no one will admit it. Maybe someone here knows: https://www.mql5.com/ru/forum/1111/page3141#comment_27268709?
Ошибки, баги, вопросы
Ошибки, баги, вопросы
  • 2022.01.16
  • www.mql5.com
Общее обсуждение: Ошибки, баги, вопросы
 
Valeriy Yastremskiy chat number out. It's resetting. something I don't understand.

Write where the Telegram.mqh library discussion is

 
Vitaly Muzichenko #:

Write where there is discussion of the Telegram.mqh library

Posted. The issue there is of course not mqh, but the api of the cart bot. When you send from the bot the api in the message and back it generates a reply with the chat's api and the bot's token. But with the bot's token what you can get from the cart.
 
x572intraday #:
It's like a secret, no one will admit it. Maybe someone here knows: https://www.mql5.com/ru/forum/1111/page3141#comment_27268709?

It may be worth looking in the dispatcher to see what is loading and for how long.

 
Andrey Sokolov #:

It might be worth looking in the manager to see what's loading and for how long.

That's a brilliant idea, how come I didn't realise it myself!

Here's what I've got:

CPU and GPU usage

As you can see from the screenshot, both CPUs are engaged, albeit to a different extent. It would be too presumptuous to say that the CPU is more excited than the GPU, hence, it is the CPU that processes the indicator buffers, as it is incorrect to compare CPUs and GPUs due to the specifics of each. One can only conclude once again that both are involved. The question remains open...

 

I can't figure out how to solve the problem

I need a tick chart, i.e. a tick came - shift the buffer by one and draw

We need to draw 60 last ticks, i.e. 60 bars.

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {

   // ВСЁ - здесь затык :(
    Buffer[0] = _bid;
   return(rates_total);
  }

---

We need to do as it is implemented in the "Ticky" window terminal


 
Vitaly Muzichenko #:

I can't figure out how to solve the problem

I need a tick chart, i.e. a tick came - shift the buffer by one and draw

We need to draw 60 last ticks, i.e. 60 bars.

---

This should be done as it is implemented in the "Ticky" window


It is a line, not bars.

The code draws bars in a new window. It may help.

Files:
SaveTicks.mq4  6 kb
 
Vitaly Muzichenko #:

I can't figure out how to solve the problem

I need a tick chart, i.e. a tick came - shift the buffer by one and draw

We need to draw 60 last ticks, i.e. 60 bars.

---

It should be done as it is implemented in the "ticks" window


To solve this problem, we need another array. It can be of a fixed length, e.g. 60. It should be filled with ticks, each time shifting data by 1 with the help of the loop. After each tick is written, this array should be copied to the Buffer array, and its data will be displayed in the chart.

 
Valeriy Yastremskiy #:

It's not bars, it's a line.

The code draws the bars in a new window. That might help.

I couldn't get anything out of it. Maybe I'm looking at it from the wrong side?


Mihail Matkovskij #:

You need one more array to solve this problem. It can be of a fixed length, e.g. 60. It should be filled with ticks, each time shifting data by 1 with the help of a loop. After each tick is written, this array should be copied into Buffer array and its data will be shown in the chart.

I can't figure out how to do the shift.

If you don't mind, show me the code

 
Vitaly Muzichenko #:

I couldn't get anything out of it. Maybe I'm looking at it from the wrong side.


I can't figure out how to make a shift.

If you don't mind, could you show me the code

A[0]=Bid;

for(i=0;i<60;i++){A[i+1]=A[i]}

Reason: