Custom WFO event-triggered periodic optimization

New thread for this.
Is there a way to trigger a "re-optimization" event based on a custom criteria/indicator? Say, instead of having a fixed length for IS/OOS intervals, one can:

  1. Assume you are always out of sample - and carry on w/ your AFL processing
  2. Custom event happens at bar N - this triggers an optimization routine (having either length = {start(last-event-in-the-past), end(now)} or length = specified length with parameter, identifying how many past-bars should the optimization occur on.
  3. Carry on with bar N+1 and new optimization results, until next event happens.

Would love to understand how could this be currently coded/done, or let us know if this would be more of a new feature.

"By design", you have to decided BEFORE what data are in-sample and what are not.
If you are modifying OOS range based on your results you are "cheating" - i.e. making the whole walk-forward process invalid (not reliable) as you are leaking knowledge from in-sample to out-of-sample