OrderOpenPrice and OrderLots

Posted By: Tavasy

OrderOpenPrice and OrderLots - 08/09/18 12:14

Hello All

I am trying to get an average price in relation to OrderLots and OrderOpenPrice are there predefined functions I can use. I am a newbie.

double AveragePrice = 0;
double Count = 0;
for (cnt = OrdersTotal() - 1; cnt >= 0; cnt--) {
sel = OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol() != Symbol() || OrderMagicNumber() != MagicNumber) continue;
if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) {
if (OrderType() == OP_BUY || OrderType() == OP_SELL) {
AveragePrice += OrderOpenPrice() * OrderLots();
Count += OrderLots();
}
}
}


if (OrdersTotal() > 0) AveragePrice = NormalizeDouble(AveragePrice / Count, Digits);
Posted By: Dalla

Re: OrderOpenPrice and OrderLots - 08/09/18 13:59

It would be helpful if you asked a specific question that you have, rather than posting code and let us guess what problem you might have. If you get an error message, post that. If you are getting another value than you expect, post the expected value and the value you are actually getting etc.
Posted By: Tavasy

Re: OrderOpenPrice and OrderLots - 08/09/18 14:27

Sorry Dalla

English is not my first language, what I was trying to ask is
what are the equivalent functions for OrderLots and OrderOpenPrice, the code I posted is from MT4 and I wanted to code it in Zorro
© 2024 lite-C Forums