I noticed the results of a strategy I ran using runDonor (now ExecuteDonorStrategy) didn't match the results when running the strategy normally. NetProfit was wrong, APR was wrong, etc. Looking further, I noticed that runDonor was picking a different number of shares than the normal method. I was using a simple
Percent of Equity: 100 Position Size, but runDonor was using 10% sizing. Looking at PortfolioEquityEx.cs, I notice some code to set PosSize on the TradingSystemExecutor, like this:
CODE:
Please log in to see this code.
In my case PctEquity never gets set. I assume it defaults to 10%. I have not spent a bunch of time with this code, but I don't understand why ExecuteDonorStrategy is cherry-picking properties from
ps and stuffing them into
exec.PosSize. Instead I wonder why those dozen or so lines can't be replaced with this:
CODE:
Please log in to see this code.
This solved my issue, though I didn't run any other tests besides the Percent of Equity: 100 PosSizer, so not confident I didn't break something else, but hard to imagine why only some properties were being set.
-Jared
Size:
Color:
Size:
Color:
Thanks for the quick response.
Before I went to the code I did review that FAQ as part of my troubleshooting and also tried setting meaningful priorities on my trades. Didn't work. I also looked for NSF trades to explain it and that wasn't it either. I should have said this in my first post but it slipped my mind -- I was trying so many things to fix it -- until you mentioned it.
I said PctEquity never gets set. My mistake. I meant PctSize.
Here's some code that demonstrates the problem I was seeing. It spits out some PositionSize info from a normal (non-donor? patient?) strategy and also from a donor strategy. I would expect them to be the same, but they aren't.
CODE:
Please log in to see this code.
Here's the output I get with ExecuteDonorStrategy() as is:
CODE:
Please log in to see this code.
And with my suggested change:
CODE:
Please log in to see this code.
Size:
Color:
Jared, thank you for the detailed bug report and the fix. That's the power of community and open source. I confirm the bug and the fact that your code does fix it. The fix will be included in the upcoming release of the library (2016.04).
Size:
Color:
I have been using the tools for a while so happy to finally contribute a piece, however small, back. Thanks.
Size:
Color: