Hi @Zheka,

I guess it depends on what you actually mean by "generated", "pending", "placed", etc.

It sounds like you're in a single Bar, correct? (I.e., you're not trying to do this on a later Bar after the trades were long ago entered & filled?)

So, don't enter a trade until you know whether you want it to be real or phantom.

Accumulate your "generated", "pending", desired trades in an array, and at the end of the run() spin through the array entering real or phantom as needed to "place" them correctly?

HTH.