In walk forward testing, it will choose the parameters with the highest metrics and trade it in OOS. However, how to prevent trading in OOS if the strategy performs not good .e.g the metrics such as UPI is negative. In other word, I don’t want to trade the strategy if the IS result is loss.
If your in-sample performance is negative entire trading system should be re-designed in first place.
If even IIS performance is bad no amount of fine tweaking would make it worthwhile.
But answering directly your question you can store any metric from IIS step into static variable and then in OOS step read that variable and decide not to trade at all
if( Nz( StaticVarGet("MyStoredIISMetric") ) < 0 )
{
Buy = 0; Short = 0; // don't enter any trades
}
Thank you for your reply. My point is that even a profitable strategy there are some periods the strategy fails to identify profitable signal and i don’t want to trade it before showing me again it is still profitable.
@quantboy - I think this is has nothing to do with equity curve trading per say. This is just an optimization problem for WFO. Let say you have 5 in-sample periods:
1000 | Trade System
900 | Trade System
800 | Trade System
-100 | DO NOT TRADE
700 | Trade System
And if we assume that the ‘optimization target’ is the highest net profit (note: -100 in period 4. though negative can still be the highest ) then @jackcl wants to just stop trading for one period and carry on later when the system will generate positive returns ( or any other optimization metric ).
In that case then @Tomasz advise is the way to go - but with few more tweaks.
One has recognized in-sample runs ( search the yahoo forum )
Store the highest opt. target ( in sample ) in static var with a flag x > 0 in the buy statment when the first WF run is being made.
Reset the static variable when a new in-sample run is executed and repeat step 1.