Gamestudio Links
Zorro Links
Newest Posts
Detrend=SHUFFLE?
by jcl
52 minutes 54 seconds ago
type casting issue
by hatten
Today at 13:44
bmap_process crashes
by Superku
Today at 13:43
Intercept Friday Daily Close
by OptimusPrime
Yesterday at 19:25
tmf...
by MINER
Yesterday at 10:43
Multiple BB Bands
by jcl
Yesterday at 09:45
Using R
by jcl
Yesterday at 09:41
AUM Magazine
Latest Screens
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Evonet Beta v1.0 : Online Project Development Template
Lake scene
Who's Online
14 registered (AndrewAMD, AndyDow, kvm, hatten, PriceAlgoTrader, chsmac85, jenGs, CocaCola, 3 invisible), 483 Guests and 7 Spiders online.
Key: Admin, Global Mod, Mod
Newest Members
PersianBoy, xenomoprhen, PriceAlgoTrader, Tomber, MorganP
18126 Registered Users
Topic Options
Rate This Topic
#473739 - 08/09/18 14:14 OrderOpenPrice and OrderLots
Tavasy Offline
Newbie

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

Registered: 02/24/17
Posts: 317
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: 8
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