What I want to do now is to create Trades from these Executions, which I can then export for example.
The trade object can be created like this:
Trade trade = new Trade(entryExecution, exitExecution, qty);
When I just use simple orders with one buy and one sell then this code could work:
private Execution entryExecution = null; private void OnExecutionUpdate(object sender, ExecutionEventArgs e) { Execution execution = e.Execution; // doesn't work with position scaling if (entryExecution == null) { entryExecution = execution; } else { trade = new Trade(entryExecution, execution, 1); entryExecution = null; Print("Trade: " + trade); } }
Is there an easier way to extract trades from executions similar to the way they are displayed in the Trade Performance tab? Or do I need to manually calculate these with all the order handling metrics?
Comment