Gamestudio Links
Zorro Links
Newest Posts
Performance reporting showing Annual and monthly % returns
by OptimusPrime
Today at 01:19
Issue with inconsistent test results
by kvm
Yesterday at 17:24
Access string content through another string
by ChrstphFr
Yesterday at 11:30
How to return a vector from a function
by Superku
Yesterday at 05:39
Vector Displacement, realtime Blendshapes
by jumpman
08/14/18 23:46
Code Repository
by OptimusPrime
08/14/18 13:25
Votes for future features
by OptimusPrime
08/14/18 07:18
AUM Magazine
Latest Screens
AckCon'18 - Lotter vs the World 2 - Preview Release
Evonet Beta v1.0 : Online Project Development Template
Lake scene
Forgotten Tales - Demo version
Who's Online
4 registered (alibaba, bailemad, Seymour, 1 invisible), 444 Guests and 3 Spiders online.
Key: Admin, Global Mod, Mod
Newest Members
Ulenspegel, toto, FloMi, behr065, OptimusPrime
18027 Registered Users
Topic Options
Rate This Topic
#473739 - 08/09/18 14:14 OrderOpenPrice and OrderLots
Tavasy Offline
Newbie

Registered: 08/02/18
Posts: 7
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);


Edited by Tavasy (08/09/18 14:59)

Top
#473741 - 08/09/18 15:59 Re: OrderOpenPrice and OrderLots [Re: Tavasy]
Dalla Offline
Member

Registered: 02/24/17
Posts: 271
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.

Top
#473742 - 08/09/18 16:27 Re: OrderOpenPrice and OrderLots [Re: Dalla]
Tavasy Offline
Newbie

Registered: 08/02/18
Posts: 7
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

Top



Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de