How do I get the highest/lowest price of an instrument for an open trade (filled order)?
Here's an example:
5 minute chart
- New bar opens at 22 goes to 31, drops to trigger price at 20.
- Long order filled at time 2m:45s during a bar at a price of 20. A breakeven trigger price is set in my strategy for 30. That is, if the price hits >= 30, move the stop loss to 21 (breakeven + 1 tick)
How do I track the highest price after order entry? Since the High of the bar is greater than 30, High[0] will not work. Tracking Close[0] may not work since price moves quickly, my code may look at Close[0] when its 29, do other stuff (Close[0] hits 30), and then look at Close[0] again but its back to 29. My strategy missed when price hits 30.
My strategy works on Calculate = Calculate.OnPriceChange, which where I would prefer to keep for performance reasons.
I know the Trade class has MAE and MFE, which is what I want, but that doesn't become available until the trade is completed. Is there any NT8 class that tracks MAE/MFE during an open trade?
Thanks,
Matt

Comment