I am wondering if there's any good way to compare positions across two strategies within WealthLab or within a combination strategy.
What I'd like to do is use the EnterAtPrice / ExitAtPrice methods within a "strategy" that imports my actual trades and use that as a way to compare the actual trades that I held on a given bar with what my strategy would have me do, then PrintDebug() a list of exceptions (where I held a position I shouldn't or didn't hold a position I should, according to my strategy) along with the profit/loss that I incurred by deviating from the model.
What I'd ideally like to do would be to have both strategies (the model and the EnterAtPrice actual) inside a single strategy a set of Position objects for Actual and another set of position objects for Model then do something like:
QUOTE:
for(int bar = 0; bar<Bars.Count-1;bar++)
{
foreach(Position a in Actual.Positions)
{
foreach(Position m in Model.Positions)
{
if(a.Symbol == m.Symbol) PrintDebug("Matched: "+bar+" "+a.Symbol);
}
}
}
but I know exactly that won't work. Any ideas?
Size:
Color:
In addition to matching Bars.Symbol, you need to check the Position.EntryDate and ExitDate.
Better not to use EntryBar/ExitBar in multi-symbol portfolio simulations: use EntryDate/ExitDate in this case.
Size:
Color:
That makes sense, but to the larger question is there a good way to manage two different sets of position objects within the same strategy?
Size:
Color:
What is a bad way and a good way? What's the problem?
Size:
Color: