I decided to try an idea of using triangles on charts to help decide whether to enter a trade or not.
Consider a line chart with right triangles to represent the relationship between two points.
View attachment 213162
Negative angle A shows the relationship between points 1 and 2. Positive angle B shows the relationship between points 3 and 4.
Scripts create data having angles between various combinations of points on daily charts for a historical period.
For this example, the input charts have two current cycles of trading days according to a John Ehlers-style autocorrelation periodogram (similar to
https://quantstrattrader.wordpress.com/2017/02/15/ehlerss-autocorrelation-periodogram/ ).
The scripts scale the prices and times to allow the data to be compared (similar to what the above chart looks like).
The scripts also create a target for prediction. For this example, the target is (next_bar_close_price - next_bar_open_price) / (high_price_in_past_two_cycles - low_price_in_past_two_cycles) * 100.
A genetic programming rules generator creates rules to classify relationships between the angles in the data to create rules:
View attachment 213163
The rules have conditional statements to compare angles to other angles or angles to constants. For example,
Code:
0000: if scaled_close1587to0349 >= scaled_close1619to0317
0001: if 71.3478 >= scaled_close0158to0031
...
0008: return 89
In the code snippet, scaled_close1587to0349 refers to the angle about 1.587 current cycles away before the most recent close price to about 0.349 current cycles before the most recent price.
71.3478 is a constant value in degrees.
Nested (indented) if statements execute when the previous if statement evaluates true, and a return 89 means the rule suggests to take the trade. 89 is just the highest value used for comparing angles to constant values.
If control gets to the return NAN at the end, the rule suggests to not take the trade.
In this example, the predicted class is the upper one-third of the target values. For the historical period of 5042 instances (about 20 years), the rule was hit 504 times (9.99603 percent) and successfully predicted the class 365 times (72.4206 percent). The mean result for the 504 hits was 5.76526 percent of the prior price range in the most recent two cycles.
Could you (or anyone else) provide feedback on about this idea of using triangles for analysis of price data for making trading decisions?