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

@candleview/cvs-engine

v0.1.2

Published

CVSEngine is the DSL parsing engine for CandleView, used to parse CVScirpt (CandleView Script) scripts.

Downloads

278

Readme

⚙️ Install

npm i @candleview/cvs-engine
yarn add @candleview/cvs-engine

DSL Built-in Functions

Data Access

  • getClose() - Latest close price, returns number
  • getOpen() - Latest open price, returns number
  • getHigh() - Latest high price, returns number
  • getLow() - Latest low price, returns number
  • getVolume() - Latest volume, returns number
  • getTime() - Latest timestamp, returns number
  • getCloseAt(offset) - Historical close price, offset 0=latest, returns number
  • getOpenAt(offset) - Historical open price, returns number
  • getHighAt(offset) - Historical high price, returns number
  • getLowAt(offset) - Historical low price, returns number
  • getVolumeAt(offset) - Historical volume, returns number
  • getBarCount() - Total bar count, returns number

Technical Indicators

  • SMA(source, period) - Simple moving average, returns number
  • EMA(source, period) - Exponential moving average, returns number
  • WMA(source, period) - Weighted moving average, returns number
  • SMMA(source, period) - Smoothed moving average, returns number
  • RSI(source, period) - Relative strength index, period default 14, returns number
  • MACD(source, fast, slow, signal) - MACD, returns {macd, signal, histogram}
  • BOLL(source, period, stdDev) - Bollinger Bands, returns {upper, middle, lower}
  • KDJ(highs, lows, closes, period) - KDJ indicator, returns {k, d, j}
  • ATR(highs, lows, closes, period) - Average true range, returns number
  • CCI(highs, lows, closes, period) - Commodity channel index, returns number
  • ADX(highs, lows, closes, period) - Average directional index, returns number
  • OBV(closes, volumes) - On-balance volume, returns number
  • SAR(highs, lows, step, maxStep) - Parabolic SAR, returns number[]
  • BBWIDTH(source, period, stdDev) - Bollinger band width, returns number

Chart Markers

  • addTextMark(time, text, direction, options) - Add text marker, direction: 'up'|'down'
  • addArrowUp(time, label, color) - Add up arrow marker
  • addArrowDown(time, label, color) - Add down arrow marker
  • clearAllMarks() - Clear all markers

Built-in Indicators Control

  • openIndicator(name, params) - Open built-in indicator
  • closeIndicator(name) - Close built-in indicator
  • closeAllIndicators() - Close all built-in indicators

Custom Indicators

  • plotMain(config) - Plot custom main chart indicator
  • plotSub(config) - Plot custom sub chart indicator
  • updateMain(id) - Update custom main indicator
  • updateSub(id) - Update custom sub indicator
  • removeMain(id) - Remove custom main indicator
  • removeSub(id) - Remove custom sub indicator
  • clearAllMain() - Clear all custom main indicators
  • clearAllSub() - Clear all custom sub indicators

Custom Technical Graphics

Custom Main Chart Technical Graphics

plotMain(config)

Draws a custom main chart indicator (overlay on the candlestick chart)

Config Parameters:

| Field | Type | Description | | ---------- | -------- | ----------------------------------------------------------- | | id | string | Unique identifier for the indicator, used for update/remove | | calculator | function | Calculation function, called once per candlestick | | options | object | Optional, style configuration |

calculator Parameters:

| Parameter | Type | Description | | --------- | ------ | --------------------------------------------- | | index | number | Candlestick index (reverse order, 0 = latest) | | open | number | Current candlestick open price | | high | number | Current candlestick high price | | low | number | Current candlestick low price | | close | number | Current candlestick close price | | volume | number | Current candlestick volume |

options Configuration:

| Field | Type | Default | Description | | ------------ | --------------------------- | --------- | ---------------------- | | name | string | - | Indicator display name | | color | string | '#FF6B6B' | Line color | | width | number | 2 | Line width | | style | 'solid'|'dashed'|'dotted' | 'solid' | Line style | | visible | boolean | true | Visibility | | priceScaleId | string | 'right' | Price scale ID |

Example:

plotMain({
  id: "MA20",
  calculator: (index, open, high, low, close, volume) => {
    if (getBarCount() < 20) return null;
    let closes = [];
    for (let i = 0; i < 20; i++) closes.push(getCloseAt(i));
    return SMA(closes, 20);
  },
  options: {
    name: "MA20",
    color: "#FF6B6B",
    width: 2,
    style: "solid",
  },
});

plotSub(config)

Draws a custom sub chart indicator (independent panel)

Config Parameters:

| Field | Type | Description | | ---------- | -------- | ----------------------------------------------------------- | | id | string | Unique identifier for the indicator, used for update/remove | | calculator | function | Calculation function, called once per candlestick | | options | object | Optional, style configuration |

calculator Parameters:

| Parameter | Type | Description | | --------- | ------ | --------------------------------------------- | | index | number | Candlestick index (reverse order, 0 = latest) | | open | number | Current candlestick open price | | high | number | Current candlestick high price | | low | number | Current candlestick low price | | close | number | Current candlestick close price | | volume | number | Current candlestick volume |

options Configuration:

| Field | Type | Default | Description | | ------- | ------------------------------- | --------- | ---------------------- | | name | string | - | Indicator display name | | color | string | '#FF6B6B' | Line color | | width | number | 2 | Line width | | type | 'line' | 'histogram' | 'area' | 'line' | Chart type | | visible | boolean | true | Visibility |

Example:

plotSub({
  id: "RSI_14",
  calculator: (index, open, high, low, close, volume) => {
    if (getBarCount() < 15) return null;
    let closes = [];
    for (let i = 0; i < 15; i++) closes.push(getCloseAt(i));
    return RSI(closes, 14);
  },
  options: {
    name: "RSI(14)",
    color: "#FF6B6B",
    width: 2,
    type: "line",
  },
});