WRITE
Trading Strategies

Open-source framework for TypeScript & Pine Script strategies

Grid Backtesting
Runtime Signals
AI / ML
Telegram Alerts
01

Strategy Authoring

Write strategies in your preferred language with full infrastructure control

TypeScript Strategies & Indicators

Write strategies and indicators in TypeScript with full type safety, autocompletion, and access to the entire npm ecosystem.

Pine Script Compatibility

Migrate existing TradingView strategies seamlessly. TradeJS supports Pine Script authoring alongside TypeScript.

Local & Self-Hosted

Run TradeJS locally or deploy self-hosted. Full control over your data, infrastructure, and execution environment.

02

Intelligence & Backtesting

Grid backtests, prompt replay, and built-in AI / ML for safer strategy iteration

Grid Backtesting

Run massive parameter sweeps with grid config. Find optimal strategy configurations across thousands of combinations automatically.

AI Filter Validation on Backtest Data

Backtests can persist replayable AI rows. Re-run the same historical trades to validate prompt updates, model swaps, and quality thresholds before changing the live AI filter.

Runtime AI / ML

Use AI as a runtime review layer and combine it with ML enrichment when you need live signal filtering, prediction, or risk-aware scoring.

03

Execution & Monitoring

From backtest results to live trading with real-time notifications

01

Backtest-to-Runtime Pipeline

Promote your best backtest results directly to runtime config. No manual tuning — the framework handles the transition.

02

Telegram Notifications

Get real-time signal alerts, execution reports, and error notifications directly in Telegram. Stay informed without watching dashboards.

How It Works

From strategy idea to live execution in four steps

01

Create Strategy

Write your strategy in TypeScript or Pine Script. Define entry/exit rules, indicators, and risk management.

02

Run Grid Backtests

Configure parameter grids, run thousands of historical tests, and capture replayable AI rows during the same backtest flow.

03

Validate AI Filters on Backtest Data

Test prompt changes, provider swaps, and quality thresholds on the same backtest sample before enabling the live AI filter.

04

Promote & Monitor

Move the best configs into runtime, launch execution, and monitor live results with Telegram notifications.

Developer Experience

Dual authoring: write in the language you know best

import { CreateStrategyCore } from '@tradejs/types';
import { EMA } from 'technicalindicators';

export const createMyStrategyCore: CreateStrategyCore<
  MyStrategyConfig
> = async ({ strategyApi, config, data }) => {
  const fastLen = Number(config.EMA_FAST ?? 9);
  const slowLen = Number(config.EMA_SLOW ?? 21);
  const closes = data.map((candle) => candle.close);

  const emaFast = new EMA({ period: fastLen, values: closes });
  const emaSlow = new EMA({ period: slowLen, values: closes });

  return async (candle) => {
    const currentPrice = candle.close;
    emaFast.nextValue(currentPrice);
    emaSlow.nextValue(currentPrice);

    if (await strategyApi.isCurrentPositionExists()) {
      return strategyApi.skip('POSITION_EXISTS');
    }

    const fast = emaFast.getResult().slice(-2);
    const slow = emaSlow.getResult().slice(-2);

    if (fast.length < 2 || slow.length < 2) {
      return strategyApi.skip('WAIT_EMA_DATA');
    }

    const [fastPrev, fastCurrent] = fast;
    const [slowPrev, slowCurrent] = slow;

    const entryLong = fastPrev <= slowPrev && fastCurrent > slowCurrent;
    const entryShort = fastPrev >= slowPrev && fastCurrent < slowCurrent;

    if (!entryLong && !entryShort) {
      return strategyApi.skip('NO_EMA_CROSS');
    }

    const direction = entryLong ? 'LONG' : 'SHORT';
    const { stopLossPrice, takeProfitPrice, qty } =
      strategyApi.getDirectionalTpSlPrices({
        price: currentPrice,
        direction,
        takeProfitDelta: 2,
        stopLossDelta: 1,
        unit: 'percent',
      });

    return strategyApi.entry({
      direction,
      indicators: {
        emaFast: fastCurrent,
        emaSlow: slowCurrent,
      },
      orderPlan: {
        qty,
        stopLossPrice,
        takeProfits: [{ rate: 1, price: takeProfitPrice }],
      },
    });
  };
};
strategy.tsTypeScript
Roadmap

Project roadmap for the next major milestones

Q1
Completed

Project Launch

Launch of the TradeJS open-source framework and the core project foundation.

Q2
Completed

AI Filter Validation on Backtest Data

Capture replayable AI rows during backtests and validate prompt, model, and gating changes on the same historical trades before live rollout.

Q3

Built-In Strategy Catalog Expansion

Expand the catalog of built-in working and validated strategies available out of the box.

Q4

New Data Sources For Strategies

Add new data sources for strategies, including news portals, Reddit, X.com, and Arkham.

Ready to Automate Your Trading?

Start building with the TradeJS open-source framework today. Self-hosted and built for developers.