I am having a strange problem with either Print Statements or when using StreamWriter where Print / WriteToFile statements are being repeating many times over. Eventhough, I am using BarsInProgress to segregate logic and I am sure the Prints / WriteToFile should not be repeating.
After adding some additional Print statements that DO get executed each bar the issue goes away.
Therefore I believe that what is happening is that the bars where no Print statement should be executing seems to be printing the last message.
This is for a Multi Data Series Strategy and if I include the following which prints messages each bar all seems to go as expected:
if (BarsInProgress == 0) { message = string.Format("{0:dd/MM/yyyy H:mm:ss.ffff} Bar: {1} | MTC Bar : O: {2} H: {3} L: {4} C: {5} ", dt, CurrentBars[BarsInProgress], Open[0], High[0], Low[0], Close[0]); //WriteToFile(message, pathToWrite); Print(message); } else if (BarsInProgress == 1) { message = string.Format("{0:dd/MM/yyyy H:mm:ss.ffff} Bar: {1} | STC Bar : O: {2} H: {3} L: {4} C: {5} ", dt, CurrentBars[BarsInProgress], Open[0], High[0], Low[0], Close[0]); //WriteToFile(message, pathToWrite); Print(message); }
I am on 8.0.21.1 64-bit, testing with Strategy Analyzer, all Data Sources are Tick based, All Indicators and Strategy are Calculate.OnBarClose.
Thanks,
ATC
Comment