Genetic Programming / Symbolic Regression Model Experiments

Discussion in 'Strategy Building' started by userque, Apr 22, 2021.

  1. easymon1

    easymon1

    #11     May 5, 2021
  2. ph1l

    ph1l

    I did some backtesting with a slightly different form of generated function for
    iShares MSCI Emerging Markets ETF (EEM), SPDR Gold Trust (GLD), iShares Russell 2000 ETF (IWM), SPDR S&P 500 ETF (SPY)
    in periods
    EEM 20040907 20070131
    EEM 20140908 20170126
    GLD 20180108 20200528
    IWM 20010508 20040304
    IWM 20040907 20101029
    IWM 20180108 20210507
    SPY 20110509 20170706
    The time periods are somewhat arbitrary because they are from radomly-chosen blocks of time in the past ~20 years.

    The results for simulated trades that
    • Enter long at the next day's close price when the next day is predicted to be a low inflection point in the sinusoids of the generated curve and this point is in the lower third of the range of the sinusoid amplitudes.
    • Exit long at the close price when a following day is predicted to be a high inflection point in the sinusoids.
    are 122 simulated trades with a total return of 95.8% with 62.3% winners, a mean increase per trade of 0.55%, and a mean duration of 7.1 trading days.

    A sample function fitting 89 calendar days close prices adjusted for dividends and interpolated for non-trading days of SPY from 20160110 through 20160407 is:
    Code:
    y = ((((173.38 + (0.00217018 * (x * x))) +
        ((-0.99132 * ((((x - x) + 1) + 1) + 1)) /
        (exp (0.999994 * (x - ((((x - x) + 1) + 1) * 25.3174))) + 1))) +
        (1.47922 * cos ((0.299152 * x) + 0.426408))) +
        (1.75262 * cos ((0.114147 * x) + 5.71015))) +
        (1.58776 * cos ((0.250556 * x) + 0.756282))
    
    I changed the output from the previous sequential list form with assembly language-like instructions to something that is more human-readable.

    The close prices (+ for input, * for calendar days in the simulated trade, squares for calendar days after the trade) and the fitted curve look like:
    upload_2021-5-10_23-14-12.png

    File inputSPY.csv has the input data (7th column). File afterSPY.csv has data for 18 calendar days after inputSPY.csv (only used for the image data).
     
    #12     May 11, 2021
    userque likes this.