First, I used a basic method, which I learned was failing because each stock that I trade was in a separate strategy; I was informed that there is no counting between strategies. Fair enough I said.
Second I was instructed to use the OnExecution update method to expose account information. Tricky, but accomplished. However, my counter seemed to get stuck in a repeating loop and ignore the -1 i assigned to exited positions. So it would grow all day regardless of how many positions I had just closed. This method is unsupported by NT
staff, so again I was stuck. I even found a sub method that would display the correct number of Positions, but I could not extract long versus short.
System.Int32 PositionCount1 = account.Positions.Count;
Finally, I spent all weekend working with Arrays in a single strategy. I am not sure if OnBarUpdate has issues working with Arrays, or if I am doing something wrong, but in creating a strategy meant to execute against Bars 2,3 and 4, bar 3 never outputs and bar 4 never increments. Whatever stock is placed as Bar 2 works just fine, however.
This leaves me with one working equity, exactly where I started.
I will post the code below and ask for someone to step up and provide a dose of help on this problem, as this risk management tool is the final barrier that is preventing my partner and me from going live in an account which has been set up, fully funded and ready to go.
Code below.
Thanks and regards,
Andrew

Comment