• Creates a new VWAP calculation session.

    The Volume-Weighted Average Price (VWAP) is a trading benchmark that shows the ratio of the value traded to total volume traded over a specific time period. It's calculated by adding up the dollars traded for every transaction (price multiplied by the number of shares traded) and then dividing by the total shares traded.

    Parameters

    • pricePrecision: number

      The number of decimal places to round the VWAP value to.

    Returns VWAPSession

    A new VWAP calculation session.

    Example

    import * as ta from 'chart-patterns';

    // Create a new VWAP session with 2 decimal places precision
    const vwapSession = ta.VWAP.createSession(2);

    // Process candles
    for (const candle of candles) {
    vwapSession.processCandle(candle);
    }

    // Get the current VWAP value
    const vwapValue = vwapSession.getVWAP();

Generated using TypeDoc