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

RSI (Relative Strength Index)

Measures momentum by comparing recent gains to losses. Values oscillate between 0-100.

• Overbought: > 70 • Oversold: < 30 • Momentum divergence

CCI (Commodity Channel Index)

Measures deviation from statistical mean to identify cyclical trends and extremes.

• Overbought: > +100 • Oversold: < -100 • Trend strength

Stochastic Oscillator

Compares closing price to price range over time. Shows %K and %D lines.

• Overbought: > 80 • Oversold: < 20 • %K/%D crossovers

Functions Reference

rsi - momentum oscillator (0-100)

rsi(source: TimeSeries, period: number, priceIndex?: number = 1): TimeSeries

Parameters:

  • source (TimeSeries) - Source data for calculation
  • period (number) - Number of periods (typically 14)
  • priceIndex (number) - Index of price data (default: 1)

Returns:

TimeSeries (values 0-100)

Code Example:

_cci - Commodity Channel Index measures deviation from statistical mean

_cci(barIndex: number, series: TimeSeries, period?: number = 20, constant?: number = 0.015): number

Parameters:

  • barIndex (number) - Current bar index
  • series (TimeSeries) - Source data series
  • period (number) - Number of periods (default: 20)
  • constant (number) - Scaling constant (default: 0.015)

Returns:

number (CCI value, typically between -100 and +100)

Code Example:

_stochastic - Stochastic Oscillator compares closing price to price range

_stochastic(barIndex: number, series: TimeSeries, kPeriod?: number = 14, kSmoothing?: number = 3, dPeriod?: number = 3): [number, number]

Parameters:

  • barIndex (number) - Current bar index
  • series (TimeSeries) - Source data series
  • kPeriod (number) - %K periods (default: 14)
  • kSmoothing (number) - %K smoothing (default: 3)
  • dPeriod (number) - %D periods (default: 3)

Returns:

[number, number] ([%K, %D] values between 0-100)

Code Example:

Common Usage Patterns

RSI Divergence Detection

Identify potential reversals when price and RSI move in opposite directions

Multi-Oscillator Confirmation

Combine multiple oscillators for stronger signal confirmation

Best Practices

⚠️

Avoid False Signals

Oscillators can remain overbought/oversold for extended periods in strong trends. Always confirm with price action and trend direction.

🎯

Divergence Analysis

Look for divergences between price and oscillator. When price makes new highs/lows but oscillator doesn't, reversal may be coming.

📊

Multiple Timeframes

Use oscillators on multiple timeframes. Higher timeframe signals are generally more reliable than lower timeframe signals.

🔄

Market Conditions

Oscillators work best in ranging markets. In strong trends, use them for timing entries rather than counter-trend trading.

📖
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