Edit Your Comment
OrdersTotal in a specif pair of currencies
forex_trader_318221
Member Since Apr 07, 2016
32 posts
Aug 15, 2016 at 05:08
Member Since Apr 07, 2016
32 posts
Hi guys!
I have another problem…
I want make this:
if(the number of orders in EURGBP < 2){do it…}
I know the function OrdersTotal(), but I don’t want to know the total, I want to know the total in EURGBP! So, how can I do it?
Thanks again!!
I have another problem…
I want make this:
if(the number of orders in EURGBP < 2){do it…}
I know the function OrdersTotal(), but I don’t want to know the total, I want to know the total in EURGBP! So, how can I do it?
Thanks again!!
Member Since Aug 20, 2009
266 posts
Aug 15, 2016 at 06:45
(edited Aug 15, 2016 at 06:48)
Member Since Aug 20, 2009
266 posts
Use this function :-
int Trade_Count(int My_Magic, string my_symbol)
{
int
counter = 0;
for(int i = OrdersTotal()-1;i>=0;i--){
if(OrderSelect(i,SELECT_BY_POS)>0){
if(StringFind(OrderSymbol(),my_symbol,0)>-1){
if(OrderMagicNumber()==My_Magic)counter++;
}
}
}
return(counter);
}
Function call would be something like :-
Number_of_Orders = Trade_Count(12345, 'EURGBP');
int Trade_Count(int My_Magic, string my_symbol)
{
int
counter = 0;
for(int i = OrdersTotal()-1;i>=0;i--){
if(OrderSelect(i,SELECT_BY_POS)>0){
if(StringFind(OrderSymbol(),my_symbol,0)>-1){
if(OrderMagicNumber()==My_Magic)counter++;
}
}
}
return(counter);
}
Function call would be something like :-
Number_of_Orders = Trade_Count(12345, 'EURGBP');
Wealth Creation Through Technology
Member Since Aug 20, 2009
266 posts
forex_trader_318221
Member Since Apr 07, 2016
32 posts
Aug 17, 2016 at 10:30
(edited Aug 17, 2016 at 10:50)
Member Since Apr 07, 2016
32 posts
I tried again, but, without successful...
I think the problem is in the word 'my_symbol'. I substitued it for EURGBP, 'EURGBP' and 'EURGBP' (with and without string before) and the code continues to give problem...
I think the problem is in the word 'my_symbol'. I substitued it for EURGBP, 'EURGBP' and 'EURGBP' (with and without string before) and the code continues to give problem...
Member Since Aug 20, 2009
266 posts
forex_trader_72824
Member Since Apr 08, 2012
10 posts
Aug 17, 2016 at 15:47
Member Since Apr 08, 2012
10 posts
JHenrique posted:Didn't work...
Hi guys!
I have another problem…
I want make this:
https://monitorfx.pl/
if(the number of orders in EURGBP < 2){do it…}
I know the function OrdersTotal(), but I don’t want to know the total, I want to know the total in EURGBP! So, how can I do it?
Thanks again!!
*Commercial use and spam will not be tolerated, and may result in account termination.
Tip: Posting an image/youtube url will automatically embed it in your post!
Tip: Type the @ sign to auto complete a username participating in this discussion.