I am developing an intraday strategy but I need to include the cost of spent money during optimization. The exact problem is knowing how many nights (notice the intraday nature of the strategy) does a position is being held, and then change the P&L accordingly.
Does Wealth-Lab include any feature for this?
If not, could you have a custom commision using C# code?
If not, can we affect the P&L using code?
Size:
Color:
To make up a Portfolio Simulation, Wealth-Lab first runs a 1-share Raw Profit backtest of your Strategy on each symbol individually in serial manner. Then to build a portfolio backtest, it applies position sizing using real-world rules against a list of trades compiled during the initial run. By that time, the Strategy's code has already finished executing. Consequently, it does not have the knowledge of money spent because it was executed with 1 share.
One can't affect the P&L from Strategy code but it's possible to create a custom commission plan. For an example, please visit this Wiki page to download sample code:
Home - Community.Commissions. Since the precise amount of trading costs is available to performance visualizers, it's reflected on the Performance tab (Total Commission).
The
real problem is how to pass the number of nights to the commission structure. The Commission interface doesn't have the knowledge of positions (it works with orders). At the moment, no elegant solution to this problem comes to mind.
Size:
Color:
Eugene, I have the same problem when calculate the Forex overnight swaps. The solutions which I have (not an elegant one) is to save the date to file before the order execution in traiding strategy. Then take this date from file in commission. Any other ideas?
Size:
Color: