Mt4 End of support. - page 24

 
Реter Konow:

I have already replied that bars open regardless of the arrival of a quote. If there is no quote, the price of the new bar will be the closing price of the previous bar. The fact of a new bar will be fixed regardless of the arrival of quotes, by the counters themselves, which run on a timer.

The specific timeframe does not matter, because it is just a counter that reaches its value and sets the event of the new bar of this timeframe. This is simply a method of synchronising with the appearance of new bars of different timeframes. SYNCHRONIZATION.

The instrument does not matter either. If the quotes are from one server, it means that they have the same time of new bars appearance. Therefore, it does not matter which instrument as long as these instruments are from one point in the world.


I will finish what I said and do other things. A little bit of a good thing).

you are mistaken.

Respectfully.

P.S. the formation of a new bar starts with the arrival of a new tick, which is the price of opening a new bar. in your algorithm there is a timer calculation that has nothing to do with the arrival of a new tick, hence the disagreement. in fact your algorithm gives not the fact of opening a new bar, but the beginning of the time after which you can expect the arrival of the first quote in a bar.
 
Artyom Trishkin:

It is you, in your algorithm, who think the bar is open. In fact - physically - it is not yet present in the terminal. This is a total inconsistency with the realities of the server.

The specific timeframe also matters.

Everyone who has ever been close to a multicurrency Expert Advisor knows this.

It is a pity that you do not want to come to the conclusion we are leading you to - visually and with a tangible example.

For the event of a new bar it does not matter what symbol it is. New bars of different symbols appear synchronously (for each timeframe).

There is a counter for each timeframe. When the counter reaches the value of its timeframe, it is reset to zero and a new bar event is set for this timeframe.

Further, calling the function returns a new bar event once for the time of the current bar.

Thank you all and goodbye.

 
Реter Konow:

There is no difference which symbol is used for the new bar event. New bars of different symbols appear synchronously (for each timeframe).

The timer has a counter for each timeframe. When the counter reaches the value of its timeframe, it is reset and a new bar event is set for this timeframe.

Further, access to the function will return the event of a new bar once during the current bar.

That's the end of the explanation.

Thank you all and goodbye.

You are not the one who is spelling it out - your logic is clear. But, unfortunately, it is wrong. You have to get the data from the trading environment - eventually from the server.

And if there is no new quote on the server, then there is no new bar opening in the terminal.

Your algorithm, working in the timer, will "stamp" new bars when the market is closed. But there aren't any on the server and therefore in the client terminal.

And believe me, the difference in the arrival of quotes for different symbols will also cause a difference in opening of a new bar - the beginning of forming a new bar will be activated only when the tick (quote) corresponding to the time of this bar comes. If the tick is received 4 minutes and 15 seconds after the last bar closing on M1, then three bars will be missed because there is no quote to perform them on.

I have given you a hint.

 
Andrey Kisselyov:
you are mistaken.

Sincerely.

P.S. The formation of a new bar starts with the arrival of a new tick, which is the price of opening a new bar. In your algorithm, there is a calculation based on the timer that has nothing to do with the arrival of a new tick, hence the disagreement.

Yes on a timer. A new bar appears without a quote. We are interested exactly in the event of appearance of a bar and we can fix the quote in Optisk();

The bar will appear in any case. If it's a weekend and there are no bars, it's OK. The function will not change and it will be synchronized with the bars' arrival by the time the session starts.

 
Artyom Trishkin:

It's not you who chews it up - your logic is understandable. But, unfortunately, it is flawed. You have to get the data from the trading environment - eventually from the server.

And if there is no new quote on the server, then there is no new bar opening in the terminal.

Your algorithm, working in the timer, will "stamp" new bars when the market is closed. But there aren't any on the server and therefore in the client terminal.

And believe me, the difference in the arrival of quotes for different symbols will also cause a difference in opening of a new bar - the beginning of forming a new bar will be activated only when the tick (quote) corresponding to the time of this bar comes. If the tick comes 4 minutes and 15 seconds after the last bar on M1, then three bars will be missed because there is no quote to build them on.

I have given you a hint.

The quotes can be obtained from OnTick(). You can associate the event of new bar opening with confirmation of quote arrival. I would not do so. But it is up to everyone.
 
Реter Konow:

Yes on a timer. A new bar appears without a quote. We are interested exactly in the event of occurrence of a bar while we can fix the quote in Optisk();

The bar will appear anyway. If it is a weekend and there are no bars, it's OK. The function will not collapse and it will be synchronized with the arrival of bars at the moment when the session starts.

Suppose you want to take the indicator readings at 1 and 2 bars according to the event of a new bar start. Looking at the logic of your algorithm, you'll get the values of 1 and 2 bars before the new quote arrives and the bar will appear on the chart. As a consequence, when trying to read the indicator you will get not the values of 1 and 2 bars as it should be at the time of the new quote arrival, but the values of 1 and 2 bars that will move by 1 bar to be 2 and 3 bars.


Sincerely.

 

Artyom Trishkin:

And, believe me, the difference in the arrival of quotes for different symbols also makes a difference in the opening of a new bar - the beginning of the construction of a new bar is activated only with the arrival of a tick (quote), corresponding to the time of this bar. If the tick is received 4 min 15 sec after the last bar on M1, then three bars will be missed, because there is no quote to build them on.


Now about that question, - I think you are wrong. Please check with servicedesk. Let them answer the question: whether new bars are formed in the platform, regardless of the arrival of quotes, or not. If no, then on the event of a new bar check whether there was a quote on it. If it was, the new bar has been formed. We can do it this way. You don't need to change much.

 
Andrey Kisselyov:
Suppose you want to take indicator readings at 1 and 2 bars according to the event of a new bar start. Proceeding from the logic of your algorithm, you will get a new bar start before the quote arrives and the bar appears on the chart. As a consequence, when trying to read the indicator you will get not the values of 1 and 2 bars as it should be when the quote arrives, but the values of 1 and 2 bars that will be shifted by 1 bar when the new quote arrives and will be 2 and 3 bars.


Regards.

It is possible. Add checks for the new quote at every new bar event and that's it. Do not work with the event of a new bar, but with the event of a bar and a quote, for example.
 
Реter Konow:
Possible. Add a quote arrival check on each new bar event and that's it. Work not with the event of a new bar, but with the event of a bar and a quote, for example.
I don't need this algorithm, it's your brainchild, I'm just reviewing it for errors and possible improvements, exercises for the brain, so to speak.

With respect.
 
Реter Konow:
Get your quotes from OnTick(). You can associate the event of a new bar opening with the confirmation of receipt of a quote. I would not do so. But this is a personal matter.

I know how to get quotes :)

In a multi-currency program - in a timer in a loop on the right symbols. And the opening of a new bar (physical, not virtual - erroneous - as in your case) is controlled by the time of the last quote and compare this time with the time of the zero bar symbol.

You, on the other hand, are making at random - a virtual bar that may not exist. On the weekend they don't exist, but you supposedly have them - that's the simplest thing to give as an example.

And, you see, you're the only one who wouldn't do it that way. The rest of us do it the right and reliable way. But that, of course, is only your own business.

I wanted to tell you how to do it correctly and show the big difference in the simplicity of writing in OOP, and complex twists in the procedural style when solving the same problem.

But you probably know more and you don't need it. I don't dare to look like I know anything else in front of you. Sorry.

Reason: