Weighted Anchored WFO

Studies that have been contributed to the community by other users. If you’ve got something useful to share, that’s great!
tpredictor
Posts: 108
Joined: 05 Mar 2014
Has thanked: 1 time
Been thanked: 12 times

Weighted Anchored WFO

Postby tpredictor » 21 Apr 2021

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 );

Return to “User Contributed Studies and Indicator Library”