From 8c937dd818fd09e079eb0b31eaa4a464c8025888 Mon Sep 17 00:00:00 2001 From: mindesbunister Date: Mon, 17 Nov 2025 11:55:39 +0100 Subject: [PATCH] fix: Update calculateDynamicTp2 to use new atrMultiplierTp2 field name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Changed atrMultiplierForTp2 → atrMultiplierTp2 to match new interface - Marked function as LEGACY for backward compatibility - Resolves TypeScript build error --- config/trading.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/config/trading.ts b/config/trading.ts index ca6b520..c85b7dd 100644 --- a/config/trading.ts +++ b/config/trading.ts @@ -356,6 +356,7 @@ export async function getActualPositionSizeForSymbol( /** * Calculate dynamic TP2 level based on ATR (Average True Range) * Higher ATR = higher volatility = larger TP2 target to capture big moves + * LEGACY FUNCTION - Kept for backward compatibility */ export function calculateDynamicTp2( basePrice: number, @@ -369,8 +370,8 @@ export function calculateDynamicTp2( // Convert ATR to percentage of current price const atrPercent = (atrValue / basePrice) * 100 - // Calculate dynamic TP2: ATR × multiplier - const dynamicTp2 = atrPercent * config.atrMultiplierForTp2 + // Calculate dynamic TP2: ATR × multiplier (use new field name) + const dynamicTp2 = atrPercent * config.atrMultiplierTp2 // Apply min/max bounds const boundedTp2 = Math.max( @@ -378,7 +379,7 @@ export function calculateDynamicTp2( Math.min(config.maxTp2Percent, dynamicTp2) ) - console.log(`📊 ATR-based TP2: ATR=${atrValue.toFixed(4)} (${atrPercent.toFixed(2)}%) × ${config.atrMultiplierForTp2} = ${dynamicTp2.toFixed(2)}% → ${boundedTp2.toFixed(2)}% (bounded)`) + console.log(`📊 ATR-based TP2: ATR=${atrValue.toFixed(4)} (${atrPercent.toFixed(2)}%) × ${config.atrMultiplierTp2} = ${dynamicTp2.toFixed(2)}% → ${boundedTp2.toFixed(2)}% (bounded)`) return boundedTp2 }