Assume we are using ImmediateExecutionModel and CompositeRiskManagementModel combining MaximumUnrealizedProfitPercentPerSecurity and MaximumDrawdownPercentPerSecurity. 

If I emit an Insight, there will be a market order submitted. There are three possibility about how this position will be closed: 

1. hit the target (the maximum unrealized profit); 

2. hit the stop (the maximum drawdown); 

3. the time is up (the insight length expires).

 

I want to keep track of whether every trade is a winner or a loser. My question is: how do I keep track of the three possible closes of a trade in an Alpha? Rewrite the risk management model? I can't seem to find where it is done. I also think about trying OnOrderEvent, but it is under the QCAlgorithm, not the AlphaModel. I'm unable to find a way to pass variables between them because I don't understand how the class AlphaModel works deeper inside. Any suggestions is appreciated!

Author