i am triying to write trade info in a .cvs file in backtest mode (then i want to use these method with a i live account), (understanding real time writing trade info when position is closed). I've created a method (logTradeToCVS) that writes this info in a .cvs file, my problem is the last 3 trades are never written in .cvs file.
This is part of my code just to show you where i am calling the method...
protected override void Initialize() { //code } protected override void OnBarUpdate() { // Exit positions if (Position.MarketPosition == MarketPosition.Long) { ExitLong(); logTradeToCVS(); } if (Position.MarketPosition == MarketPosition.Short) { ExitShort(); logTradeToCVS(); } } Print (Performance.AllTrades.Count); // prints 546
PD: logTradeToCVS method is using try-catch blocks and no errors, i mean, trade info is correctly written arround 543 trades but 3 last trades. 546 in the collection, 543 in my .cvs file...
Sorry about my english,
Vince.
Comment