Anyways; I don't think there can be a fix for this unless you guys make the change, but in the case you guys don't know about this:
if a trade with same entry has multiple exits.. for example, purchase 100k at X price. And then sell 50k at Y price for a gain of 1% and sell 50k at Z price for a gain of 3%.. the cum return column as it stands now will show a cum gain of 4%. which is wrong b/c it's not weighted by quantity purchased. Then if you have 10 exits... returns look like attached picture. i don't really know how you guys would go about fixing this....
Any idea how I can calculate avg gain in my scenario? Say I entered in 2 trades... each trade was closed out in 3 increments. NT as of right now is seeing 6 trades and my gains are being divided by 3 rather than 2. I've been able to calculate the correct # of trades in the strategy but I have no idea how to implement this in the OptimizationFitness
protected override void OnPositionUpdate(Position position, double averagePrice, int quantity, MarketPosition marketPosition) { if (test==false) { test=true; } if (position.MarketPosition == MarketPosition.Flat)// && SystemPerformance.AllTrades.Count>2) { test=false; ++strategy_trade_counts; Trade a = SystemPerformance.AllTrades[SystemPerformance.AllTrades.Count - 1]; b =SystemPerformance.AllTrades.TradesPerformance.Currency.CumProfit; Print(string.Format("{0};{1};{2}",Time[0],strategy_trade_counts,b)); } }
I could use the above and calculate my expectancy but I have no idea how I can implement this in the OptimizerFitness as I've never been able to figure out how to access strategy information in OptimizerFitness....
Comment