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

forex-tester-custom-indicator-api

v3.0.1

Published

TypeScript types and runtime API for custom indicators in [Forex Tester Online](https://forextester.com/).

Readme

forex-tester-custom-indicator-api

TypeScript types and runtime API for custom indicators in Forex Tester Online.

Install this package in a custom indicator project, extend Indicator, then build and upload the result to FTO.

Install

npm install forex-tester-custom-indicator-api

Write an indicator

Export a default class that extends Indicator. Implement OnInit and OnCalculate. The platform injects this.api before OnInit runs.

import {
  Indicator,
  IndexBuffer,
  InputNumber,
  InputEnum,
  MovingAverageType,
  OutputWindow,
  PenStyle,
  PlotType,
  PriceType,
} from 'forex-tester-custom-indicator-api'

export default class SimpleMovingAverage extends Indicator {
  private period!: InputNumber
  private maType!: InputEnum<MovingAverageType>
  private applyToPrice!: InputEnum<PriceType>
  private buffer!: IndexBuffer

  public OnInit(): void {
    this.api.SetIndicatorShortName('SMA')
    this.api.SetIndicatorOutputWindow(OutputWindow.CHART)

    this.period = this.api.CreateIntegerInput('Period', 14, 1, 500, 1)
    this.maType = this.api.CreateMATypeInput()
    this.applyToPrice = this.api.CreateApplyToPriceInput()

    this.buffer = this.api.CreateBuffer()
    this.api.SetPlotCount(1)
    this.api.CreatePlot(0, this.buffer, 'SMA', PlotType.LINE, PenStyle.SOLID, 1, '#2196F3')
  }

  public OnCalculate(index: number): void {
    if (index + this.period.value >= this.api.Bars()) {
      return
    }

    const value = this.api.GetMA(
      index,
      0,
      this.period.value,
      this.maType.value,
      this.applyToPrice.value,
      this.buffer.getValue(index + 1)
    )

    this.buffer.setValue(index, value)
  }
}

Lifecycle

| Method | Required | When it runs | | --- | --- | --- | | OnInit() | yes | Once, when the indicator is created | | OnCalculate(index) | yes | For each bar that needs a value. 0 is the current bar | | OnParamsChange() | no | After the user changes inputs | | OnHide() / OnShow() | no | When the indicator is hidden or shown | | OnDeinit() | no | When the indicator is removed | | OnToolButtonClick(toolName) | no | When an indicator tool button is clicked |

What this.api covers

  • Plots and buffersCreateBuffer, SetPlotCount, CreatePlot, and related style helpers
  • InputsCreateIntegerInput, CreateDoubleInput, CreateEnumInput, CreateMATypeInput, CreateApplyToPriceInput, and other typed input helpers
  • Chart dataOpen, High, Low, Close, Volume, Time, Bars, Symbol, Timeframe
  • Built-in indicatorsGetMA, iRSI, iMACD, and other i* helpers
  • Objects, dates, and account info — chart objects, FTODate, and account/testing helpers

TypeScript types in this package are the source of truth: use autocomplete on this.api and the exported enums.

Documentation

Full authoring guides, setup, and upload steps: FTO custom indicators docs.