Errors, bugs, questions - page 2222
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Stable playback ? What build?
Question.
Suppose I work with several symbols in an Expert Advisor or indicator, or rather with all the symbols that are displayed in the Market Watch window.
The task is to catch the moment of a new tick on any of the symbols.
So far I see only a couple of options:The disadvantage of the first option is non-optimality in terms of resources and data relevance. OnTimer will mainly hammer in idle, and when it catches a new quote, the arrival time error will be equal to the timer periodicity.
The disadvantage of the second variant is cumbersomeness, especially if there are dozens of symbols.
Do I understand correctly that there are no other options (simpler and more elegant)? Or (I hope) am I wrong?
Question.
Suppose I work with several symbols in an Expert Advisor or indicator, or rather with all the symbols that are displayed in the Market Watch window.
The task is to catch the moment of a new tick on any of the symbols.
I can only see a couple of options so far:The disadvantage of the first option is non-optimality in terms of resources and data relevance. OnTimer will mainly hammer in idle, and when it catches a new quote, the arrival time error will be equal to the timer periodicity.
The disadvantage of the second variant is cumbersomeness, especially if there are dozens of symbols.
Do I understand correctly that there are no other options (simpler and more elegant)? Or (I hope) am I wrong?
Maybe this will help? https://www.metatrader5.com/ru/terminal/help/trading_advanced/custom_instruments
Synthetic instruments with real-time quotesThe trading platform allows you to create synthetic financial instruments - instruments based on one or more existing ones. You just need to set a formula to calculate the quotes and the platform will generate real-time ticks of the synthetic instrument as well as create its minute history.
How it works
You create a synthetic instrument and set the formula for it.
The platform will calculate its ticks with a frequency of 10 times per second (and only if the price of at least one instrument in the formula changes).
Maybe this will help? https://www.metatrader5.com/ru/terminal/help/trading_advanced/custom_instruments
Synthetic instruments with real-time quotesThe trading platform allows you to create synthetic financial instruments - instruments based on one or more existing ones. All you need to do is specify the formula for calculating the quotes and the platform will generate the ticks of the synthetic instrument in real time and create its minute history.
How it works
You create a synthetic instrument and set the formula for it.
The platform will calculate its ticks with a frequency of 10 times per second (and only if the price of at least one instrument in the formula has changed).
Yes, of course, that variant has a right to life too. Thanks!
But, in fact, it is the same as my variant #1 with timer periodicity of 100 ms and with the same disadvantages.
Option 2 seems more rational to me, though.
By the way, I remembered that option 2 has already been discussed here.
Yes, of course, this variant has a right to life, too. Thank you!
However, in essence, it is the same as the variant #1 above with timer period of 100 ms.
Wouldn't it be easier to make an EA linked to the symbol on which it is working. Then open all symbols and apply the template with this EA to each chart.
Wouldn't it be easier to make an EA linked to the symbol on which it is working. Then open all symbols, and for each chart apply a template with this EA.
It is clear that this can be done. The matter is that I do not know something and it is possible to trace the exact moment of coming of the quote for another symbol through the code of only one multi-currency EA.
But it seems that variant 2 via custom interrupts is the only rational solution.
Yes, it is clear that it can be done that way. The question is that I don't know something, and it's possible to catch the exact moment of coming of the quote for another symbol through the code of only one multi-currency Expert Advisor.
But it seems that variant 2 via custom interrupts is the only rational solution.
Implementation.
Am I correct in assuming that there are no other options (simpler and more elegant)? Or (I hope) am I wrong?
Millisecond timer + SymbolInfoTick() will get the time in milliseconds.
Implementation.
Я правильно понимаю, что других вариантов (более простых и изящных) не существует? Или (надеюсь) я не прав?
Millisecond timer + SymbolInfoTick() get the time in milliseconds.
Alexey Kozitsyn:
Millisecond timer + SymbolInfoTick() get time in milliseconds.
Objectively, the variant with user interrupts is more reasonable, because there is no need to organize a loop with the expensive SymbolInfoTick function constantly, even when the quotes are sleeping, thus loading the processor with idle time. In addition, the error of calculating a new tick may be equal to the periodicity of the timer, and all ticks will be lost between OnTimer execution, if such ticks were more than 1.