Parabolic Regression Shapes
This analyzer script opens up new possibilities of graphical analysis of price charts and is a useful addition to any trading strategy. The utility is designed mainly for manual trading but it contains means of integration with trading EAs. It does not trade independently.
The script builds the current non-linear trend and highlights the following price patterns based on quadratic regression
- Linear Channel - parabolic (quadratic regression) channel special case
- Turn Up/Down - price direction change
- rising/falling trend weakening and start of non-directional Up and Flat/Down and Flat movement
- moving up/down with acceleration after Flat and Up/Flat and Down price consolidation.
The script classifies trends according to their power and assigns a power index to each trend - Strong, Medium Strength, Slow or Almost Flat. For the last three detected patterns, the data on a trend type and its power is displayed. Detected patterns are displayed as channels on a price chart. Each pattern has its own color.
Script's original functions:
- analysis of the combination of the last two patterns with a comment on the price behavior
- detecting a forming pattern
- visual confirmation of the indicator signals.
- Period (bars) - number of bars used for detecting patterns and calculating trend parameters.
The script works on any currency pair and timeframe.
The script operation time is proportional to the Period value. Too long (more than 100 bars) and too short (less than 12 bars) periods are not recommended. For example, instead of 1440 bars on M1, it would be reasonable to set 24 on H1 or 96 on M15.
Integration with EAs
In order to interact with EAs, the script creates the terminal global variables with the following names:
"Last_"+ _Symbol+"_"+_Period+"_"/ "Prev_"+ _Symbol+"_"+_Period+"_"+ Bars_Period - last/previous trend's type number;
"LastForce_"+ _Symbol+"_"+_Period+"_"+ Bars_Period/"PrevForce_"+ _Symbol+"_"+_Period+"_"+ Bars_Period - last/previous trend's power.
Type number: 1, 2 - rising/falling linear channel, 3, 4 - flat and rise/fall, 5, 6 - rise/fall and flat, 7, 8 - upward/downward reversal.
Trend power: 0 - almost flat, 1 - weak, 2 - medium, 3 - strong.
Bars_Period - input parameter.