
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
Ah-ha! I switched the ticket number 0 to 1 and everything worked like clockwork. Yes, I was wrong William... The OrderSelect() function was an issue. Obviously the OrderSelect() function must select a ticket. If the ticket number is 0, what ticket will the EA select? :O "?". Thank you both for your assistance.
Thank you.
Pleas refer to this thread: https://www.mql5.com/en/forum/142545
Simon, I understand 0 is not a valid ticket number BECAUSE 0 means there are no tickets to select. 1 represents a ticket AND the specific ticket number which OrderSelect() function is attempting to select.
I'll read the thread. Thank you for posting it.
Thank you.
I understand 0 is not a valid ticket number BECAUSE 0 means there are no tickets to select. 1 represents a ticket AND the specific ticket number which OrderSelect() function is currently selecting.
No, that is not correct. zero as a ticket number does not mean anything, it is INVALID. OrdersTotal() == 0 means there are no orders . . . it is obvious you are mixing up the results from different functions and ticket numbers vs order positions
Don't do exactly what you did before . . . . unless you want exactly the same outcome. You can't assume you have the correct ticket number .. . . you need to find it in the Order Pool and then select it . . .
If you want to learn do this exercise:
No, that is not correct. zero as a ticket number does not mean anything, it is INVALID. OrdersTotal() == 0 means there are no orders . . . it is obvious you are mixing up the results from different functions and ticket numbers
If you want to learn do this exercise:
Did you try the exercise ? show your code when you have done it . . .
Simon,
I'll code this project. It should be a piece a' cake. I've already done a bulk of the work. ;)
Yeah, I don't mind doing this exercise, seeing you have provided your consistent support.
Thank you.
Simon,
Done. I assumed you wanted the file in script format, so you could just drag and drop it on a chart, wait for the EA to crunch a few numbers, then watch it pull an order out of the market.
The differences between what I am currently building and this project is...
Currently building:
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)){
This project:
The reason I used "if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES)){", is because I am dealing with an order pool and not a predefined specific ticket variable.
My current build for volume II uses predefined variables because I must select specific tickets to run volume II's strategy. This project was designed to simply close an order in the blink of an eye.
I actually had a couple question marks rise above my head as I coded the function execution containing Ask/Bid price. This is because, typically when sending/closing orders, I usually just type "Ask"/"Bid", but I realized I needed to define a variable which could be either Ask or Bid prices based on the condition if the order in the market was a sell OR buy order. Then, I just popped in the usual "if orders total is greater than zero", n' I was all set. That should prety much cover it.
Thank you.
OK, it isn't what I intended but I should have been clearer with my requirement . . . your code does not set a SL & TP . . . but anyway let me revise my requirement . . .
Using the same Demo account . . .
then when you are done please show your code and the line from the log showing the ticket number
Simon,
Ah, sorry, I did not fully read your first instructions, and didn't code what you asked. Oh well, you added a new requirement list, so I'll get busy.
before I do, I will state what I am about to do...
1. Find ticket number of order placed on USDJPY.
2. Print ticket number to the log in the form "Ticket number for USDJPY = ".
3. Use ticket number to select the order AND modify the order so that it has a TP & SL and close it.
4. Show code and a line from log showing the ticket number.
With that said, I want to be clear we are on the same page.
Yeah, I can do 1. (obviously I can't use the "currency functions" to isolate the tickets right?)
Yeah, I can do 2.
3. Don't you mean, use OrderSelect() function to select the order AND modify it so it has a TP & SL and close it?
4. Obvioiusly, I'll show code ;)... a line from log showing ticket number ( what you could have asked for was a "visual snapshot" of the log showing the ticket number. No-matter)
Please post a response first before I begin task.
Thank you.
With that said, I want to be clear we are on the same page.
Yeah, I can do 1. (obviously I can't use the "currency functions" to isolate the tickets right?)
Yeah, I can do 2.
3. Don't you mean, use OrderSelect() function to select the order AND modify it so it has a TP & SL and close it?
4. Obvioiusly, I'll show code ;)... a line from log showing ticket number ( what you could have asked for was a "visual snapshot" of the log showing the ticket number. No-matter)