- Usually people who cannot code do not receive free help on this forum, although it could happen.
- If you show your attempts and describe your problem clearly, you will most probably receive an answer from the community.
- If you do not want to learn to code, that is not a problem. You can either look at the Codebase if something free already exists, or in the Market for paid products (also sometimes free).
- Finally, you also have the option to hire a programmer in the Freelance section.
By the way, is this a MQL5 or a MQL4 question?
Your wording suggests that it may be a MQL4 question, as you refer to orders instead of positions.
Should it be about MQL4, please note that MQL4 and MetaTrader 4, has it's own section on the forum.
- Usually people who cannot code do not receive free help on this forum, although it could happen.
- If you show your attempts and describe your problem clearly, you will most probably receive an answer from the community.
- If you do not want to learn to code, that is not a problem. You can either look at the Codebase if something free already exists, or in the Market for paid products (also sometimes free).
- Finally, you also have the option to hire a programmer in the Freelance section.
By the way, is this a MQL5 or a MQL4 question?
Your wording suggests that it may be a MQL4 question, as you refer to orders instead of positions.
Should it be about MQL4, please note that MQL4 and MetaTrader 4, has it's own section on the forum.
Dear Fernando, first of all, thank you for your response. I think you understood me wrong! I am not asking for someone to "free help", or someone go code an entire EA for me! I am asking for a small part that I mentioned didn't work out with me, while coding my EA.
Here is what I did so far, but it was not working as expected. Yes, this is in MQL4.
Here I am trying to draw an arrow and a line whenever a pending order converts to an actual order. I call the function from onTick. It draws it only when the first pending order converts to an order, but not for the rest, and it goes into an infinite loop...
Can someone from the community please tell me what is wrong, or if they suggest another approach to this...
...
Improperly formatted code removed by moderator. Please EDIT your post and use the CODE button (Alt-S) when inserting code.
Hover your mouse over your post and select "edit" ...
...
Now what im thinking of doing is to capture the ticket numbers of all pending orders as they are created in an array, and running them into a loop and checking when this ticket number == OP_BUY or OP_SELL and then drawing the line and the arrow, but again here, I don't want to keep drawing the same for the same order when it comes back around the loop. I was thinking of keeping another tracker array where I capture the ticket numbers of the orders that now have lines and checking them before entering the loop. But that would be complex.
Anyone with a better idea or approach
Much appreciated
-
Why did you post your MT4 question in the MT5 EA section instead of the MQL4 section, (bottom of the Root page)?
General rules and best pratices of the Forum. - General - MQL5 programming forum? (2017)
Next time, post in the correct place. The moderators will likely move this thread there soon. -
You were asked to edit your (original) post and use the CODE button (or Alt+S)! (For large amounts of code, attach it.) Why didn't you? Why did you make a second post? Why didn't you use the code button?
General rules and best pratices of the Forum. - General - MQL5 programming forum #25 (2019)
Forum rules and recommendations - General - MQL5 programming forum (2023)
Messages Editor -
if(OrdersInThisTrade == OrdersTotal()) // OrdersInThisTrade is a global integer initialized to 0;
Magic number only allows an EA to identify its trades from all others. Using OrdersTotal/OrdersHistoryTotal (MT4) or PositionsTotal (MT5), directly and/or no Magic number/symbol filtering on your OrderSelect / Position select loop means your code is incompatible with every EA (including itself on other charts and manual trading.)
Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 programming forum (2013)
PositionClose is not working - MQL5 programming forum (2020)
MagicNumber: "Magic" Identifier of the Order - MQL4 Articles (2006)
Orders, Positions and Deals in MetaTrader 5 - MQL5 Articles (2011)
Limit one open buy/sell position at a time - General - MQL5 programming forum (2022)You need one Magic Number for each symbol/timeframe/strategy.
Trade current timeframe, one strategy, and filter by symbol requires one MN.
If trading multiple timeframes, and filter by symbol requires use a range of MN (base plus timeframe).
Why are MT5 ENUM_TIMEFRAMES strange? - General - MQL5 programming forum - Page 2 #11 (2020) - adamsaad: Would someone be able to help me out with this...
Help you with what? You haven't stated a problem, you stated a want. Show us your attempt (using the CODE button) and state the nature of your difficulty.
No free help (2017)Or pay someone. Top of every page is the link Freelance.
Hiring to write script - General - MQL5 programming forum (2018)We're not going to code it for you (although it could happen if you are lucky or the issue is interesting).
No free help (2017)
Dear Fernando, first of all, thank you for your response. I think you understood me wrong! I am not asking for someone to "free help", or someone go code an entire EA for me! I am asking for a small part that I mentioned didn't work out with me, while coding my EA.
Here is what I did so far, but it was not working as expected. Yes, this is in MQL4.
Here I am trying to draw an arrow and a line whenever a pending order converts to an actual order. I call the function from onTick. It draws it only when the first pending order converts to an order, but not for the rest, and it goes into an infinite loop...
Can someone from the community please tell me what is wrong, or if they suggest another approach to this...
...
Improperly formatted code removed by moderator. Please EDIT your post and use the CODE button (Alt-S) when inserting code.
Hover your mouse over your post and select "edit" ...
...
Now what im thinking of doing is to capture the ticket numbers of all pending orders as they are created in an array, and running them into a loop and checking when this ticket number == OP_BUY or OP_SELL and then drawing the line and the arrow, but again here, I don't want to keep drawing the same for the same order when it comes back around the loop. I was thinking of keeping another tracker array where I capture the ticket numbers of the orders that now have lines and checking them before entering the loop. But that would be complex.
Anyone with a better idea or approach
Much appreciated
Where is your loop? I cannot see it…
Thank you Daniel for your reply. Yes, I will store all the tickets of the pending orders in an array and then check if they changed to an actual order, draw the line when they do, and then clear the ticket data so it doesn't draw it again. Thank you for your help
Thank you Daniel for your reply. Yes, I will store all the tickets of the pending orders in an array and then check if they changed to an actual order, draw the line when they do, and then clear the ticket data so it doesn't draw it again. Thank you for your help
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hey Guys, I can't seem to be able to find out when or how exactly my pending orders turn into actual orders.
Lets say I have 2 pending orders on the chart that are both reflected with a green Zigzag line on the graph. And lets say that one of them expires, and the other one turns into an order.
I want to be able to modify the one that turns into an order and is reflected by the green doted line on the chart that is drawn by default (to blue, for buy orders, and red for sell orders) and place a solid arrow under the open price (Red for sell, and blue for buy).
Later I take another 2 pending orders, and this time, both turn into orders within the same trade, and I want to be able to also modify them to also have them reflect the changes on the graph. So in total, I should have now have 3 lines drawn on the chart with the modified changes.
Finally, when all open positions are closed, I want all the lines to get deleted from the chart, and just reflect in the trade history
Would someone be able to help me out with this... I've been banging my head over it for some time now, but still struggling 😣
Much appreciate your time and help with this guys 😊🙏