Download MetaTrader 5

How may I calculate the actual profit of an open order? - page 3

To add comments, please log in or register
Ubzen
5394
Ubzen  
MetaNt: That's what I thought, but it doesn't get the chance, as every order after the first closes immediately.
Every order needs to be selected and needs to work its way through every step within that for() loop. There's no immediate closing ... just 1_order closing at a time.
Luciano Ola
1010
Luciano Ola  
ubzen:
Every order needs to be selected and needs to work its way through every step within that for() loop. There's no immediate closing ... just 1_order closing at a time.


I tried it again with some adjustments so that it more closely resembled your suggestion but the issue I had the first time I tried it (instant closes) had reoccurred, I'm just going to have to think about this some more I guess.
Luciano Ola
1010
Luciano Ola  

Scrapped the variables, all is well, will review my code after I fix some other errors, it's been a while since I last reviewed it and things are getting convoluted. When I say scrapped the variables I mean OOPrS and OOPrB, I'm still calculating the order profit but I'm just not binding a variable to it.

I would like to ask, what may cause only half an order to close instead of an entire one? Could it be an OrderClose() mix up?

Simon Gniadkowski
Moderator
18023
Simon Gniadkowski  
MetaNt:

Scrapped the variables, all is well, will review my code after I fix some other errors, it's been a while since I last reviewed it and things are getting convoluted. When I say scrapped the variables I mean OOPrS and OOPrB, I'm still calculating the order profit but I'm just not binding a variable to it.

I would like to ask, what may cause only half an order to close instead of an entire one? Could it be an OrderClose() mix up?

Perhaps you are selecting the wrong order when you use OrderLots() ? Print your variables . . .
123
To add comments, please log in or register