@asuralm said in Exit on the same bar of entry problem:
However, the problem is that the target order only be sent at the next bar but not within this bar.
This is not a problem and the order is not sent with the next bar. It is sent when issued, it is only considered for execution when the new prices are available.
Because the "current bar" is already closed (you cannot operate on its prices without cheating)
@asuralm said in Exit on the same bar of entry problem:
@ab_trader
There is a problem if I send both orders in the next.
the actual fit price is not known in next.
That's again not a problem. It's how trading works. You cannot operate on the price you currently see (you can only expect to get it in the future, but you may not) and you don't know what the next incoming prices will be.
@ab_trader said in Exit on the same bar of entry problem:
You can use cheat-on-open feature
As suggested by @ab_trader you can use cheat-on-open to have a chance to operate on incoming prices, but that defeats the purpose of backtesting and getting a profitable entry/exit approach, because you are examining prices before executing actions, what you actually cannot do in real life.
See: Blog - Cheat On Open