It is 100% spurious correlation, you defined it just wrong in your previous post. But well done, you found a correlating time series. You should definitely trade it, I wonder why you would even share such a gem with all of us. By the way, you completely Ignored the most important point I made which is that even simple MA crossovers worked very well with financial time series long before the advent of algorithmic trading. Trend properties have vastly changed over the years. This makes finding other time series that exhibit some sort of lead/lag relationship much easier. Particularly those which also exhibit strong trend patterns. Among millions if not billions of different time series combinations you can surely find some with similar cycle frequencies. Those then highly correlate. The problem with this approach is that financial time series are non stationary and exhibit multiple stochastic components which make volatility, trend patterns, and many others metrics, that describe the behavior of a financial asset price path, highly unstable. Short story, relationships that were exhibited over certain time frames generally break down in a completely unpredictable manner. By all means, if you put trust and faith into your test and believe the statistical properties will continue to hold, try it out. But as I said, when the first larger drawdown comes, and it will come with 100% probability, ask yourself whether you have the confidence to ride it out.
Da FUQ all this is? Where is the price going tomorrow?!? If your system cannot tell you that, then it is a POS that is as good as spray-and-pray.
Tomorrow, the price is going nowhere. If you think all systems need to predict the next day's direction to be successful, seek another hobby, and don't quit your day job.
The earlier rules in this thread were for simulating trades lasting 10 trading days. Here, I have tried something similar but for simulated trades entering long on the next trading day's close S&P 500 and exiting on the close one trading day later. As before, the input data is from (or calculated from) the Jet Propulsion Laboratory's Horizons ephemeris computation system. Inputs have the same as before plus additional ephemeris data. In the following list of inputs <Body> is a celestial body (Moon, Sun Mercury, Venus, Mars, Jupiter, Saturn, Uranus*) and <NNN> is the number of calendar days from New York, NY at 20:00 UTC (000 through 007). <Body>Azimuth<NNN> - position on the horizon: 0 to 360 degrees where 0 is north <Body>AzimuthRelNorth<NNN> - position on the horizon relative to north: -180 to 180 degrees where 0 is north <Body>AzimuthRelSouth<NNN> - position on the horizon relative to south: -180 to 180 degrees where 0 is south <Body>Elevation<NNN> - position above or below the horizon: -90 to 90 degrees <Body>IllumPct<NNN> - percent of body illuminated from the Sun: 0 through 100 percent <Body>IllumPctRelNew<NNN> - percent of body illuminated from the Sun relative to new: -50 through 50 percent where 0 is 0 percent illuminated <Body>IllumPctRelFull<NNN> - percent of body illuminated from the Sun relative to full: -50 through 50 percent where 0 is 100 percent illuminated <Body>AngDiam<NNN> - angular diameter in arc seconds <Body>SkyMotion<NNN> - apparent angular rate of the body in the plane-of-sky om arc seconds per minute <Body>SkyMotionPA<NNN> - position angle of the body's direction of motion in the plane-of-sky: 0 to 360 degrees where 0 is north <Body>SkyMotionPARelNorth<NNN> - position angle of the body's direction of motion in the plane-of-sky relative to north: -180 to 180 degrees where 0 is north <Body>SkyMotionPARelSouth<NNN> - position angle of the body's direction of motion in the plane-of-sky relative to south: -180 to 180 degrees where 0 is south <Body>RelVelAng<NNN> - flight path angle of the body's relative motion with respect to the observer's line-of-sight : -90 = body is moving directly toward the observer; 0 = body is moving at right angles to the observer's line-of-sight; +90 = body is moving directly away from the observer dist<Body><Body> - apparent spherical distance between the two bodies in the sky if measured 20:00 UTC today at approximately 100 km from the Earth's surface (i.e., "the edge of space") in kilometers The values from the ephemeris are stationary (not trending) and cyclic. This allows the raw input values to be used as is. In the perl rules below (you can ignore the $ in each variable name), when the return is set to 1, the trade would be go long at the next trading day's close and exit on the following trading day's close. Each nonblank line is from a separate training run. Code: if ( $VenusSkyMotionPARelNorth006 <= 113.689 ) { if ( $VenusIllumPctRelNew003 > -9.92045 ) { if ( $VenusAzimuthRelSouth007 <= 76.5303 ) { if ( $VenusRelVelAng007 > -43.6443 ) { if ( $VenusSkyMotionPARelNorth003 > 74.475 ) { if ( $MoonIllumPctRelNew000 >= -24.7633 ) { if ( $MoonIllumPctRelNew000 <= 45.3974 ) { $return = 1 ; } } } } } } } if ( $VenusIllumPctRelNew003 >= -9.92045 ) { if ( $VenusAzimuth004 <= 254.953 ) { if ( $VenusSkyMotionPARelNorth003 > 74.3587 ) { if ( $VenusRelVelAng007 >= -48.4235 ) { if ( $VenusSkyMotionPARelNorth007 <= 113.708 ) { if ( $MoonIllumPctRelNew000 >= -24.6626 ) { if ( $MoonIllumPctRelNew000 <= 45.4611 ) { $return = 1 ; } } } } } } } if ( $VenusSkyMotionPARelNorth007 < 113.717 ) { if ( $VenusSkyMotionPARelNorth007 >= 71.4057 ) { if ( $VenusRelVelAng003 > -47.168 ) { if ( $VenusAzimuthRelSouth007 <= 76.5081 ) { if ( $VenusIllumPctRelNew002 >= -6.85619 ) { if ( $MoonIllumPctRelNew000 >= -24.772 ) { if ( $MoonIllumPctRelNew000 <= 46.4493 ) { $return = 1 ; } } } } } } } if ( $MercurySkyMotion005 > 2.09364 ) { if ( $MercurySkyMotionPA003 >= 87.4848 ) { if ( $distJupiterMercury <= 15474.8 ) { if ( $MercurySkyMotion007 <= 3.96116 ) { if ( $distVenusMercury <= 6574.59 ) { if ( $MoonIllumPctRelNew000 >= -44.8493 ) { if ( $MoonIllumPctRelNew000 <= 17.2405 ) { $return = 1 ; } } } } } } } if ( $distMarsJupiter >= 9721.91 ) { if ( $JupiterIllumPct006 < 99.7073 ) { if ( $distMercuryJupiter >= 5525.08 ) { if ( $distSaturnJupiter >= 4376.14 ) { if ( $MoonIllumPctRelNew000 <= 46.0165 ) { if ( $JupiterAzimuthRelSouth007 < 146.693 ) { if ( $JupiterSkyMotionPARelNorth000 < 159.087 ) { if ( $distMarsJupiter <= 19908.1 ) { if ( $JupiterSkyMotion006 < 0.485472 ) { $return = 1 ; } } } } } } } } } if ( $MarsSkyMotionPA005 < 103.319 ) { if ( $MarsSkyMotionPA003 <= 73.5939 ) { if ( $VenusSkyMotionPARelSouth003 >= -111.266 ) { if ( $VenusSkyMotionPA002 >= 66.7971 ) { if ( $VenusIllumPct005 < 98.0737 ) { $return = 1 ; } } } } } if ( $SaturnElevation000 >= -56.3318 ) { if ( $SaturnElevation000 <= 27.1526 ) { if ( $SaturnAzimuth000 < 342.728 ) { if ( $VenusSkyMotionPARelSouth000 <= -66.3701 ) { if ( $JupiterElevation000 >= -23.1582 ) { if ( $UranusAzimuthRelNorth000 >= -165.453 ) { if ( $VenusIllumPct000 > 87.5416 ) { $return = 1 ; } } } } } } } if ( $VenusSkyMotionPA000 > 55.6991 ) { if ( $MarsSkyMotionPARelNorth000 <= 74.2851 ) { if ( $JupiterSkyMotionPA000 < 259.228 ) { if ( $JupiterIllumPctRelFull000 >= 49.107 ) { if ( $VenusAzimuthRelSouth000 < 99.8045 ) { if ( $UranusSkyMotion000 > 0.0263952 ) { if ( $MarsSkyMotionPARelSouth000 <= 103.071 ) { $return = 1 ; } } } } } } } if ( $MarsSkyMotionPARelNorth000 <= 74.0173 ) { if ( $JupiterAngDiam000 < 42.5584 ) { if ( $JupiterIllumPctRelNew000 >= -0.89215 ) { if ( $VenusAzimuthRelSouth000 < 99.7307 ) { if ( $VenusRelVelAng000 > -38.3745 ) { if ( $UranusSkyMotion000 >= 0.0251009 ) { if ( $MarsAzimuth000 > 26.5223 ) { $return = 1 ; } } } } } } } if ( $MarsSkyMotionPARelNorth000 <= 75.8776 ) { if ( $MarsSkyMotion000 > 0.0980262 ) { if ( $SunSkyMotion000 > 2.36899 ) { if ( $SunRelVelAng000 < 1.07194 ) { if ( $MarsElevation000 <= 50.3614 ) { if ( $SunElevation000 > 12.5991 ) { if ( $MarsAzimuthRelNorth000 >= -176.262 ) { $return = 1 ; } } } } } } } Before, I wrote the rules and used genetic optimization to find constant values. This time, I mostly used genetic programming to find operations (e.g., if <=), inputs (e.g., $VenusSkyMotionPARelNorth006) and constant values (e.g., 113.689). Some of the rules have parts manually written with constants found with genetic optimization combined with other parts created by genetic programming. The training data had 8088 simulated trades starting 1957-06-12 through 2009-09-24. The out-of-sample evaluation data had 3467 simulated, one-trading-day trades starting 2009-09-25 through 2023-07-06 with total return 321.2019% (not including dividends or trading costs); compound annual return 11.00%; mean return 0.0415%; median return 0.0658%; winning percent 54.31 Each of the rules found has a greater mean return, median return, and winning percent than the evaluation data. The evaluation period with the generated rules applied had 2238 simulated, one-trading-day trades (64.55% of the total trading days) with total return 527.4990% (not including dividends or trading costs); compound annual return 14.25%; mean return 0.0821%; median return 0.0882%; winning percent 56.08 If trades on consecutive trading days were combined (total return unchanged), there would have been 98 trades with mean return 1.8917%; median return 1.1458%; winning percent 70.41 The combined trades would have lasted from 1 to 218 trading days with a mean 22.84 days and a median 6.50 days. Since each rule had better performance per trade on the out-of-sample data than the equivalent buy-and-hold trades, I think there is a reasonable chance the rules would have better performance than buy-and-hold trades in the future. Here are some future blocks of trading days that will pass the rules: Code: entryDate 20230727 exitDate 20230809 duration 9 entryDate 20230810 exitDate 20230828 duration 12 entryDate 20230912 exitDate 20230918 duration 4 entryDate 20230926 exitDate 20231009 duration 9 entryDate 20231010 exitDate 20231012 duration 2 entryDate 20231211 exitDate 20240103 duration 15 * Yes, I finally felt it was time to probe Uranus because "Once you go Uranus, nothing will be the same as."
Here, I present different types of rules created by genetic programming for simulated trades entering long on the next trading day's close S&P 500 and exiting on the close one trading day later. Inputs are the same as in the previous post. Before, the rules were comparing an input with a constant value and combining the comparisons before passing the rule. With this set of runs, I instead added registers (R0, R1, and R2) to be assigned the result of operations on input values or registers. The rules include subtraction, multiplication, and plain assignment. The statements in a rule can also compare a register with another register or an input value before deciding if the next statement runs or not. Some inputs have different qualities that would make little sense to compare or operate between them. For example, it wouldn't be a good idea to compare illumination percent with elevation because they are different types of data. I implemented this concept by using a list of regular expressions where each regular expression represents a different type of data. Inputs whose name matches one or more of the regular expressions have the type(s) corresponding to those regular expressions. Registers assume the type of the expression they're assigned to. Comparisons of inputs and registers get the intersection of the types of the operands. When an intersection of types is empty, the type is also empty. A Comparison of inputs and/or registers is false when the type of the expression is empty. For these runs, I chose the following list of types (\d matches a digit): Code: Azimuth\d AzimuthRelNorth\d AzimuthRelSouth\d Elevation\d IllumPct\d IllumPctRelNew\d IllumPctRelFull\d MercuryAngDiam VenusAngDiam MarsAngDiam JupiterAngDiam SaturnAngDiam UranusAngDiam MoonAngDiam SunAngDiam MercurySkyMotion\d VenusSkyMotion\d MarsSkyMotion\d JupiterSkyMotion\d SaturnSkyMotion\d UranusSkyMotion\d MoonSkyMotion\d SunSkyMotion\d SkyMotionPA RelVelAng dist In the following rules converted to perl, each block of perl code separated by a blank line is one rule from a single run of the rules generator. When the return is set to 1, the trade would be go long at the next trading day's close and exit on the following trading day's close. The code is harder to read than before because of the type checking. Code: $R1 = $R0 = undef; $_rtt->clearregs(); if ( $_rtt->type("R0 = SaturnSkyMotionPARelNorth005") ) { $R0 = $SaturnSkyMotionPARelNorth005 ; } else { $R0 = undef; } if ( $_rtt->type("R1 = SaturnSkyMotionPARelNorth004") ) { $R1 = $SaturnSkyMotionPARelNorth004 ; } else { $R1 = undef; } if ( $_rtt->type("if MarsSkyMotionPA005 >= R0") && $MarsSkyMotionPA005 >= $R0 ) { if ( $_rtt->type("R1 = SunSkyMotionPARelNorth000") ) { $R1 = $SunSkyMotionPARelNorth000 ; } else { $R1 = undef; } } if ( $_rtt->type("R0 = -0.625628 * JupiterSkyMotionPARelSouth005") ) { $R0 = -0.625628 * $JupiterSkyMotionPARelSouth005 ; } else { $R0 = undef; } if ( $_rtt->type("if R1 >= JupiterSkyMotionPA004") && $R1 >= $JupiterSkyMotionPA004 ) { if ( $_rtt->type("R0 = SaturnSkyMotionPA007") ) { $R0 = $SaturnSkyMotionPA007 ; } else { $R0 = undef; } } if ( $_rtt->type("if R1 >= MercurySkyMotionPARelNorth003") && $R1 >= $MercurySkyMotionPARelNorth003 ) { if ( $_rtt->type("R1 = VenusSkyMotionPARelNorth005") ) { $R1 = $VenusSkyMotionPARelNorth005 ; } else { $R1 = undef; } } if ( $_rtt->type("if MarsSkyMotionPA005 >= R0") && $MarsSkyMotionPA005 >= $R0 ) { if ( $_rtt->type("R1 = SunSkyMotionPA004") ) { $R1 = $SunSkyMotionPA004 ; } else { $R1 = undef; } } if ( $_rtt->type("if R1 >= MercurySkyMotionPA006") && $R1 >= $MercurySkyMotionPA006 ) { if ( $_rtt->type("if R1 >= VenusSkyMotionPARelSouth000") && $R1 >= $VenusSkyMotionPARelSouth000 ) { if ( $_rtt->type("if R0 >= VenusSkyMotionPARelSouth001") && $R0 >= $VenusSkyMotionPARelSouth001 ) { if ( $_rtt->type("if R0 >= SaturnSkyMotionPARelNorth001") && $R0 >= $SaturnSkyMotionPARelNorth001 ) { $return = 1 ; } } } } $R0 = $R1 = undef; $_rtt->clearregs(); if ( $_rtt->type("R1 = 0.0212545 * VenusSkyMotionPA007") ) { $R1 = 0.0212545 * $VenusSkyMotionPA007 ; } else { $R1 = undef; } if ( $_rtt->type("R0 = SaturnSkyMotionPARelNorth002") ) { $R0 = $SaturnSkyMotionPARelNorth002 ; } else { $R0 = undef; } if ( $_rtt->type("if SaturnSkyMotionPA003 >= R0") && $SaturnSkyMotionPA003 >= $R0 ) { if ( $_rtt->type("R1 = R1 - SaturnSkyMotionPARelSouth005") ) { $R1 = $R1 - $SaturnSkyMotionPARelSouth005 ; } else { $R1 = undef; } } if ( $_rtt->type("if R1 >= R0") && $R1 >= $R0 ) { if ( $_rtt->type("R1 = MarsSkyMotionPARelNorth007") ) { $R1 = $MarsSkyMotionPARelNorth007 ; } else { $R1 = undef; } } if ( $_rtt->type("R0 = JupiterSkyMotionPA000") ) { $R0 = $JupiterSkyMotionPA000 ; } else { $R0 = undef; } if ( $_rtt->type("if R0 <= R1") && $R0 <= $R1 ) { $return = 1 ; } $R0 = undef; $_rtt->clearregs(); if ( $_rtt->type("R0 = SunElevation005") ) { $R0 = $SunElevation005 ; } else { $R0 = undef; } if ( $_rtt->type("R1 = JupiterElevation002") ) { $R1 = $JupiterElevation002 ; } else { $R1 = undef; } if ( $_rtt->type("if R0 > R1") && $R0 > $R1 ) { if ( $_rtt->type("R1 = MercurySkyMotionPARelSouth005") ) { $R1 = $MercurySkyMotionPARelSouth005 ; } else { $R1 = undef; } } if ( $_rtt->type("if R0 <= R1") && $R0 <= $R1 ) { if ( $_rtt->type("R1 = VenusElevation000") ) { $R1 = $VenusElevation000 ; } else { $R1 = undef; } } if ( $_rtt->type("if R0 >= R1") && $R0 >= $R1 ) { $return = 1 ; } $R1 = $R0 = undef; $_rtt->clearregs(); if ( $_rtt->type("R0 = SaturnSkyMotionPARelSouth001") ) { $R0 = $SaturnSkyMotionPARelSouth001 ; } else { $R0 = undef; } if ( $_rtt->type("R1 = R0 - R0") ) { $R1 = $R0 - $R0 ; } else { $R1 = undef; } if ( $_rtt->type("if R0 < R1") && $R0 < $R1 ) { if ( $_rtt->type("R1 = SaturnSkyMotionPARelSouth004") ) { $R1 = $SaturnSkyMotionPARelSouth004 ; } else { $R1 = undef; } } if ( $_rtt->type("if R1 > R0") && $R1 > $R0 ) { if ( $_rtt->type("if R1 > R0") && $R1 > $R0 ) { if ( $_rtt->type("R1 = MarsSkyMotionPARelSouth004") ) { $R1 = $MarsSkyMotionPARelSouth004 ; } else { $R1 = undef; } } } if ( $_rtt->type("R0 = MercurySkyMotionPA007 - VenusSkyMotionPARelNorth003") ) { $R0 = $MercurySkyMotionPA007 - $VenusSkyMotionPARelNorth003 ; } else { $R0 = undef; } if ( $_rtt->type("if R1 > R0") && $R1 > $R0 ) { if ( $_rtt->type("if R0 < R1") && $R0 < $R1 ) { $return = 1 ; } } $R1 = $R0 = undef; $_rtt->clearregs(); if ( $_rtt->type("R0 = MoonSkyMotionPARelSouth004") ) { $R0 = $MoonSkyMotionPARelSouth004 ; } else { $R0 = undef; } if ( $_rtt->type("R1 = MercurySkyMotionPARelSouth006 - R0") ) { $R1 = $MercurySkyMotionPARelSouth006 - $R0 ; } else { $R1 = undef; } if ( $_rtt->type("R0 = R0 - R1") ) { $R0 = $R0 - $R1 ; } else { $R0 = undef; } if ( $_rtt->type("R1 = SaturnSkyMotionPARelNorth000") ) { $R1 = $SaturnSkyMotionPARelNorth000 ; } else { $R1 = undef; } # if ( $_rtt->type("if R0 >= R1") && $R0 >= $R1 ) { $return = 1 ; } $R1 = $R0 = $R2 = undef; $_rtt->clearregs(); if ( $_rtt->type("R0 = UranusIllumPct006") ) { $R0 = $UranusIllumPct006 ; } else { $R0 = undef; } if ( $_rtt->type("if R2 >= R1") && ( $R2 >= $R1 ) ) { if ( $_rtt->type("if R0 < R2") && ( $R0 < $R2 ) ) { if ( $_rtt->type("R0 = R1 - R1") ) { $R0 = $R1 - $R1 ; } else { $R0 = undef; } } } if ( $_rtt->type("R2 = SaturnIllumPct000") ) { $R2 = $SaturnIllumPct000 ; } else { $R2 = undef; } if ( $_rtt->type("R1 = JupiterSkyMotionPARelNorth007") ) { $R1 = $JupiterSkyMotionPARelNorth007 ; } else { $R1 = undef; } if ( $_rtt->type("if R0 <= R2") && ( $R0 <= $R2 ) ) { if ( $_rtt->type("R2 = JupiterSkyMotionPARelNorth004 - R1") ) { $R2 = $JupiterSkyMotionPARelNorth004 - $R1 ; } else { $R2 = undef; } } if ( $_rtt->type("if R1 >= R2") && ( $R1 >= $R2 ) ) { $return = 1 ; } $R0 = $R1 = undef; $_rtt->clearregs(); if ( $_rtt->type("R1 = MercurySkyMotionPARelSouth006") ) { $R1 = $MercurySkyMotionPARelSouth006 ; } else { $R1 = undef; } if ( $_rtt->type("R0 = VenusSkyMotionPARelSouth007") ) { $R0 = $VenusSkyMotionPARelSouth007 ; } else { $R0 = undef; } if ( $_rtt->type("if R1 <= R0") && ( $R1 <= $R0 ) ) { if ( $_rtt->type("R0 = SaturnSkyMotionPARelSouth002 - SunSkyMotionPARelSouth004") ) { $R0 = $SaturnSkyMotionPARelSouth002 - $SunSkyMotionPARelSouth004 ; } else { $R0 = undef; } } if ( $_rtt->type("if R1 < R0") && ( $R1 < $R0 ) ) { if ( $_rtt->type("R1 = MercurySkyMotionPA005") ) { $R1 = $MercurySkyMotionPA005 ; } else { $R1 = undef; } } if ( $_rtt->type("if R1 <= R0") && ( $R1 <= $R0 ) ) { $return = 1 ; } $R1 = $R0 = undef; $_rtt->clearregs(); if ( $_rtt->type("R0 = JupiterAzimuthRelSouth007") ) { $R0 = $JupiterAzimuthRelSouth007 ; } else { $R0 = undef; } if ( $_rtt->type("R1 = SaturnAzimuthRelSouth001") ) { $R1 = $SaturnAzimuthRelSouth001 ; } else { $R1 = undef; } if ( $_rtt->type("if R0 > R1") && ( $R0 > $R1 ) ) { if ( $_rtt->type("if R0 > R1") && ( $R0 > $R1 ) ) { if ( $_rtt->type("R0 = SaturnSkyMotionPARelNorth001") ) { $R0 = $SaturnSkyMotionPARelNorth001 ; } else { $R0 = undef; } } } if ( $_rtt->type("R1 = MoonSkyMotionPARelSouth003") ) { $R1 = $MoonSkyMotionPARelSouth003 ; } else { $R1 = undef; } if ( $_rtt->type("if R1 >= R0") && ( $R1 >= $R0 ) ) { $return = 1 ; } $R1 = $R0 = undef; $_rtt->clearregs(); if ( $_rtt->type("R0 = SunSkyMotionPA003") ) { $R0 = $SunSkyMotionPA003 ; } else { $R0 = undef; } if ( $_rtt->type("R1 = JupiterSkyMotionPARelSouth000") ) { $R1 = $JupiterSkyMotionPARelSouth000 ; } else { $R1 = undef; } if ( $_rtt->type("if R1 > R0") && ( $R1 > $R0 ) ) { if ( $_rtt->type("R0 = R0 - JupiterIllumPctRelFull005") ) { $R0 = $R0 - $JupiterIllumPctRelFull005 ; } else { $R0 = undef; } } if ( $_rtt->type("if R0 > R1") && ( $R0 > $R1 ) ) { if ( $_rtt->type("if R1 < R0") && ( $R1 < $R0 ) ) { if ( $_rtt->type("R1 = VenusAzimuthRelNorth004") ) { $R1 = $VenusAzimuthRelNorth004 ; } else { $R1 = undef; } } } if ( $_rtt->type("R0 = UranusAzimuthRelNorth005") ) { $R0 = $UranusAzimuthRelNorth005 ; } else { $R0 = undef; } if ( $_rtt->type("if R1 > R0") && ( $R1 > $R0 ) ) { $return = 1 ; } $R1 = $R0 = undef; $_rtt->clearregs(); if ( $_rtt->type("R0 = MarsSkyMotionPARelSouth001") ) { $R0 = $MarsSkyMotionPARelSouth001 ; } else { $R0 = undef; } if ( $_rtt->type("R1 = R0 - MercurySkyMotionPARelSouth002") ) { $R1 = $R0 - $MercurySkyMotionPARelSouth002 ; } else { $R1 = undef; } if ( $_rtt->type("R0 = SaturnSkyMotionPARelSouth002") ) { $R0 = $SaturnSkyMotionPARelSouth002 ; } else { $R0 = undef; } if ( $_rtt->type("if R1 > R0") && ( $R1 > $R0 ) ) { if ( $_rtt->type("R1 = VenusAzimuthRelNorth001") ) { $R1 = $VenusAzimuthRelNorth001 ; } else { $R1 = undef; } } if ( $_rtt->type("R0 = R1 - R1") ) { $R0 = $R1 - $R1 ; } else { $R0 = undef; } if ( $_rtt->type("if R1 > R0") && ( $R1 > $R0 ) ) { if ( $_rtt->type("if R1 > R0") && ( $R1 > $R0 ) ) { if ( $_rtt->type("if R0 < R1") && ( $R0 < $R1 ) ) { if ( $_rtt->type("if R0 <= R1") && ( $R0 <= $R1 ) ) { $return = 1 ; } } } } The training data had 11698 simulated trades starting 1957-03-05 through 2003-08-21 The out-of-sample evaluation data had 5014 simulated trades starting 2003-08-22 through 2023-07-25 with total return 359.86% (not including dividends or trading costs); compound annual return 7.96%; mean return 0.0304%; median return 0.0702%; winning percent 54.47 The evaluation period with the generated rules applied had 2976 simulated, one-trading-day trades (59.35% of the total evaluation trading days) with total return 508.817730% (not including dividends or trading costs); compound annual return 9.49%; mean return 0.0607%; median return 0.0929%; winning percent 56.49 If trades on consecutive trading days were combined (total return unchanged), there would have been 103 trades with mean return 1.7692%; median return 1.1428%; winning percent 66.02 The combined trades would have lasted from 1 to 165 trading days with a mean 28.89 days and a median 22 days. As before, each individual rule had better performance per trade on the out-of-sample data than the equivalent buy-and-hold trades, I think there is a reasonable chance the rules would have better performance than buy-and-hold trades in the future. Here are some future blocks of trading days that will pass the rules: Code: entryDate 20230801 exitDate 20231010 duration 49 entryDate 20231219 exitDate 20240103 duration 9
Rules from the previous post in pseudocode made easier to read (return 1 means go long S&P 500 the next trading day's close and exit the following trading day): Code: # types_for_runtime_checking Azimuth\d AzimuthRelNorth\d AzimuthRelSouth\d Elevation\d IllumPct\d IllumPctRelNew\d IllumPctRelFull\d MercuryAngDiam VenusAngDiam MarsAngDiam JupiterAngDiam SaturnAngDiam UranusAngDiam MoonAngDiam SunAngDiam MercurySkyMotion\d VenusSkyMotion\d MarsSkyMotion\d JupiterSkyMotion\d SaturnSkyMotion\d UranusSkyMotion\d MoonSkyMotion\d SunSkyMotion\d SkyMotionPA RelVelAng dist R1 = R0 = undef R0 = SaturnSkyMotionPARelNorth005 R1 = SaturnSkyMotionPARelNorth004 if MarsSkyMotionPA005 >= R0 R1 = SunSkyMotionPARelNorth000 R0 = -0.625628 * JupiterSkyMotionPARelSouth005 if R1 >= JupiterSkyMotionPA004 R0 = SaturnSkyMotionPA007 if R1 >= MercurySkyMotionPARelNorth003 R1 = VenusSkyMotionPARelNorth005 if MarsSkyMotionPA005 >= R0 R1 = SunSkyMotionPA004 if R1 >= MercurySkyMotionPA006 if R1 >= VenusSkyMotionPARelSouth000 if R0 >= VenusSkyMotionPARelSouth001 if R0 >= SaturnSkyMotionPARelNorth001 return 1 R0 = R1 = undef R1 = 0.0212545 * VenusSkyMotionPA007 R0 = SaturnSkyMotionPARelNorth002 if SaturnSkyMotionPA003 >= R0 R1 = R1 - SaturnSkyMotionPARelSouth005 if R1 >= R0 R1 = MarsSkyMotionPARelNorth007 R0 = JupiterSkyMotionPA000 if R0 <= R1 return 1 R1 = R0 = undef R0 = SunElevation005 R1 = JupiterElevation002 if R0 > R1 R1 = MercurySkyMotionPARelSouth005 if R0 <= R1 R1 = VenusElevation000 if R0 >= R1 return 1 R1 = R0 = undef R0 = SaturnSkyMotionPARelSouth001 R1 = R0 - R0 if R0 < R1 R1 = SaturnSkyMotionPARelSouth004 if R1 > R0 if R1 > R0 R1 = MarsSkyMotionPARelSouth004 R0 = MercurySkyMotionPA007 - VenusSkyMotionPARelNorth003 if R1 > R0 if R0 < R1 return 1 R1 = R0 = undef R0 = MoonSkyMotionPARelSouth004 R1 = MercurySkyMotionPARelSouth006 - R0 R0 = R0 - R1 R1 = SaturnSkyMotionPARelNorth000 if R0 >= R1 return 1 R1 = R0 = R2 = undef R0 = UranusIllumPct006 if R2 >= R1 if R0 < R2 R0 = R1 - R1 R2 = SaturnIllumPct000 R1 = JupiterSkyMotionPARelNorth007 if R0 <= R2 R2 = JupiterSkyMotionPARelNorth004 - R1 if R1 >= R2 return 1 R0 = R1 = undef R1 = MercurySkyMotionPARelSouth006 R0 = VenusSkyMotionPARelSouth007 if R1 <= R0 R0 = SaturnSkyMotionPARelSouth002 - SunSkyMotionPARelSouth004 if R1 < R0 R1 = MercurySkyMotionPA005 if R1 <= R0 return 1 R1 = R0 = undef R0 = JupiterAzimuthRelSouth007 R1 = SaturnAzimuthRelSouth001 if R0 > R1 if R0 > R1 R0 = SaturnSkyMotionPARelNorth001 R1 = MoonSkyMotionPARelSouth003 if R1 >= R0 return 1 R1 = R0 = undef R0 = SunSkyMotionPA003 R1 = JupiterSkyMotionPARelSouth000 if R1 > R0 R0 = R0 - JupiterIllumPctRelFull005 if R0 > R1 if R1 < R0 R1 = VenusAzimuthRelNorth004 R0 = UranusAzimuthRelNorth005 if R1 > R0 return 1 R1 = R0 = undef R0 = MarsSkyMotionPARelSouth001 R1 = R0 - MercurySkyMotionPARelSouth002 R0 = SaturnSkyMotionPARelSouth002 if R1 > R0 R1 = VenusAzimuthRelNorth001 R0 = R1 - R1 if R1 > R0 if R1 > R0 if R0 < R1 if R0 <= R1 return 1
If you still have not found suitable strategies to trade perhaps there is not much correlation between asset prices and astronomical data.....
If you really have an interest in verified cycles, take a look at The Foundation for the Study of Cycles. They've been around since the 1940's and still kicking. I was a member of cycles.org almost 30 years ago. At the time, while devising my trading methods and style, it was well worth the cost as the library and archives are extensive! A few relatively recent issues of Cycles Magazine are available free on the site.