Feature request - darwin should throw out last trade
The problem is that super conservative strategy parameters are being chosen too often if you happen to choose a data ending in a spike. Every sim I've run on such data shows a sell in the very last candle. Because of this many poor params are being selected which made only break even trades and then benefited from a bump at the end.
This effectively penalizes params which would have sold close to that point. It seems like the right thing to do as the last candle being counted an automatic sell benefits params which happened to be holding at that point while having no effect on others.
I was wondering about this. I didn't go thru the data fully, but when I was doing selective sims (from generation data) I noticed at times I would see something like this.
I was thinking of a solution by adjusting the fitness where only trade patterns that had more than 2 trades that were wins and ignoring the ones where there was only 1 trade win. but this would mess up short scans on market pairs with little trading where 1 win is what is to be expected every 1 or 2 days. So far I havn't come up with a solution that covers all conditions.
Your condition is fairly specific, we may want to put that in as an option flag, not as a default though.
Yes I agree that defaulting this isn't always a good idea. I would like to use the option flag.
BTW, could you point me in the right direction for where I might implement this myself? I assume it would be where darwin processes results and assigns fitness. Any idea where this type of logic happens in the code?
https://github.com/DeviaVir/zenbot/blob/unstable/scripts/genetic_backtester/phenotype.js function fitness is where fitness is calculated. it executes this for every simulation in each generation. the highest result wins.
the change your talking about would be a modification to the sim command.
Ignoring the last trade.
https://github.com/DeviaVir/zenbot/blob/unstable/commands/sim.js
where in there I can't say right now. but the nice thing is the sim command can take parameters, so would be "fairly easy" to implement.
Fitness can only work off the values stored withing the genetic object. so the condition would need to be passed in a way the phenotype can access it during the fitness calculation. Not really sure how I would do it yet without trying out a few different ways.