Page 1 of 1

Weighted Anchored WFO

Posted: 21 Apr 2021
by tpredictor
In a recent blog post, I introduced Weighted Anchored WFO technique: https://beyondbacktesting.com/2021/04/1 ... ns-in-wfo/

The core idea is that greater weight should be given to more recent results, i.e. older results should be given less weight based on their age. The following code shows this can be achieved by using Custom Fitness function. In practice, I multiply/exponentiate newer returns which has the effect of decaying older results. In this code, I am just linearly decaying the data based on bars passed.

Code: Select all

variables: ExpProfit(0), LastNetProfit(0), LastTradeProfit(0), BarCounter(0); BarCounter = BarCounter+1; LastNetProfit = netprofit; if LastNetProfit <> LastNetProfit [1] then begin LastTradeProfit = LastNetProfit -LastNetProfit [1]; ExpProfit = ExpProfit[1] + LastTradeProfit*BarCounter; end; SetCustomFitnessValue(ExpProfit );