Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1115

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
......
EA works, but when I try to open it in editor
......
it's not an executable, it's an mq5 file...
this is my code...
So form your phrases correctly.
On topic. I usually open such problematic ones in Notepad++. It helps. But not always )))
So form your phrases correctly.
On topic. I usually open such problematic ones in Notepad++. It helps. But not always ))))
I also decided to look through it with Notepad++ and it was almost all zeros, although the file was the normal size as it should be...
I have written an EA. The person I wrote it to, on the first run, opens two positions one after the other. I cannot reproduce this problem with myself. I would like to ask you for help.
The OnTick() function
Only the CheckForOpen() function is responsible for opening positions:
The function that sends a request to open a position from the market. I added a delayed replay in it when the server crashes because I often get requotes/offquotes when testing with MetaQuotes MT5 demo.
The function of controlling the opening of a new bar:
The second position opens immediately after the first one, in the same second, the ticks differ by one. I initially thought there was a second copy of the EA on the second chart. I asked to close all of them and leave one chart and run the EA, but according to the customer and judging by the screenshot, that is not the reason. Subsequent positions are opened one at a time, there are no more duplicates. I cannot reproduce it, I have already wracked my brains. I have tested it on my MT5 demo ICMarkets hedge as well as the orderer. Screenshot of the doublet.
The whole EA.
I have written an EA. The person I wrote it to, on the first run, opens two positions one after the other. I cannot reproduce this problem with myself. I would like to ask you for help.
The OnTick() function
Only the CheckForOpen() function is responsible for opening positions:
The function that sends a request to open a position from the market. I added a delayed replay in it when the server crashes because I often get requotes/offquotes when testing with MetaQuotes MT5 demo.
The function of controlling the opening of a new bar:
The second position opens immediately after the first one, in the same second, the ticks differ by one. I initially thought there was a second copy of the EA on the second chart. I asked to close all of them and leave one chart and run the EA, but according to the customer and judging by the screenshot, that is not the reason. Subsequent positions are opened one at a time, there are no more duplicates. I cannot reproduce it, I have already wracked my brains. I have tested it on my MT5 demo ICMarkets hedge as well as the orderer. Screenshot of the doublet.
The whole EA.
I use this function to control new bar - sometimes there are errors when copying bar date.
I use such a function to control a new bar - there are times when there are errors when copying the bar date.
Thank you. I will try to replace it. Although so far the function I've used has worked fine as well. I have an idea to display bar open time and price in the prints; then it would be clearly seen that the error is there.
However, I am confused by the fact that duplots appear only at opening of the first position while subsequent positions are opened correctly and the EA works for hours generating dozens of them. And the function of bar opening control works every time. And according to the conditions the Expert Advisor opens the first position when there is none and the next ones open only when the price has moved far enough after the first one was opened.
I have written an EA. The person I wrote it to, on the first run, opens two positions one after the other. I cannot reproduce this problem with myself. I would like to ask you for help.
The OnTick() function
Only the CheckForOpen() function is responsible for opening positions:
The function that sends a request to open a position from the market. I added a delayed replay in it when the server crashes because I often get requotes/offquotes when testing with MetaQuotes MT5 demo.
The function of controlling the opening of a new bar:
The second position opens immediately after the first one, in the same second, the ticks differ by one. I initially thought there was a second copy of the EA on the second chart. I asked to close all of them and leave one chart and run the EA, but according to the customer and judging by the screenshot, that is not the reason. Subsequent positions are opened one at a time, there are no more duplicates. I cannot reproduce it, I have already wracked my brains. I have tested it on my MT5 demo ICMarkets hedge as well as the orderer. Screenshot of the doublet.
The whole EA.
And how do you check that a position has not already been opened on this bar?
And how do you check that no position has opened on this bar yet?
No, there is no such check.
There are such checks:
No, there is no such check.
There are such checks:
I do not have time to analyze what is going on there. But try to check the number of open positions on the new bar. If there are none - then open.