npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@tradejs/strategy-trading-patterns

v0.1.2

Published

Composite 15-minute and one-hour strategy evaluating Diamond, Flag, Gartley and HeadAndShoulders.

Readme

@tradejs/strategy-trading-patterns

TradeJS strategy plugin providing TradingPatterns on the 15m and 1h timeframes (INTERVAL: "15" | "60"), with 60 as the default. Geometry is expressed in candles, so changing the interval changes each pattern's duration.

Included patterns

  • Diamond
  • Flag
  • Gartley
  • HeadAndShoulders

Every detector is evaluated on every candle so its replay state stays current. When several patterns signal on the same candle, TRADING_PATTERNS_PRIORITY selects one decision. The default order is the list above. The selected child keeps ownership of the position and is the only child allowed to request an early pattern exit. Stop-loss and take-profit handling remains with TradeJS.

The package imports each detector through its public strategy package. Pattern geometry, risk plans, figures, and AI context therefore stay owned by their source packages instead of being copied into this repository.

Disabled patterns and Bat were removed from the composition. Existing configs must remove their toggle entries, priority entries and pattern-specific fields. The parser rejects removed patterns rather than silently ignoring them. The standalone child packages are unchanged by this composition cleanup.

Install

yarn add @tradejs/strategy-trading-patterns \
  @tradejs/strategy-diamond \
  @tradejs/strategy-flag \
  @tradejs/strategy-gartley \
  @tradejs/strategy-head-and-shoulders

Register the package in tradejs.config.ts:

import { defineConfig } from "@tradejs/core/config";

export default defineConfig({
  strategies: ["@tradejs/strategy-trading-patterns"],
});

All detectors are enabled by default. The default directional switches from their source packages are preserved. For example, the current HeadAndShoulders default keeps its experimental inverse direction disabled.

{
  TradingPatterns: {
    INTERVAL: "60",
    TRADING_PATTERNS: {
      Diamond: {
        enable: true,
        LONG: { enable: true, minRiskRatio: 1.15 },
        SHORT: { enable: true, minRiskRatio: 1.15 }
      },
      Flag: {
        enable: true,
        LONG: { enable: true, minRiskRatio: 0.7 },
        SHORT: { enable: true, minRiskRatio: 0.5 }
      }
      // Other pattern entries are materialized from defaults.
    }
  }
}

Pattern-specific fields keep their existing names, such as DIAMOND_PIVOT_LENGTH, FLAG_PIVOT_RADIUS, and GARTLEY_MIN_AD_RETRACEMENT_RATIO. They can be tuned in the same TradingPatterns config without changing the composition code.

Top-level LONG.enable and SHORT.enable are master switches. Their minRiskRatio values are optional common floors; the default floor is 0, so each pattern's own directional threshold remains authoritative.

Development

yarn install --immutable
yarn checks

Runtime host contract

All @tradejs/* runtime packages are peer dependencies. The consuming TradeJS Project owns their exact installed versions and package manifest, so this package never loads hidden nested framework or strategy copies.