for(int i=0;i<PositionsTotal();i++){ if((order_ticket=OrderGetTicket(i))>0)
- You are mixing positions and orders.
- You can't use any Trade Functions until you select a position or order.
whroeder1:
I thought OrderGetTicket() is supposed to select the order and return it's ticket?
- You are mixing positions and orders.
- You can't use any Trade Functions until you select a position or order.
I've read the guide, isn't OrderGetTicket () supposed to select and return the order according to the index passed into it.
E.g OrderGetTicket (1); should select and return the ticket of the order with number 1 index
holocast :
I've read the guide, isn't OrderGetTicket () supposed to select and return the order according to the index passed into it.
I've read the guide, isn't OrderGetTicket () supposed to select and return the order according to the index passed into it.
E.g OrderGetTicket (1); should select and return the ticket of the order with number 1 index
You work with positions PositionsTotal. So you need PositionGetTicket, PositionGetInteger
Konstantin Nikitin:
Wonderful, thanks a lot, it now works, changing the order to position made it.You work with positions PositionsTotal. So you need PositionGetTicket, PositionGetInteger
Thanks
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
When I run this script I always get the total as zero, the counter i alerts up to the number of active orders in the terminal.
Also when I switch to OrdersTotal() instead of PositionsTotal(), it returns zero, that is the counter (i) does not count at all.
How do I get this script to return the total number of buy orders?
Why does OrdersTotal() return zero while PositionsTotal() returns the number of active orders in the terminal?
P.S am running this code on MT5