Questions from Beginners MQL5 MT5 MetaTrader 5 - page 305
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
Good evening all! I decided to put a trail on open trades in the tester, tried to go through OrderGet....() and realized that the deal went from the category of orders to an open position, respectively went through PositionGet....(), but again nothing works,
The question is if I should now use HistoryDealGet...() ? Or I don't understand something? Which way to go to modify SL in open trade in the tester? Thanks in advance for comments.
Please direct me to !!!! how to implement in MQL5 the check of presence (or absence) of a graphical object, e.g. a trend line or a vertical line?
Ideally, I would like to use logic similar to "If Order Does Not Exist" or "If Order Exists".
Please direct me to !!!! how to implement in MQL5 the check of presence (or absence) of a graphical object, e.g. a trend line or a vertical line?
Ideally, I would like to use logic similar to "If Order Does Not Exist" or "If Order Exists".
Can you advise how to correctly implement the buying algorithm?
At the moment, the Expert Advisor has to buy many times, until it receives the information that there are open positions, and it lags behind. How to make the Expert Advisor wait for the exchange response after the first buy (when the conditions come).
The problem now is that the variable Bye_opened should become true and this should keep the EA from making unnecessary trades until the stops are triggered. But changing the variable Bye_opened takes a long time and the EA has time to make several trades.
What is missing in my code? Please point out the shortcomings.
The problem now is that the variable Bye_opened should become true and this should keep the EA from making unnecessary trades until the stops are triggered. But changes of variable Bye_opened take long time and EA has time to make several trad es.
Just because a variable change takes a long time... how did you determine that? Ok, let's assume that it is. Then the answer lies in the question. If you need a delay in opening of a position you must use Sleep( N ) where N is calculated experimentally.
Variant 2. The answer, again, is in the question. Make Bye_opened global and change it immediately after the position is successfully opened, right in this module. Reset in the same way, as you check the existence of position.
...
If you insert a line
after the command: OrderSend(), there will be no reopening of positions.
Maybe it's better to check whether the position has opened first, and then ...
???
Apparently he has a robot running on every tick. Between sending the order to the server and receiving the response from the server, several more ticks will come and an extra position will open on each tick. My proposal excludes the situation of repetition of openings. And it is necessary to check whether a position has been opened or not.
That's what I'm saying. Otherwise it would literally understand everything and miss an important check.
So this is actually how to check correctly? Sorry, I can't get it right.
Here's the code (all located in the OnTick block):
In order to avoid opening unnecessary volumes:
Unfortunately, this condition does not work when opening a trade.