Window of opportunity The adaptive f concepts adjusts the trade-size value in accordance to the same principles of optimal f, but without the benefit of hindsight and using a moving window that better reflects current market conditions. Function CalcOptimalF_TPVir(Increment As Double, TradeLookBack, objMark As TSProcessor.IMarket,ByRef LargestLoss) Dim Trades As Array Dim f As Double Dim bestF As Double Dim bestValue As Double Dim biggestLoser As Double Dim curValue As Double Dim i As Integer Dim TradeInfo As Array TradeLookBack = Min(TradeLookBack, objMark.TradeCount) If TradeLookBack = 0 Then CalcOptimalF_TPVir = .1 Exit Function End If ReDim (Trades, TradeLookBack) For i = 0 To TradeLookBack - 1 Trades[i] = objMark.VirTrade(i).Profit Next bestValue = -9999999 biggestLoser = Min(Trades) For f = (0 + Increment) To (1 - Increment) Step Increment curValue = 1 For i = 0 To UBound(Trades)-1 curValue = curValue * (1 + (f * ( -1 * Trades[i] / biggestLoser))) Next If curValue > bestValue Then bestValue = curValue bestF = f End If Next LargestLoss = biggestLoser CalcOptimalF_TPVir = bestF End Function