Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1078
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Afternoon.
In a multicurrency Expert Advisor, I need to close a pending order placed against a profit when an open position triggers.
Right now, when I close a pending order at profit, all the pending orders for all currencies are closed.
How to change the code so that only the pending order linked to a currency pair closes and the rest remain open?
What should I change in this code?
Mn in this code is a magic number of a pending order BUY_STOP or SELL_STOP.
The logic is that when an open position is closed at Take Profit, this magic number is left and the command to delete it is supposed to be executed.
This works when testing each pair. However, when working with other currencies, all orders placed on all pairs are deleted.
Please help, if you can.
I understand that no one should bother with this problem, but maybe someone has a ready-made template?
I would be very grateful.
I had to copy the code into the editor and do normal styling (Ctrl+<) to understand what you've messed up there.
So: commented in the code what was messed up there:
As a result, your code does this, i.e., is equivalent to this code:
Now ask - what did you want to get out of it?
To understand what you messed up there, I had to copy the code into the editor and do a proper styling (Ctrl+<).
So: commented in the code what you messed up there:
As a result, your code does this, i.e., equals this code:
Now ask - what did you want to get out of it?
OK.
here:
When a position is opened (OP_BUY or OP_SELL ), we simultaneously place pending orders (OP_SELLSTOP and OP_BUYSTOP), respectively.
When closing an open position at take profit, the pending order corresponding to it must be cancelled. This algorithm is applied to all currency pairs.
Other pending orders placed on other currencies should remain.
Good day to you all!
There is an indicator MTF_RSI is switching
Can you tell me if it is possible to set automatic change of TimeFrame when switching chart?
Something like
Good day to you all!
There is an indicator MTF_RSI is switching
Can you tell me if it is possible to set automatic change of TimeFrame when switching chart?
Something like this
Create a structure or a multidimensional array and let it run on the desired dimension, if the criterion is fulfilled, work with one column (each column is responsible for its own timeframe), if not with another column, and that's all. The program itself has access to all timeframes at once, so what you write is possible, but the implementation is very extensive and you can't see this amount of work on the forum, because it's very extensive.
Create a structure or multidimensional array
Thank you.
Why doesn't this code work?
It works with simple functions, but there's something weird about it.
Thank you.
Are you talking to me?
Yes to you. You will have to work through the game with timeframes on every detail in every loop and in every function. This is why I recommend using multidimensional arrays.
Yes to you. You will have to work through the game with timeframes on every detail in every loop and in every function. This is why I recommend using multidimensional arrays.
This issue is solved more easily: