Exit a portion of a position after so many bars. Track the profitability of the VWAP exits to determine if the original entry was profitable or not. Determine the number of consecutive winners and losers using my VWAP exits as the measure of profitability.
Example:
Entered long 100,000 units of EUR/USD>
After 3 bars, exit 25% of the original position (25,000 units)
After 5 bars, 35% of the original position should be closed (10,000 units)
etc...
What I've done:
I reviewed the thread and sample code from this post.
Reviewed documentation of IOrder in the help guide.
Questions:
I assume that I'll be using IOrder. I don't fully understand how it works, hence this post.
- When I call the IOrder property Quantity, does that reflect the current quantity or the original quantity? I assume the answer is current quantity. If I want to save the original quantity, would I store this in a variable when calling OnExecution()? Then I get the current quantity when calling OnBarUpdate()?
- When I call the IOrder property Token and I close 25% of the position, how is the Token stored for historical trades? Will the original 75% carry the same Token as the 25% that was closed or will they differ? If they differ, is there any way to track them or am I responsible for doing this?
- I'm being optimisitc asking this... but are there any existing NS functions that do this: "Track the profitability of the VWAP exits to determine if the original entry was profitable or not."

Comment