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
I wrote a small script to test the "ordering"(which is selected when using SELECT_BY_POS) of the function "OrderSelect()", and confirmed that
selects the "last" order has JUST been opened.
I also noted (surpringly) that ALL my orders (pending or opening) i placed on ALL symbols are in the "trading pool" and can be selected by OrderSelect()...so can you be sure you get the right order when you run the above command?? --- perhaps another order just having been opened...
So perhaps whroeder1's idea is better.
Don't do it... you'll be sorry... ;) The order pool isn't always ordered (no pun intended).
I want to find "one to the last" open order that is not pending. I mean I want to know ticket number of "one to the last" buy or sell. I used this codes but it doesn't work. I t returns the last order includes pending orders too! Could you help me?
It works correctly right now!
Thanks a lot Hector!!
But Hector, I wonder why this is like that.
What is technically difference between our coding?
In second's select loop, you call LastOrderTicket() and then compare that to OrderTicket. LOT selected a ticket (position zero) which is what will be compared, not the ticket you selected before the call.
I'd simplify buy just returning a list of tickets and you can get any position you want instantly. (Trade pool is sorted, history is not.)
In second's select loop, you call LastOrderTicket() and then compare that to OrderTicket. LOT selected a ticket (position zero) which is what will be compared, not the ticket you selected before the call.
I'd simplify buy just returning a list of tickets and you can get any position you want instantly. (Trade pool is sorted, history is not.)
Skipping the magic number check just means that you want the program to handle all orders. This is something you would need to do when there are mixed sources for the open orders and you want to close them all, say at some net profit or loss. Also complicating matters is dealing with FIFO rules, you couldn't let multiple experts open and close orders on the same currency pair without taking all of the open orders on that pair into account because inevitably you'll end up trying to close an order that isn't the oldest order for the pair.
Hi
I am building an EA.
Please someone help to select or write a function to return "LAST CLOSED ORDER's Volume (Lot size) " using EA's Magic number and currency pair. It would be much better if someone can show me to get "lot Size" of the LOSS TRADE only (dont need Profitable trade's lot size) . I appriciate any help. Thank you
int OrderOpenWeekDay = TimeDayOfWeek( OrderOpenTime() );