Here's the situation: I have a strategy with 3 sets of conditions producing long orders, and 2 sets of conditions producing short orders. They are all assigned names and associated exits through the condition builder.
When the second entry occurs, adding to my position, the Unrealized PnL data are now calculated from the average position price. I understand the only way to handle the entry prices independently is through the Order object.
My goal is to block exiting the second entry (and later, the third entry) unless the Unrealized PnL relative to the individual entry price, not the average entry price, is greater than zero (in other words, price is greater than entry price). I imagine the current conditions in the OnBarUpdate section may have to be edited to reference the correct objects because they currently reference Unrealized PnL according to the Average Position Price. But I have no clue how to put this into code.
Any help the community can offer is greatly appreciated.
Comment