I was making good progress on
my project until I got to the export. I incorporated the following code:
CODE:
Please log in to see this code.
Since then I have this bizarre behavior where StreamWriter is duplicating the output multiple times. It turn out the multiple = number of symbols in the folder. (I.e., With 2 symbols it repeats the entire output over again once, and with 4 symbols you get it 4 times. It appears to work fine in the debugger.
Here's the output file after a run with 4 symbols:
QUOTE:
XLI, 9, 18, 0.250555555555557, 0.300016910246341
GE, 8, 7, 0.2305625, 1.95979660076962
CHK, 2, 14, 0.01885, 3.59852619808521
TEVA, 10, 19, 0.27478, 2.40909228238562
XLI, 9, 18, 0.250555555555557, 0.300016910246341
GE, 8, 7, 0.2305625, 1.95979660076962
CHK, 2, 14, 0.01885, 3.59852619808521
TEVA, 10, 19, 0.27478, 2.40909228238562
XLI, 9, 18, 0.250555555555557, 0.300016910246341
GE, 8, 7, 0.2305625, 1.95979660076962
CHK, 2, 14, 0.01885, 3.59852619808521
TEVA, 10, 19, 0.27478, 2.40909228238562
XLI, 9, 18, 0.250555555555557, 0.300016910246341
GE, 8, 7, 0.2305625, 1.95979660076962
CHK, 2, 14, 0.01885, 3.59852619808521
TEVA, 10, 19, 0.27478, 2.40909228238562
Here's the output in the Debug window for the same run:
QUOTE:
Number of Closed Positions is 87
XLI
Winners: 9
Losers: 18
Avg Profit = 0.250555555555557(0.300016910246341%)
Avg Loss = -0.235755555555557(-0.28323341685171%)
1
GE
Winners: 8
Losers: 7
Avg Profit = 0.2305625(1.95979660076962%)
Avg Loss = -0.0864285714285715(-0.678514893752169%)
2
CHK
Winners: 2
Losers: 14
Avg Profit = 0.01885(3.59852619808521%)
Avg Loss = -0.00499285714285713(-0.936601238412572%)
3
TEVA
Winners: 10
Losers: 19
Avg Profit = 0.27478(2.40909228238562%)
Avg Loss = -0.0859473684210525(-0.708833719691789%)
4
The code for the PrintDebug and Streamwriter code are in the same context as you can see below. I put a counter in to see if i was looping more times than I thought, but it was equal to the # of symbols, which it should be. Still I thought I must be executing code within another loop I was not aware of, but I can't see it.
Is it possible a StreamWriter or AppendText bug could be causing this? Could there be some caching from the System variables that need to be flushed?
Code is below. Please let me know if you see something.
CODE:
Please log in to see this code.