Useful features from KimIV - page 103

 
T-G:

Igor has functions NumberOfOrders and NumberOfPositions that return the number of orders and positions. How can I make a universal function that would return both

OP_BUY and OP_SELL and OP_BUYSTOP and OP_SELLLIMIT in one function?


Fill in the array of counters - for each order type.
 
VladislavVG:
fill in an array of counters - for each order type.
How does it work? The function should return either a specific order type or if -1, all 6 types
 
T-G:
How does it work? The function must return either a specific order type or if -1, all 6 types
.
The function cannot return an array. It has to be passed into the function by reference and filled in the function. Then the array elements can be used externally as counters of a given order type.
 
T-G:

Igor has functions NumberOfOrders and NumberOfPositions that return the number of orders and positions. How can I make a universal function that would return both

OP_BUY and OP_SELL and OP_BUYSTOP and OP_SELLLIMIT in one function?



It is not very difficult to make. Or rather, there is one. More than once I have posted mine on all types of orders
 
T-G:

Igor has functions NumberOfOrders and NumberOfPositions that return the number of orders and positions. How can I make a universal function that would return both

OP_BUY and OP_SELL and OP_BUYSTOP and OP_SELLLIMIT in one function?


How hard would it be to add them up? NumberOfOrders+ NumberOfPositions
 
Vinin:

It's not hard to do. Or rather, there is one. I have posted mine more than once on all types of orders
It will take you 5-10 minutes to write it. What is so difficult about it? IMHO, it is more useful to do it yourself, or at least try.)
 

Please tell me what's wrong ???? It opens two pendants and deletes them at once. I need the second one to be deleted when one triggered..... please help...... I've been struggling with it for 2 days now.......


int total = OrdersTotal();

int i;
if ((Ask>=OP_BUYSTOP || Bid<=OP_SELLSTOP)==-1)
{
i=0;
total = OrdersTotal();
for(i = 0; i <= total; i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if(OrderMagicNumber() == 227)
{

if(OrderType()>1)OrderDelete(OrderTicket());
}
}
}
 
VOLDEMAR:

Please tell me what's wrong ???? It opens two pendants and deletes them at once. I need the second one to be deleted when one triggered..... please help...... I've been struggling with it for 2 days now.......


int total = OrdersTotal();

int i;
if ((Ask>=OP_BUYSTOP || Bid<=OP_SELLSTOP)==-1) ??????? What is it ? You are comparing prices with order types. It's like this: "which is longer: a litre or a kilo ?" and why the comparison with -1 ? And for which instrument are the ask and bid between 4 and 5 constantly "dangling" ?
{
i=0;
total = OrdersTotal();
for(i = 0; i <= total; i++) // if (OrderMagicNumber() == 227) // the direction of search is wrong and out of array
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if(OrderMagicNumber() == 227)
{

if(OrderType()>1)OrderDelete(OrderTicket()); ??????? And here you delete all pending orders
}
}
}
Use code insertion tags for better readability.
 
Vladon: links in the forum are not allowed in the profile only.
Execution cannot be pardoned.
 
VladislavVG:
Use code insertion tags for better readability.
I got it ..... But how to set the deletion of a pending order when another one triggers??????????? How does meta unit see already open and pending orders ?????????
Reason: