Hello! I am creating an Expert Advisor that sends signals. The search of the trading situation is written in theOnTick function. In order to prevent signals from repeating, I used the following check:
Recently this check stopped working. Failures began to appear (signals are repeated in a huge number) Later I found a code with a slightly different check from another programmer:
int currBars = iBars(SymbolName(i,true),periods[x]);
staticint prevBars = currBars;
if (prevBars == currBars) return;
prevBars = currBars;
The problem remains the same.Is there any other way to make this check? The essence of the check is that the Expert Advisor analyses the situation once, sends a signal to the Print or Alert function and does not touch it anymore.
Igor168 OnTick function . In order to prevent signals from repeating, I used the following check: Recently this check stopped working. Failures began to appear (signals are repeated in a huge number) Later I found a code with a slightly different check from another programmer: The problem remains the same. Is there any other way to make this check? The essence of the check is that the Expert Advisor analyses the situation once - sends a signal to the Print or Alert function and does not touch it anymore .
The specified NewBar() will work correctly only when called from OnTick(), in case of calling from other functions OnTimer(), OnChartEvent() errors are possible.
When calling not from OnTick() instead of TimeCurrent() it is better to use the time of the last tick of the checked symbol.
The specified NewBar() will work correctly only when called from OnTick(), in case of calling from other functions OnTimer(), OnChartEvent() errors are possible.
When calling not from OnTick() instead of TimeCurrent() it is better to use the time of the last tick of the checked symbol.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Why aren't there arrays in the structure?
To have a relationship between the cells of arrays
You can write it this way, but it is not quite readable in use
P.S. Reworked, I will keep the theoretical logical chain in the future
--
THANK YOU!
Recently this check stopped working. Failures began to appear (signals are repeated in a huge number)
Later I found a code with a slightly different check from another programmer:
The problem remains the same.Is there any other way to make this check?
The essence of the check is that the Expert Advisor analyses the situation once, sends a signal to the Print or Alert function and does not touch it anymore.
Recently this check stopped working. Failures began to appear (signals are repeated in a huge number)
Later I found a code with a slightly different check from another programmer:
The problem remains the same. Is there any other way to make this check?
The essence of the check is that the Expert Advisor analyses the situation once - sends a signal to the Print or Alert function and does not touch it anymore
.
Try this.
Try this.
I think it is necessary to supplement it.
The specified NewBar() will work correctly only when called from OnTick(), in case of calling from other functions OnTimer(), OnChartEvent() errors are possible.
When calling not from OnTick() instead of TimeCurrent() it is better to use the time of the last tick of the checked symbol.
I think it needs to be supplemented.
The specified NewBar() will work correctly only when called from OnTick(), in case of calling from other functions OnTimer(), OnChartEvent() errors are possible.
When calling not from OnTick() instead of TimeCurrent() it is better to use the time of the last tick of the checked symbol.
Got it. Thank you for the answer
I want to read the terminal log file. It is located in logs\18112024.log in the root of the terminal above the MQL5 folder.
I made a symbolic link so as not to bother with access to files outside the sandbox. Using mklink
So I need the Files\Logs\20241118.log file of today.
I can't open it:
Although yesterday's file opens:
Maybe I've messed with the flags ? How to open today's file where the terminal writes logs ?
It's a good idea that comes afterwards. Opened
In my experience, I will say that you are in the business of tinkering. In real life, it's going to be a drain.
With this kind of optimisation = 100% drain.