INNER CODE UNIT · Python

deviation

Spoofkapoof/TradingViewMCPServer · tradingview_mcp/server.py:846

    deviation = ((current_price - vwap) / vwap) * 100 if vwap > 0 else 0

    return {
        "symbol": symbol,
        "timeframe": timeframe,
        "vwap": round(vwap, 5),
        "current_price": current_price,
        "deviation_percent": round(deviation, 2),
        "signal": "ABOVE_VWAP" if current_price > vwap else "BELOW_VWAP",
        "interpretation": f"Price is {abs(deviation):.2f}% {'above' if deviation > 0 else 'below'} VWAP. "
        f"{'Bullish' if deviation > 0 else 'Bearish'} pressure indicated.",
    }


@mcp.tool()
def get_volume_profile(
    symbol: str, timeframe: str = "1h", num_levels: int = 20
) -> dict:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…