function calculateAdvancedProfitScore(data) {
const {
change1h, change24h, change7d,
volume, avgVolume24h,
lastPrice,
volatility, // e.g. std dev of returns
macdHist,
rsi,
sentimentScore
} = data;
// Weight changes by timeframe
const weightedChange = (change1h * 5) + (change24h * 3) + (change7d * 1);
// Volume spike factor
const volumeSpike = Math.log10(volume / (avgVolume24h || 1) + 1);
// Volatility penalty (higher volatility reduces score)
const volPenalty = 1 / (1 + volatility);
// MACD and RSI multipliers (momentum confirmation)
const momentumFactor = 1 + (macdHist > 0 ? 0.1 : -0.1) + ((rsi > 50 ? (rsi - 50) : 0) * 0.005);
// Sentiment adjustment (+/-)
const sentimentFactor = 1 + (sentimentScore || 0) * 0.1;
// Smooth price penalty for high-price assets
const pricePenalty = 1 / (1 + Math.log10(lastPrice || 1) * 0.2);
// Final advanced score
const score = weightedChange * volumeSpike * volPenalty * momentumFactor * sentimentFactor * pricePenalty;
return score;
}
Comments
Post a Comment