forex software

Create and Test Forex Strategies

forex software

Skip to forum content

Forex Software

Create and Test Forex Strategies

You are not logged in. Please login or register.


Forex Software → Forex Strategy Builder Professional → Custom Fitness Function

Pages 1

You must login or register to post a reply

RSS topic feed

Posts: 10

Topic: Custom Fitness Function

Hi smile

would it be possible to be able to use a custom fitness function as the generating / optimizing goal? I would like to use something along the lines NetProfit / EquityCurveStdDev. I am already doing this in MT4 in my own EA´s and this custom fitness produces very good results, but there seems to be no way to do that in FSB Pro.

Thanks.

Re: Custom Fitness Function

Account Statistics is the word here, it's expandable by user. I don't know though whether it gets passed on to optimizer and generator. Lets wait for Miroslav's answer, curious to know myself wink

3 (edited by geektrader 2015-03-08 03:04:19)

Re: Custom Fitness Function

Well I am not looking forward to just see the account statistics, I want to use a custom fitness function instead of "NetProfit" or "System Quality Number", I want to use my own calculation like "NetProfit / Equity Curve Standard Deviation" and tell the generator to use that to rank the strategies while it generates or optimizes them. Just like you can do in MT4 with the OnTester() function.

Re: Custom Fitness Function

That's what I said, you can set it up in Account Statistics, it's in the code folder, and I understood you want it as acceptance criteria. Like I said I don't know if it will show up (when added into Account Statistics) as an acceptance criteria in the gen and optimizer, additionally if it can be used as a sorting condition in strat collection. If it'd do the latter, it would be half a win, but probably it won't work. I'm not the last instance of truth, the developer is, waiting for conclusive answer.

5 (edited by geektrader 2015-03-08 03:51:16)

Re: Custom Fitness Function

Thanks, but I don´t want to use it as an acceptance criteria nor being able to sort already generated strategies by it. I want the actual generation process to use this as it´s goal already. There is a different if just storting strategies by that value AFTER they have been generated with "maximize net profit" as a goal than to directly generate them with "maximize custom fitness function" instead of "NetProfit" or any other of the available generating goals.

Re: Custom Fitness Function

The Generator first calculates a strategy and after that checks if it complies with the Acceptance Criteria. If the criteria are fulfilled, the generator pushes the strategy to a collection in a place according to the "Search Best" parameter.

Currently you can add a new parameter to the custom Acceptance Criteria, but it will not be used as an acceptance criterion. What you can do is to "hack" some of the other params.
If ore users are interested in adding custom criteria, I'll add such feature.

Re: Custom Fitness Function

How would the "hack" look like?

Re: Custom Fitness Function

Adding a parameter to Account Statistics:


1. Declare a global variable:

        private double myParameter;

2. Add method for calculating the parameter:

private void CalculateMyParameter(IBacktester backtester)
{
    int firstBar = backtester.Strategy.FirstBar;
    int bars     = backtester.DataSet.Bars;

    double[] equityLine = new double[bars-firstBar];
    for (int bar = firstBar; bar < bars; bar++)
        equityLine[bar-firstBar] = backtester.MoneyEquity(bar);

    double equityStdDev = StdDev(equityLine);
    double netBalance = backtester.NetBalance;

    myParameter = netBalance / equityStdDev;
}

3. Call that method from "CalculateAccountStats(IBacktester backtester)"

            CalculateMyParameter(backtester);

4. Set the parameter in  "GetInfoRecords()"

 
            records.Add(new InfoRecord
            {
                Name  = "My Parameter",
                Value = myParameter.ToString("F2"),
                Flag  = myParameter < 1
                    ? InfoRecordFlag.Bad
                    : myParameter < 4
                        ? InfoRecordFlag.Normal
                        : InfoRecordFlag.Good
            });

http://s28.postimg.org/xvbyk1p5l/screenshot_820.jpg

The custom Account Statistics file is attached below.

Post's attachments

AccountStatistics.cs 22.11 kb, 2 downloads since 2015-03-08 

You don't have the permssions to download the attachments of this post.

9 (edited by geektrader 2016-03-09 06:18:10)

Re: Custom Fitness Function

Hi Popov,

sorry for the long time of no response, I check into FSB at least once a year and just did it again (I am a StrategyQuant user actually). I have tried FSB Pro 3.5 right now and see that the custom acceptance criteria has not been done yet within the software but would still be needed to be "hacked", is this correct?

I really had the hope it would have been added meanwhile as this is something crucial in my opinion for generation good strategies, at least that´s my finding from the last 8 years in developing trading systems. I much like the system that SQ offers in that relation, in being able to "weight" several acceptance criteria values as the main accept criteria (e.g. net profit, return / dd ratio, equity curve stability) against each other, e.g.: put 70% weight on net profit, 20% weight on return/dd ratio and 10% weight on equity curve stability (R^2) as the final custom weighted acceptance criteria.

Right now I see now way to do that and especially the equity curve stability is a completely missing acceptance criteria (as I would prefer to trade a strategy with 100000 net profit and a R^2 of 0.98 over a strategy with 400000 net profit but a R^2 of just 0.7 - a unstable equity curve), or did I not look hard enough? It would also be great if we would be able to sort the systems by that custom criteria in the repository, but I guess that would automatically happen anyway if that the custom criteria was used as a acceptance criteria?

I am a new buyer for sure as soon as I would be able to work so flexible with the acceptance criterias like I can in SQ, it´s really a "must have" for me.

Thanks a lot for your dedication and great work, so much appreciated.

Re: Custom Fitness Function

Any update on that Mr. Popov? I´d really love to finally buy FSB Pro, but without having that one it´s a serious feature missing for me right now that I use in everday strategy generation.

Posts: 10

Pages 1

You must login or register to post a reply

Forex Software → Forex Strategy Builder Professional → Custom Fitness Function

Similar topics in this forum