I have order 1 (entryOrderLong1) and order 2 (entryOrderLong2) in one strategy. Each one seems to need its own profit target and stop. Unless I am doing something wrong, this seems to result in Position.AvgPrice just returning the average price for entryOrderLong1 and a different average price for entryOrderLong2. So when I try to set the profit targets, I can set them each correctly based on its own price average, but it is not correct for the entire strategy.
Example, entryOrderLong1 is filled for 2 contracts at 90.85 and entryOrderLong2 gets filled for 4 contracts at 90.75. 90.85 is the Position.AvgPrice for entryOrderLong1 and 90.75 is the Position.AvgPrice for entryOrderLong2. The real average for the 6 contracts is 90.78. I want my profit target to be 10 ticks above 90.78 for all contracts. Now, if the strategy averages down again at 90.65 for 4 more contracts, the Position.AvgPrice for entryOrderLong3 is 90.65, but now my price average for all open contracts is 90.73. I would now want my profit target for all open contracts in the 3 orders to be 90.83 (10 ticks above 90.73).
How would I handle this? If there some kind of variable like Position.AvgPrice that applies to all open contracts, then it should be fairly simple.
Is there one Position.AvgPrice that applies to all open contracts in the strategy?
NinjaTrader is aware of this value which means it exists somewhere, but I can't locate it. See attached image.
Thanks for responding. I realized in doing some more investigation that it isn't the average price I am having trouble with and need solving. The real issue is how to modify the target orders later so that they continue to be 10 ticks away from the position average as more contracts are purchased and the position average changes. Since it is based on some code I found in the Elite section, I would have to post the code somewhere over there. Actually, the code is pretty much this:
I have just made very slight changes for entry signal and entry price, but those changes have not affected the structure of the code. So apparently, what I am ending up with currently is multiple profit target orders each placed x number of ticks from the Position.AvgPrice at the time the order was filled.
Can you provide an example of how to move my target orders to be x number of ticks away from Position.AvgPrice as it changes?