Rising/Falling Wedge
Install and import#
npm install fintech-algorithmsimport { detectRisingFallingWedge } from "fintech-algorithms/geometric-chart-patterns/continuation-structures/rising-falling-wedge";Signature#
detectRisingFallingWedge()Worked example#
executed This entry is a thin wrapper its test never calls directly, so it was invoked with the arguments its shared implementation received. Real output, not asserted against a published figure.
Input#
[90, 91.5, 93, 94.5, 96, 97.5]Showing 6 of 96 elements.
Call#
detectRisingFallingWedge()Returns#
object with 7 fields: pattern, state, reason, event, events, pivots, parameters
{
"pattern": "wedge",
"state": "confirmed",
"reason": "breakout-confirmed",
"event": {
"pattern": "wedge",
"state": "confirmed",
"reason": "breakout-confirmed",
"pivot_indices": [16, 22, 28, 34, 40, 46],
"pivot_prices": [105, 113, 109, 116, 113, 118],
"pivot_types": ["low", "high", "low", "high", "low", "high"],
"candidate_available_index": 48,
"confirmation_index": 49,
"breakout_direction": "bearish",
"expected_direction": "bearish",
"subtype": "rising",
"upper_boundary": 118.79166666666667,
"lower_boundary": 116,
"metrics": {
"upper_slope": 0.20833333333333334,
"lower_slope": 0.3333333333333333,
"upper_relative_slope": 0.00185459940652819,
"lower_relative_slope": 0.002967359050445104,
"upper_intercept": 108.58333333333334,
"lower_intercept": 99.66666666666667,
"width_start": 6.916666666666671,
"width_end": 3.1666666666666714,
"convergence": 0.5421686746987948,
"parallel_gap": 0.001112759643916914,
"impulse": 0.09375,
"impulse_direction": "bullish",
"formation_bars": 30
}
},
"events": [
{
"pattern": "wedge",
"state": "confirmed",
"reason": "breakout-confirmed",
"pivot_indices": [16, 22, 28, 34, 40, 46],
"pivot_prices": [105, 113, 109, 116, 113, 118],
"pivot_types": ["low", "high", "low", "high", "low", "high"],
"candidate_available_index": 48,
"confirmation_index": 49,
"breakout_direction": "bearish",
"expected_direction": "bearish",
"subtype": "rising",
"upper_boundary": 118.79166666666667,
"lower_boundary": 116,
"metrics": {
"upper_slope": 0.20833333333333334,
"lower_slope": 0.3333333333333333,
"upper_relative_slope": 0.00185459940652819,
"lower_relative_slope": 0.002967359050445104,
"upper_intercept": 108.58333333333334,
"lower_intercept": 99.66666666666667,
"width_start": 6.916666666666671,
"width_end": 3.1666666666666714,
"convergence": 0.5421686746987948,
"parallel_gap": 0.001112759643916914,
"impulse": 0.09375,
"impulse_direction": "bullish",
"formation_bars": 30
}
}
],
"pivots": [
{
"kind": "high",
"index": 12,
"confirmation_index": 14,
"price": 108
},
{
"kind": "low",
"index": 16,
"confirmation_index": 18,
"price": 105
},
{
"kind": "high",
"index": 22,
"confirmation_index": 24,
"price": 113
}
],
"parameters": {
"pivot_left": 2,
"pivot_right": 2,
"pivots_per_side": 3,
"max_pattern_bars": 44,
"max_confirmation_bars": 4,
"impulse_lookback": 12,
"flat_tolerance": 0.00045,
"min_slope": 0.00022,
"parallel_tolerance": 0.00035,
"min_convergence": 0.18,
"min_impulse": 0.055,
"break_buffer": 0.001
}
}Other exports#
This module also exports
traceRisingFallingWedge. Every module additionally exports run as an alias of its
primary function, and a meta object carrying its catalog id, domain, family,
shape and article URL.
Diagrams#
How it works#
This page states the contract — how to call it correctly. The article explains the concept: why it works, and where it breaks.
References#
- Foundations of Technical Analysis — Andrew W. Lo, Harry Mamaysky, and Jiang Wang
- SciPy `find_peaks` — SciPy project
- The Probability of Backtest Overfitting — David H. Bailey, Jonathan M. Borwein, Marcos López de Prado, and Qiji Jim Zhu
- Applicability decision