전략편집기 지표요소값 오류 수정
This commit is contained in:
@@ -28,6 +28,11 @@ import {
|
||||
THRESHOLD_HL_UNDER,
|
||||
} from './thresholdSymbols';
|
||||
import { DEFAULT_START_CANDLE, normalizeStartCandleType } from './strategyStartNodes';
|
||||
import {
|
||||
getIndicatorPrimaryPeriod,
|
||||
formatIndicatorPeriodLabel,
|
||||
} from './strategyIndicatorPeriods';
|
||||
import type { DefType } from './strategyEditorShared';
|
||||
|
||||
export interface IndicatorPeriodDef {
|
||||
rsiPeriod: number;
|
||||
@@ -52,22 +57,19 @@ export const VALUE_FIELD_PREFIX: Record<string, string> = {
|
||||
INVEST_PSYCHOLOGICAL: 'INVEST_PSY_VALUE',
|
||||
};
|
||||
|
||||
export function getDefaultIndicatorPeriod(indicatorType: string, def: IndicatorPeriodDef): number {
|
||||
switch (indicatorType) {
|
||||
case 'NEW_HIGH':
|
||||
case 'NEW_LOW':
|
||||
return 9;
|
||||
case 'RSI': return def.rsiPeriod;
|
||||
case 'CCI': return def.cciPeriod;
|
||||
case 'ADX': return def.adxPeriod;
|
||||
case 'WILLIAMS_R': return def.williamsR;
|
||||
case 'TRIX': return def.trixPeriod;
|
||||
case 'VR': return def.vrPeriod;
|
||||
case 'PSYCHOLOGICAL':
|
||||
case 'NEW_PSYCHOLOGICAL': return def.newPsy;
|
||||
case 'INVEST_PSYCHOLOGICAL': return def.investPsy;
|
||||
default: return 14;
|
||||
}
|
||||
export function getDefaultIndicatorPeriod(
|
||||
indicatorType: string,
|
||||
def: IndicatorPeriodDef | DefType,
|
||||
): number {
|
||||
return getIndicatorPrimaryPeriod(indicatorType, def as DefType);
|
||||
}
|
||||
|
||||
/** @internal DefType 전체 필드 — 팔레트 라벨 등 */
|
||||
export function getDefaultIndicatorPeriodLabel(
|
||||
indicatorType: string,
|
||||
def: IndicatorPeriodDef | DefType,
|
||||
): string {
|
||||
return formatIndicatorPeriodLabel(indicatorType, def as DefType);
|
||||
}
|
||||
|
||||
function parseFieldPeriod(field?: string): number | null {
|
||||
|
||||
Reference in New Issue
Block a user