chart-0714
Version:
Professional trading chart library with advanced customization for trading journal apps
54 lines (53 loc) • 1.58 kB
TypeScript
import { ChartData } from '../types';
export interface IndicatorParams {
period?: number;
periods?: number[];
color?: string;
colors?: string[];
multiplier?: number;
source?: 'close' | 'open' | 'high' | 'low' | 'hl2' | 'hlc3' | 'ohlc4';
[key: string]: any;
}
export interface IndicatorConfig {
id: string;
name: string;
type: string;
params: IndicatorParams;
style: {
color: string;
lineWidth: number;
lineStyle: 'solid' | 'dashed' | 'dotted';
opacity: number;
};
visible: boolean;
}
export interface IndicatorPlugin {
id: string;
name: string;
description: string;
defaultConfig: Partial<IndicatorConfig>;
calculate(data: ChartData, params: IndicatorParams): Float32Array | null;
calculateAll?(data: ChartData, params: IndicatorParams): Map<string, Float32Array>;
getPreset?(name: string): IndicatorParams | null;
configSchema: {
params: Array<{
key: string;
label: string;
type: 'number' | 'select' | 'color' | 'range';
default: string | number | boolean;
min?: number;
max?: number;
step?: number;
options?: Array<{
value: string | number;
label: string;
}>;
}>;
};
}
export declare class IndicatorPluginRegistry {
private static plugins;
static register(plugin: IndicatorPlugin): void;
static get(id: string): IndicatorPlugin | undefined;
static getAll(): IndicatorPlugin[];
}