Click here to Login





                                                   Custom Fitness Function

  2

0
clonex
2014-02-04 18:20:43


Sometimes You need to tell optimizer that you want to find solutions with minimum number of trades /signals.
The problem comes when you have longer In Sample and shorter Out of Sample Window.

In most of time you get in OS period NaN results. (AI OPTIMIZER)

To prevent this use :

Fitness in System:

DateTime dt1 = DateTime.Parse("2. 1. 2010 0:00:00");
DateTime dt2 = DateTime.Now;

if((DailyReturn.GetDate(DailyReturn.Count - 1) < dt1 && NumberOfTrades<100))
Fitness =Double.NaN;
else
Fitness = AnnualReturn;



Fitness in Rules:

DateTime dt1 = DateTime.Parse("2. 1. 2010 0:00:00");
DateTime dt3 = EndDate.Date.ToLocalTime();

if(dt3 <dt1 &&NbPositions<50)
Fitness = Double.NaN;
else
Fitness = OutputPerBar;


In both examples is end of IS window at 1.1.2010.



No more messages
0




Reply:

No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
    To add a trading object in your message, type in the object name, select it and then click on "Add Objects"










    QuantShare

    Trading Items
    Advanced Quotes and Custom Databases Function
    News parser function
    Upside-Downside and Custom Standard Deviation
    Sum of a Custom Database's Field
    Custom High/Low Range

    How-to Lessons
    How to create a custom trendline
    How to add custom position-based metrics to your trading system
    How to use a custom drawing tool
    How to create a custom trading indicator
    How to get fundamental data for U.S. Stocks

    Related Forum Threads
    Custom Fitness function in Ranking System Manager
    Custom Fitness Functions for Walk Forward Testing
    Custom Multi-Dimensional Fitness Formula (CMDFF) for Optimizer
    Optimization and fitness function for robustness vs for performan...
    Problem with performance calculation in custom function

    Blog Posts
    Create custom metrics for the statistical data analysis tool
    Trading System Analysis: Backtesting report and custom measures
    Custom Indicator: Accumulation Distribution Line
    Custom Indicator: Relative Strength
    Custom Indicator: Moving average spread









    QuantShare
    Product
    QuantShare
    Features
    Create an account
    Affiliate Program
    Support
    Contact Us
    Trading Forum
    How-to Lessons
    Manual
    Company
    About Us
    Privacy
    Terms of Use

    Copyright © 2025 QuantShare.com
    Social Media
    Follow us on Facebook
    Twitter Follow us on Twitter
    Google+
    Follow us on Google+
    RSS Trading Items



    Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.