Gamestudio Links
Zorro Links
Newest Posts
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Trading Journey
by 7th_zorro. 04/27/24 04:42
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, 1 invisible), 770 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 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