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 = 14, priceIndex?: number = 1): number

Parameters:

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

Returns:

number (RSI value 0-100 for current bar)

Code Example:

cci - Commodity Channel Index measures deviation from statistical mean

cci(source: TimeSeries, period?: number = 20, constant?: number = 0.015): number

Parameters:

  • source (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(source: TimeSeries, kPeriod?: number = 14, kSmoothing?: number = 3, dPeriod?: number = 3): [number, number]

Parameters:

  • source (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:

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
🔍
Overview
Complete technical documentation
🚀
Quick Start
Get started with kScript basics
📋
Function Reference
Complete API reference guide
📚
Type System
Understanding kScript data types
General FAQ
Frequently asked questions about kScript
Best Practices
Guidelines for writing efficient kScript code
⚠️
Limitations
Known constraints and workarounds
🆕
Updates
v1 vs v2 differences and improvements
🔧
Core Concepts
Variables, data types & data sources
⚙️
Execution Model
Per-bar execution lifecycle and phases
🏷️
Keyword Arguments
Named parameters for clear function calls
🔗
Field Accessors
Dot notation for timeseries field access
🛠️
User-Defined Functions
Create custom reusable functions
🔗
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
📊
Data Subscriptions
Subscribe to OHLCV, trades, and orderbook data
🔄
Loops
For loops and while loops for iteration
🧮
Math Functions
Mathematical functions and constants
🏠
Go Home
Return to main landing page