fix: Update calculateDynamicTp2 to use new atrMultiplierTp2 field name
- Changed atrMultiplierForTp2 → atrMultiplierTp2 to match new interface - Marked function as LEGACY for backward compatibility - Resolves TypeScript build error
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user