Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 209
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
The problem is in this line
Since I want to check several currencies on one bar, I should check the time and currency to avoid repeating an alert on one bar and one symbol but allow an alert on the same bar with a different symbol. At first glance, we need one more array with flags whether the symbol is viewed or not.
In general, we have to either add a symbol check to this line, or repeat the loop only when a new bar appears. But I have a fear that when a new bar appears on the symbol with this indicator, a new bar has not yet appeared on another symbol.
The conclusion: we must strain our head muscles to determine whether a new bar appears on each symbol separately, but at the same time not to stretch the number of lines to infinity. I have no ready-made solution. And I don't like to suggest it by writing code...
And I haven't solved his problem?
Maybe I missed something somewhere - I wrote the code on my knee.
And I haven't solved his problem?
Maybe I missed something somewhere - I wrote the code on my knee.
Artem, the last sentence of my post explains everything. Didn't even look at your code. Opened the first unread question with a quote from my previous reply, I answered and then saw the other advice. I don't doubt the correctness of your code, even from my knee...
Artyom, the last sentence of my post explains everything. Didn't even look at your code. Opened the first unread, question with a quote of my previous answer, I answered and then saw other advice. I don't doubt the correctness of your code, even from my knee...
Would have said lazy ;)
Even at first glance you can see that the code depends on ticks on the current symbol. And thus we must remove the loop from OnTick() and shove it into a timer. And slightly modify the definition of time alerts.
Hello all, there is a misunderstanding of the process, in the function "start" in the cycle mm++; and follow the changes in it through Print(); so the question: "Why instead of 1,2,3,4, etc. pop up four-digit numbers? "
the code itself
Hello all, there is a misunderstanding of the process, in the function "start" in the cycle mm++; and follow the changes in it through Print(); so the question: "Why instead of 1,2,3,4, etc. pop up four-digit numbers? "
the code itself
At first run, 10 secondsIndicatorCounted()=0
solimit= max bars in history-1
At first run, for 10 secondsIndicatorCounted()=0
meanslimit= max bars in history-1
still not clear, declaration and initialization with zero outside the loop int mm=0; and placed in the loop mm++; print() shows four-digit numbers changing with a difference of one unit, only in descending direction for some reason
Alexey Viktorov:
...you have to strain your head muscles...
Thank you to everyone who responded.
Artyom Trishkin: Like this:
Restricting the check on a new bar won't work because there will also be conditions that must be checked on every tick.
I try to add OnTimer() to your code. It worked in EA when OnTick() but how to do it with OnCalculate ?
Can you tell me why orders are not opening?
Thank you to everyone who responded.
Artyom, why do you write that you haven't solved it? It's signalling on all the instruments, but it's loading the system heavily. Is there any way to reduce the load?
The limit of checking on a new bar won't do because there will be also conditions that have to be checked on every tick.
In your code, I try to add OnTimer(), it worked in EA when OnTick() but how to do it with OnCalculate ?
Try it with a timer for 200 milliseconds.