Why SaveTrades outputs 625 out of 785 trades?
Author: pubx101
Creation Date: 3/23/2018 2:53 PM
profile picture

pubx101

#1
Are there any examples or documents for writing all trades from back test result pane to a file? I tried method:

CODE:
Please log in to see this code.


there are 785 trades in the 'Trades' tab and there are only 625 trades found in the file. Both the file and Trade tab have the same starting dates, but the file misses recent trades and some trades for certain days . thanks
profile picture

Eugene

#2
It's surprising that the number is less - you're probably missing something. Actually, the number of trades exported by SaveTrades might exceed the total number of trades on the Trades tab if your Strategy is run in a Portfolio Simulation mode. This is due to the fact that Wealth-Lab executes Strategy code in Raw Profit mode on a symbol basis in alphabetical order. By the time it applies the position sizing overlay your code has already finished exporting all the theoretical trades to file.

This is a trait of any code that saves positions to file, not just a "limitation" of the C.Components method. Same would happen if you'd try to do it in a WealthScript Strategy. So if you wish to match the Trades tab, run your code in a Raw Profit mode. As Performance Visualizer has access to the final collection of Positions after the position sizing, a workaround might be to develop one very simple module with the sole purpose of file export.
profile picture

pubx101

#3
Is it to possible to save trades in simulation mode ? Yes, I want to export the same trades as in the Trade tab, anything example or anything I need to know to do it?
profile picture

Eugene

#4
QUOTE:
Is it to possible to save trades in simulation mode ?

I've just answered your question in detail in post #2.

You can "Save to text file" manually from Trades+ visualizer, found in the MS123 Performance Visualizers library. Read the User Guide on how to enable it after WLP restart.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).