Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1116
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
And how do you check if a position has not been opened on this bar yet?
Maybe we should modify Aleksey Vazhmikin's function a bit and add a structure to control opening of a position on a new bar in this way:
And then raise the control flag in the Expert Advisor when a position is successfully opened:
BarOpen.IsPositionOpened=true;
And control it before opening another position. Is it more reliable?
The second position opens immediately after the first, in the same second, the ticks differ by one.
https://www.mql5.com/en/forum/271445
https://www.mql5.com/en/forum/308940
https://www.mql5.com/en/forum/271445
https://www.mql5.com/en/forum/308940
Thanks for all your help. I have studied everything in detail. I have a 5 sec delay after each trade request but still not helping. The problem is just on ICMarkets demo MT5 hedge. I will add checks and output the results of status polling. The situation is aggravated by the fact that I can't reproduce the problem with myself and the client has it regularly, even though we connect to the same server.
Hello Ladies and Gentlemen! Is there anyone from Simferopol?
So you think this will somehow help you in learning MQL5 :) . This is an MQL5 programming forum, not a dating club.
So you think this will somehow help you in learning MQL5 :) . This is an MQL5 programming forum, not a dating club.
Thank you for all your help. I have studied everything in detail. I have a 5 sec delay after each trade request, but still no help. The problem is just on ICMarkets demo MT5 hedge. I will add checks and output the results of status polling. The situation is aggravated by the fact that I can't reproduce the problem with myself and the client has it regularly, even though we connect to the same server.
I think it has something to do with the quality of the client's connection, e.g. high ping. You do have a 5 second delay, but it's just not there, as I understand from your code. What does the m_trade class return? Ticket number? Or true or false? You have a check for the result returned by this object, but imagine that because of a delay in connection with the server a positive response has not been received yet. What will be the result of executing the if statement? Probably, it will be false and as a result your loop will go to the second iteration after 5 seconds. And at last the server will finally reply, but the second iteration will already be initiated and a second request to open a similar position will be sent. The fact that there is some delta in the order opening time is shown by the fact that both orders are shifted in the chart, which means that they have been executed at different times and prices.
The situation is aggravated by the fact that I can't reproduce the problem with myself, but with the customer it occurs regularly, even though we connect to the same server.
Check on the bar, one position per symbol. Most likely you will get rid of the problem.
Check on the bar, one position per symbol. You will probably get rid of the problem.
There's another hitch there. In this situation it's easier to rewrite to MT4-style than to come up with a crutch.
Good day everyone!
Here is part of the script code for Metatrader5:
Questions have arisen:
1. The script is supposed to set either pending limit orders at a certain distance from ask and bid, or stop orders. The limitpending orders are set without any problems but the stop ones are not. Please help me find out why the pending Buy Stop and Sell Stop orders are not being set.
2. Is there any possibility to test the script when the market is closed (e.g. on weekends)?
Sincerely, Vladimir.