I wanted to save every occurring trade made by a strategy into a CSV file as they happen (upon new trade -> open file -> save trade -> close file). To achieve this, I wrote a new PerformanceMetric script because it provides a convenient method that one can override: protected override void OnAddTrade(Cbi.Trade trade).
The Cbi.Trade object contains everything I need.
Now, my questions/concerns are:
- Is this a good approach? I tried to write AddOns and Indicators but was unable to get the same results. There is always some piece of data missing.
- I tried this with a backtest only. Will this performance metric script work once I start the strategy in real-time?
- How can I get the strategy name from within the performance metric script? I would help to create one CSV file per strategy.
Thank you!
Damián.
Comment