I'm not too bad with AFL coding but not sure where to start with a situation I want to try and code.
Imagine I have a sell condition such as:
period = 30;
Sell = cross(c,MA(c,period));
What I want to do is backtest some logic were if I'm trading and I have more than x number of consecutive loses I can change the period variable from 30 to say 10.
The idea is that if I'm on a bit of a losing streak due to poor trading conditions for my system I can tighten the sell citeria to limit drawdown. If I then win a trade the period variable resets to 30.
Would anyone have any idea how I can do this from a backtesting perspective. I'm thinking the custom backtester but not sure how I'd work out consecutive loses and then use this to change hthe sell criteria on the fly for the next trade?