Loop through the open orders, OrderSelect() one by one, check Symbol() and Magic Number if applicable, keep a running total of OrderLots() for the orders that match Symbol & Magic Number. Done.
If there are no way to "select all" function at orderselect() becouse, every time is unique and the number of order will not be the same, my ea working with the 10-30 orders in a day, so i have to count the lot size every new bar. If i should use orders numbers i would need to edit my ea everytime :/
Vyckaa:
If there are no way to "select all" function at orderselect() becouse, every time is unique and the number of order will not be the same, my ea working with the 10-30 orders in a day, so i have to count the lot size every new bar. If i should use orders numbers i would need to edit my ea everytime :/
If there are no way to "select all" function at orderselect() becouse, every time is unique and the number of order will not be the same, my ea working with the 10-30 orders in a day, so i have to count the lot size every new bar. If i should use orders numbers i would need to edit my ea everytime :/
Maybe you can get someone to code it for you . . . I won't.
I'll try to help once more . . .
<pseudo code start>
Loop through the open orders by position. Read here and here
If an order matched the Symbol you want and the Magic Number you want
add iit's OrderLots() to a running total
When the loop is complete your running total is the total number of lots in all your open Orders.
<pseudo code end>
double totalOpenLots = 0; for(int iPos = OrdersTotal()-1; iPos >= 0 ; iPos--) if ( OrderSelect(iPos, SELECT_BY_POS) // Only my orders w/ && OrderMagicNumber() == Magic.Number // my magic number && OrderSymbol() == chart.symbol // and my pair. ){ totalOpenLots += OrderLots(); }
Thank you guys both. That was very usefull info :) WHRoeder i will try to integrate your code into my ea and see what happens
Tran Ngoc Dung:
i have a litle code (EA) for calc total lotsize, I hope it helps
<ex4 file removed>
Please only attach mq4 source files.
Keith Watford:
Please only attach mq4 source files.
Sorry, i have edited my post. Thankyou!
Can it show total used lot size?
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
Hello, i wrote my EA. now to finish it i need just to count how many lots is used total from active orders. So maybe you have ideas what function should i use to get the total lots used at the moment from active orders.
for exmp.
order nr:
1.0.01
2.0.02
3.0.03
4.0.05
so i need a sum of all theese, i need to get 0.11)
exmpl;
double usedlots = ???(help) ;
if(usedlots == 0.11)
then = dothat;
else
nothing;
Thank you, i hope you understand :)