TradeJS strategy plugin providing Triangle.
Triangle detects three converging price structures:
- An ascending triangle has approximately horizontal resistance and rising lows.
- A descending triangle has approximately horizontal support and falling highs.
- A symmetric triangle has falling highs and rising lows with comparable boundary angles.
The detector enters only after a candle closes through a boundary. By default,
an ascending triangle can break either upward as continuation or downward as
reversal, and a descending triangle can do the mirror image. Set
TRIANGLE_ALLOW_REVERSE_BREAKOUTS to false to keep only the conventional
ascending-up and descending-down signals. A symmetric triangle always takes the
direction of the actual breakout.
The illustrations are schematic. Swing highs and lows define regression boundaries. The detector requires repeated touches, shrinking width, acceptable touch error, candle containment, sufficient height, and an apex ahead of the breakout. These checks keep the pattern distinct from parallel channels and already-expired wedges.
The stop sits beyond the opposite boundary. The target projects a configurable
part of the triangle's starting height from the broken boundary. The detector
supports breakout, close_acceptance, and retest entries and keeps bounded,
replay-safe state.
Primary research fields are grouped by purpose:
- Structure
TRIANGLE_MIN_BARSandTRIANGLE_MAX_BARSTRIANGLE_PIVOT_RADIUSTRIANGLE_MIN_TOUCHES_PER_BOUNDARYTRIANGLE_MIN_TOUCH_SPAN_BARS
- Geometry
TRIANGLE_MAX_FLAT_SLOPE_PCT_PER_BARTRIANGLE_MIN_CONVERGING_SLOPE_PCT_PER_BARTRIANGLE_MIN_SYMMETRY_RATIOTRIANGLE_MAX_END_WIDTH_RATIOTRIANGLE_MAX_APEX_AFTER_BREAKOUT_BARS
- Entry and risk
TRIANGLE_ALLOW_REVERSE_BREAKOUTSTRIANGLE_ENTRY_MODETRIANGLE_TARGET_HEIGHT_RATIOTRIANGLE_STOP_BUFFER_ATRLONG.minRiskRatioandSHORT.minRiskRatio
yarn add @tradejs/strategy-triangleRegister the package in tradejs.config.ts:
import { defineConfig } from "@tradejs/core/config";
export default defineConfig({
strategies: ["@tradejs/strategy-triangle"],
});The package exports strategyEntries, the Triangle strategy definition,
manifest, default config, and AI adapter. The adapter adds complete triangle
geometry to the AI payload without imposing an unresearched local gate.
yarn install --immutable
yarn checksPublishing is beta-first and delegated to the pinned
TradeJS-Workflows@v1 reusable workflow.
All @tradejs/* runtime packages are peer dependencies. The consuming TradeJS
Project owns their exact installed versions and package manifest, so this
package never loads a hidden nested engine, types package, or Strategy Kit.