Why is it that hiding take profit and stop loss using OrderClose() gives different results, when compared to using OrderModify() ?

 
Why is it that hiding take profit and stop loss using OrderClose() gives different results, when compared to using OrderModify() ?
 
eddiewillers:
Why is it that hiding take profit and stop loss using OrderClose() gives different results, when compared to using OrderModify() ?
Because your code is broken or you are not considering that spread is different between tests.
 
RaptorUK:
Because your code is broken or you are not considering that spread is different between tests.


Spread isn't different between tests because I use Birt's Tick Data Suite to use all ticks with their real variable spread for each tick. 99% modeling quality.

So the only option left is that my code is broken. I made 40% profit after doing 59 trades since 8th Jan using the OrderModify() version which reveals my stops and take profits in the order book. And so I am sure this means there error lies in the part which hides the stops and take profits.

Is it possible that OrderClose() runs on a separate thread, and has random delays added to it, so by the time OrderClose() actually works, the Strategy Tester has moved on to other ticks at high speed?

 
eddiewillers:


Spread isn't different between tests because I use Birt's Tick Data Suite to use all ticks with their real variable spread for each tick. 99% modeling quality.

So the only option left is that my code is broken. I made 40% profit after doing 59 trades since 8th Jan using the OrderModify() version which reveals my stops and take profits in the order book. And so I am sure this means there error lies in the part which hides the stops and take profits.

Is it possible that OrderClose() runs on a separate thread, and has random delays added to it, so by the time OrderClose() actually works, the Strategy Tester has moved on to other ticks at high speed?

We have to close the trades with OrderClosePrice() if we are using hidden levels for broker

That can be the trade get closed at Ask or Bid   depends on Type

If you store those prices and then compare it with the price of the trade then the spread is calculated if you compare it with right stored price 

 
eddiewillers:


Spread isn't different between tests because I use Birt's Tick Data Suite to use all ticks with their real variable spread for each tick. 99% modeling quality.

So the only option left is that my code is broken. I made 40% profit after doing 59 trades since 8th Jan using the OrderModify() version which reveals my stops and take profits in the order book. And so I am sure this means there error lies in the part which hides the stops and take profits.

Is it possible that OrderClose() runs on a separate thread, and has random delays added to it, so by the time OrderClose() actually works, the Strategy Tester has moved on to other ticks at high speed?

No,  absolutely 100% no.  The next tick is not used until start() has returned,  the speed at which start() runs is the governing factor of the max speed setting in the Strategy Tester,  there cannot be missed ticks in the Strategy Tester, it is impossible.
Reason: