[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 406

 
The Bid and Ask contain the values at the moment the Star() function is started. The MarketInfo() function gives the actual (most recent) values. The RefreshRates() function updates the Bid and Ask variables.
hoz:

1. Yeah, I'm just overworked, so I wrote a stupid thing...

2. Long is a relative term. Are you suggesting we measure the speed of the average calculation?

3. If we assume, as you have written, that the terminal corresponds to the last value of market data variable, in our case, the price, it means that the terminal updates market environment variables on its own, if there is a connection with the server,

4. It follows from this that RefreshRates() function is unnecessary. But it's not so, because the function is present, which means that prices are not always refreshed, right?

I'm not arguing, I'm asking, arguing my point of view. Please note that!


2. Where did you see this and how did you come to this surprising conclusion?

3. Yes. Can you imagine, just look at the market overview window, how the numbers bounce around relentlessly there.

4. The Bid and Ask variables are assigned (by the terminal) with the values they had when the function Start was executed, no matter how long the function is executed, the values in Bid and Ask will be the same. That's why we need RefreshRates() or we should use MarketInfo()

 
hoz:

So if the request is local and not to the server, then this function should work instantly! And it was said above that RefreshRates() function may not have time to update market environment data...

Where was it said and by whom? There is no problem at all.
 
hoz:


So if there's no new tick, the price won't change... and of course the previous prices will still be valid. So there is no need to complicate things!

And Vadim wrote at the top that it was necessary to check this point. But there was no logic in his words, and no argumentation either. It's strange... So, I insert RefreshRates() everywhere and at that moment the last-known data from the terminal become usable instead of the previous ones and everything goes as it should. ProvidedRefreshRates() returned TRU. If it's False, it means that data hasn't changed and it works with previous prices... Am I reasoning correctly?

It turns out that there is no need to bother. Just callRefreshRates() and everything will work with actual data...


That's right
 
Roger:
have you tried break;
The textbook tells us that the operator
break; 

interrupts the while, for or switch statements. In my case, there are no such operators. There is a series of if statements that need to be interrupted at a certain point.

In any case, try this:

if (условие)
        {                                          
        Opn_B=true;
        Cls_S=true;   
        break;                    
        } 
It reports an error: 'break' - 'break' or 'continue' used within some cycle only.
 
Integer:
Bid and Ask contain the values at the moment when the Star() function is launched. Function MarketInfo() gives the actual (most recent) values. The RefreshRates() function updates the Bid and Ask variables.


2. Where did you see this and how did you come to this surprising conclusion?

3. Yes. Imagine, just look at the market overview window and see how the numbers bounce around relentlessly.

4. The Bid and Ask variables are assigned (by the terminal) with the values that existed at the moment the Start function is started, no matter how long the function is executed, the values in Bid and Ask will be the same. Therefore, we need RefreshRates() or use MarketInfo().


1. Yes, i.e. after start() we have 1 tick to have time to calculate everything, otherwise, if we do not have time, we have to refresh. Makes sense.

2. You have written it verbatim:

Integer:

If it makes long calculations, you can use RefreshRates().

3. That's what I mean.

 
Integer:

Where when and by whom did it say that? There is no problem at all.


Here on the page:

https://www.mql5.com/ru/forum/142582/page404 Vadim wrote this,

Zhunko

RefreshRates(); // Why this brake without processing the return value?

That's what confused me, to be honest...

 
hoz:


Here on the page:

https://www.mql5.com/ru/forum/142582/page404 Vadim wrote this,

That's what confused me, to be honest...

I'll check it out on Monday. I might be wrong.

==================================

Anyway, without RefreshRates() my EAs won't work. I make them looped. Therefore, RefreshRates() is mandatory.

The initial imposition of history is done based on this principle. Then I periodically recharge it. Otherwise there appear "gaps" in the history with which the Expert Advisor works. I do not know why it happens. I tried using RefreshRates() for paging. It does not always work. I described the problem above. Sometimes only the last bar comes in.

If a chart of an instrument is open, there is always a history on it. There have never been any errors in this case. The "hole" appeared when the chart of the required instrument was not open.

 
Forexman77:
The textbook reports that the operator

interrupts the while, for or switch statements. In my case, there are no such operators. There is a series of if statements which must be interrupted at a certain point.

In any case, try it this way:

An error is reported: 'break' - 'break' or 'continue' used within some cycle only.

If you are looking for GoTo, there is no such operator, but as practice shows, you don't need it. To be able to recommend you a solution, you need to see your target. Show me your algorithm in general terms.

 
Roger:

If you are looking for a GoTo operator, there is no such thing, but as practice shows, you don't need one. To be able to recommend a solution, you need to see your target. Show me your algorithm in general terms.

Thank you, I have already found a way to solve the problem.
 
Forexman77:
Thanks, already found a way to solve the problem.

Here... and a lot of people do... They ask a question that may be of interest to some other beginners. Then they find a solution and, instead of showing it, they say: "Oh, thank you all very much, I've found it and done it, you don't have to be afraid of me all week... " ... and they think that's the end of it... And the solution to this problem has never been shown. And it goes round and round... The next one comes back with the same question.

Just tell me what's so terribly secret in your algorithm and how to solve it, that as soon as you were asked to show the algorithm in general terms, trying to help you, you immediately unsubscribed that everything is "grain of salt"?

Then don't ask unnecessary questions if you don't think about other questioners... or find a solution yourself (hey good for you!!!) and show it to others...

Reason: