ClearPositions In Multi-Symbol Backtest mode
Author: sedelstein
Creation Date: 9/22/2013 8:34 PM
profile picture

sedelstein

#1
In the ClearPostions() documentation in the Wealthscropt QuickRef it says

QUOTE:


Remarks
In Multi-Symbol Backtest mode, the ClearPositions method clear trades for all symbols in a DataSet. On the Trades list, only the last symbol's trades are left.

It is working by design of the new Wealth-Lab .NET, where all of the positions are stored in one list. That's why ClearPositions clears them all and does not work as expected in Multi-Symbol Backtest mode. This problem is under investigation.


I don't know when this was posted but is this issue still under investigation? The code allows for some interesting possibilities for backtests if multiple symbols could be run

Thanks for the update
profile picture

Eugene

#2
I'm afraid we will have to live with this.
profile picture

sedelstein

#3
Ok, Thanks for the update.

Out of curiosity, is there any way to access the List of Positions within a strategy?

The syntax below is incorrect but could something like the psuedo code below work?

code the ExitSignal property with the string ">50%) and then

Positions.RemoveAll ( p => p.ExitSignal contains "<50%"); // eliminate all trades with this exit signal
profile picture

Eugene

#4
But you're already accessing the List<Position> Positions, aren't you? Because the List of Positions is the List<Position> Positions.

Custom PosSizer is the straightforward way to filtering new entries by condition (e.g. exit signal) by virtue of assigning a zero size.
profile picture

sedelstein

#5
I'll check into the Custom PosSizer
profile picture

Eugene

#6
Note that if you were asking for an alternative to ClearPositions(), it's not. You can not affect existing and/or closed positions with PosSizer, what you can do is rule out new positions on some portfolio-based condition (e.g. equity dipped below a moving average of portfolio equity).
profile picture

sedelstein

#7
Related to this, I' am curious whether there is a method or property that will let me know if the current run is part of a mult-symbol backtest or in single symbol mode. I've checked (unsuccessfully) on the forums and the quick reference guide

Thanks

profile picture

Eugene

#8
profile picture

sedelstein

#9
Thank you
profile picture

innertrader

#10
I created a variation on Cone's RSI Rotation Strategy using a custom-generated indicator that uses position data from another trading strategy (child strategy). I did it all under one Execute method, creating separate loops for the child strategy and the Rotation strategy, and I sync the bars by calculation.. Both strategies use the same symbols but different buying criteria.

It looks like I got it working except for one remaining issue: Since the custom indicator requires access to the positions from the child strategy, I have to keep them in place while executing the Rotation strategy (at least if I maintain the basic flow Cone created). At the end of running both strategies, positions from both strategies are mixed together with positions from both sorted by date. I would like to discard the positions from the child strategy and only keep the ones from the Rotator strategy, including performance stats, alerts, etc.


Is there a way to delete specific positions from the list of positions, e.g. by Entry Name? It doesn't appear that the ClearPositions() function has any overloads or options to do this. Or with code sorting through a Positions list? Is it possible to modify the Positions list this way? If not, can you suggest another potential approach to accomplish the goal of getting results from the Rotator strategy without keeping data from the child strategy? Previously I had used the (unsupported) donor strategy approach which somewhat isolates the two strategies and their performance results. Do you think that's best way to go or do you have some other ideas?
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).