Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (Edgar_Herrera, VoroneTZ, Akow), 973 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
OrderOpenPrice and OrderLots #473739
08/09/18 12:14
08/09/18 12:14
Joined: Aug 2018
Posts: 12
T
Tavasy Offline OP
Newbie
Tavasy  Offline OP
Newbie
T

Joined: Aug 2018
Posts: 12
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);

Last edited by Tavasy; 08/09/18 12:59.
Re: OrderOpenPrice and OrderLots [Re: Tavasy] #473741
08/09/18 13:59
08/09/18 13:59
Joined: Feb 2017
Posts: 369
D
Dalla Offline
Senior Member
Dalla  Offline
Senior Member
D

Joined: Feb 2017
Posts: 369
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.

Re: OrderOpenPrice and OrderLots [Re: Dalla] #473742
08/09/18 14:27
08/09/18 14:27
Joined: Aug 2018
Posts: 12
T
Tavasy Offline OP
Newbie
Tavasy  Offline OP
Newbie
T

Joined: Aug 2018
Posts: 12
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


Moderated by  Petra 

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

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

Powered by UBB.threads™ PHP Forum Software 7.7.1