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

 
Artyom Trishkin:

In order to keep historical data up-to-date "hot", you need to access this data every two minutes using any of the CopyXXX, iXXX functions, e.g. CopyTime(), iTime(), etc...

I don't know what volumes you don't get in the tester. There are real and tick volumes. Without the code can not answer the substance.

The code is the same that I downloaded earlier (slightly modified). Copying ticks:

 MqlTick tick_array[];
      uint start = GetTickCount();
      int received = CopyTicks(_Symbol, tick_array, COPY_TICKS_TRADE, periodStartTime*1000, ticksSizeToCopy);
            if(received != -1) {
               PrintFormat("%s: received %d ticks in %d ms", _Symbol, received, GetTickCount() - start);
               if(GetLastError() != 0) 
                  PrintFormat("%s: таймер Ticks are not synchronized yet, %d ticks received for %d ms. Error=%d",
                              _Symbol, received, GetTickCount() - start, _LastError);
            }

Then there is a request for volumes. For example (simplified):

int ticks = ArraySize(tick_array);
for (int i = 0; i < ticks; i ++) {
         if((tick_array[i].flags&TICK_FLAG_BUY) == TICK_FLAG_BUY) {
               if(tick_array[i].volume > max) max = tick_array[i].volume;
        }
}

If you just attach it to a chart, then it's OK. If I attach it to a tester, then for some reason there are no volumes...

 
Yevhenii Levchenko:

The code is the same as the one I posted earlier (slightly modified). Copying of ticks:

Next there is a request for volumes. For example (simplified):

If I just attach it to a chart, then it's OK. If it's in the Strategy Tester, then it doesn't have volumes...

Note on CopyTicks() function. About the flags.

Документация по MQL5: Доступ к таймсериям и индикаторам / CopyTicks
Документация по MQL5: Доступ к таймсериям и индикаторам / CopyTicks
  • www.mql5.com
[in]  Количество запрашиваемых тиков. Если параметры from и count не указаны, то в массив ticks_array[] будут записаны все доступные последние тики, но не более 2000. Первый вызов CopyTicks() инициирует синхронизацию базы тиков, хранящихся на жёстком диске по данному символу. Если тиков в локальной базе не хватает, то недостающие тики...
 

Colleagues, please advise why I cannot put 2 or 3 ATR indicators with different timeframes on one chart at the same time?

Even changing the Offset to avoid visual overlaps, only one indicator works and is shown on the chart?

input int InpOffsetX = 10; // Offset X
input int InpOffsetY = 80;// Offset Y

More precisely, if I change TF, the second one appears, but the first one disappears; all three of them are showing alternately on different TFs, but not all together. The order cannot be traced.

 
Artyom Trishkin:

Read the note on CopyTicks(). About the flags.

I can't understand what you mean. I seem to be using the right flags... And it works in real life... but the tester doesn't want it to.
 
Artyom Trishkin:

Where did I say I wasn't good at logic?

Your words from the previous post :" To make algorithms, it seems to me, you need logic. And this is far from mathematics. And here I am not friends with it - only the necessary reference material and help of those who are friends".
 
Artyom Trishkin:
To make algorithms, I think, requires logic. And this is far from mathematics. And here I am not friendly with it - only the right reference material and help from those who are.

The programmer's job is not to solve complex tasks, but to get the computer to do them for him. But this may require solving other complex tasks, which the programmer obediently performs. :)

 
ANDREY:
Your words from a previous post :" To make algorithms, it seems to me, you need logic. And this is far from mathematics. And I am not friends with it - only the right reference material and help of those who are".

No, it isn't. It's like this:

"To make algorithms, it seems to me, you need logic. And this is far from mathematics. And I am not friends with it - only the right reference material and help from those who are".

In terms of meaning the two sentences are next to each other. But you have found your meaning...

 
Mihail Matkovskij:

The programmer's job is not to solve complex tasks, but to get the computer to do them for him. But this may require solving other complex tasks, which the programmer obediently performs. :)

The task setter of course rules. But he has to be a programmer to stay on course))))

 
Valeriy Yastremskiy:

The problem setter rules, of course. But he has to be a programmer to stay on course))))

That's the thing, the task manager is also the executor. Although, not always.

 

Please advise. I have an EA that takes data (time) from an indicator and counts the difference in milliseconds between ticks.

I output it via Alert and get the following (see picture). As I see it, first I get the total number of milliseconds and then the difference in milliseconds between the last 4 ticks (between 1 and 2, 2 and 3, 3 and 4).

Why is it like this? I only need the values for the 4th tick.

time

Files:
ind_time.mq4  1 kb
exp_time.mq4  2 kb