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

 
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.
 
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.
 

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?

 
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 . . .
Reason: