Notice!
This is documentation for kScript v1.0, which may not include the latest features. For up-to-date documentation, see the latest version.

Overview

Chart Rendering

Plot time series data directly onto charts with multiple style options including lines, splines, points, candles, and bars for comprehensive market visualization.

• Multiple plot styles • Real-time rendering • Interactive charts

Visual Customization

Customize colors, line widths, fill areas, and smoothing options to create visually appealing and distinct indicators that stand out on your charts.

• Color arrays • Line styling • Fill effects

Advanced Effects

Apply advanced visual effects like momentum fills, smooth curves, and multi-layer plotting to create sophisticated technical analysis displays.

• Momentum fills • Smooth curves • Multi-layer plots

Functions Reference

plot - universal plotting function for all visualization types

plot(series: TimeSeries, type?: 'spline' | 'line' | 'bar' | 'candle' | 'point', colors?: string[], width?: number, fill?: boolean | 'momentum_fill', smooth?: boolean, showPriceDisplay?: boolean): void

Parameters:

  • series (TimeSeries) - The data series to visualize
  • type (string) - "spline"/"line" for lines, "bar" for histogram, "candle" for OHLC, "point" for dots
  • colors (string[]) - Colors array - format depends on plot type and fill mode
  • width (number) - Thickness of lines or size of bars/points (1-5)
  • fill (boolean | 'momentum_fill') - true for area fill, "momentum_fill" for conditional coloring
  • smooth (boolean) - Smooth line curves for better visual appeal
  • showPriceDisplay (boolean) - Show current value in price scale (default: false)

Returns:

void (plots data on chart)

Code Example:

plotCandle - render OHLC data as candlestick charts

plotCandle(series: TimeSeries, colors?: color[] = ['orange', 'green'], width?: number = 1, showPriceDisplay?: boolean = false): void

Parameters:

  • series (TimeSeries) - OHLC data series to plot as candlesticks
  • colors (color[]) - Color array for bullish/bearish candles (default: ['orange', 'green'])
  • width (number) - Candle width (default: 1)
  • showPriceDisplay (boolean) - Show current value in price scale (default: false)

Returns:

void (plots candlestick chart)

Code Example:

plotBar - render OHLC data as traditional bar charts

plotBar(series: TimeSeries, colors?: color[] = ['orange', 'green'], width?: number = 1, showPriceDisplay?: boolean = false): void

Parameters:

  • series (TimeSeries) - OHLC data series to plot as bars
  • colors (color[]) - Color array for bullish/bearish bars (default: ['orange', 'green'])
  • width (number) - Bar width (default: 1)
  • showPriceDisplay (boolean) - Show current value in price scale (default: false)

Returns:

void (plots bar chart)

Code Example:

plotLine - render data as enhanced line charts

plotLine(series: TimeSeries, colors?: color[] = ['orange'], width?: number = 2, fill?: boolean | 'momentum_fill' | 'default' = false, smooth?: boolean = false, showPriceDisplay?: boolean = false): void

Parameters:

  • series (TimeSeries) - Data series to plot as lines
  • colors (color[]) - Color array for lines (default: ['orange'])
  • width (number) - Line width (default: 2)
  • fill (boolean | 'momentum_fill' | 'default') - Fill options for area under lines (default: false)
  • smooth (boolean) - Enable smooth line rendering (default: false)
  • showPriceDisplay (boolean) - Show current value in price scale (default: false)

Returns:

void (plots line chart)

Code Example:

plotShape - render custom shapes and markers on charts

plotShape(series: TimeSeries, shape: ShapeType, colors?: color[] = ['orange'], width?: number = 2, fill?: boolean | 'false' | 'momentum_fill' | 'default' = false, showPriceDisplay?: boolean = false): void

Parameters:

  • series (TimeSeries) - Data series for shape positioning
  • shape (ShapeType) - Shape type to plot (e.g., 'circle', 'triangle', 'square')
  • colors (color[]) - Color array for shapes (default: ['orange'])
  • width (number) - Shape border width (default: 2)
  • fill (boolean | 'false' | 'momentum_fill' | 'default') - Fill options for shapes (default: false)
  • showPriceDisplay (boolean) - Show current value in price scale (default: false)

Returns:

void (plots shapes on chart)

Code Example:

Common Usage Patterns

Candlestick Price Chart

Display OHLC price data using candlestick visualization with price display

Traditional Bar Chart

Display OHLC data as traditional bar charts with custom colors and price display

Enhanced Line Plotting

Use plotLine for smooth moving averages with momentum fills and price display

Momentum Fill Visualization

Create filled areas that change color based on momentum with price display

Best Practices

🎨

Color Selection

Use contrasting colors for different data series. Consider color-blind accessibility when choosing color schemes for your indicators.

📏

Line Width

Use thicker lines (3-4) for primary indicators and thinner lines (1-2) for secondary data. This creates visual hierarchy in your charts.

Smooth Curves

Enable smooth curves for continuous data like moving averages, but use straight lines for discrete signals or step functions.

🕯️

Candlestick Colors

Use traditional green/red or green/red color schemes for candlesticks. Green typically represents bullish (closing higher) and red represents bearish (closing lower).

🎯

Shape Positioning

When using plotShape for signals, position markers slightly above or below price action to avoid overlapping with the main chart data.

📊

Chart Types

Use plotCandle for price action analysis, plotBar for traditional OHLC display, plotLine for indicators, and plotShape for discrete signals and annotations.

📖
Introduction
Overview of kScript language
🚀
Quick Start
Get started with kScript basics
📋
Function Reference
Complete API reference guide
🔧
Core Concepts
Variables, data types & data sources
🔗
Script Definition
Defining inputs and metadata
TimeSeries Management
Working with time-aligned data
🎯
Utility Functions
Helper functions and calculations
📈
Moving Averages
SMA, EMA and trend-following indicators
📊
Oscillators
RSI, Stochastic and momentum indicators
📈
Trend Indicators
Trend direction and strength analysis
📉
Volume Indicators
Volume-based analysis tools
📦
Orderbook Functions
Market depth analysis tools
🎨
Plotting & Visualization
Chart rendering and styling
🌈
Color Functions
Color manipulation and styling
🏠
Go Home
Return to main landing page