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
For me it is really hard to understand what you want.
You only have 2 options:
and
I am wanting a way that when I select externally the order ticket number, in that code above, it will use that ticket number within the function and close just that ticket number? Hope that makes sense?
1. If you place orders manually then you do not have the order ticket , nor can you assign a magic number. Therefore you need a code that will get the order ticket(s) and then you can map the ordinal number (this is what you select) to the order ticket to close the order.
2. And if you place orders through code (i.e. OrderSend()) then you have the order ticket and you could store it in a simple array at position corresponding to the number of the order (its ordinal number, i.e. 1 .. 4) and therefore retrieve it later on by position (ordinal number = what you select), to close the order.
In example:
You entered 4 pending orders manually.
Then your code has to scan the order queue and get the order tickets into an array of a capacity of 4, in the right order.
Then, when you later on select an order number (its ordinal number 1 .. 4) for closure, your code simply looks up the order's ticket at that position form the array and closes the order.
Here a (incomplete) code sample how this could look like: