Loading Data ...
This demo uses the PineTS library to load the market data and calculate the indicators, and QFChart library for visualizing the results.
Loading Data ...
The Squeeze Momentum (SQZMOM) indicator, popularized by trader John Carter, is a powerful tool that combines Bollinger Bands and Keltner Channels to identify periods of consolidation (the "squeeze") and explosive breakout moves. When volatility contracts and price is coiling, the indicator signals a squeeze condition. When the squeeze releases, the momentum histogram shows the direction and strength of the breakout. This makes SQZMOM invaluable for timing entries at the start of new trends.
The SQZMOM indicator consists of two main components:
The classic Squeeze Momentum trading strategy follows these steps:
This live demo demonstrates real-time squeeze detection and momentum analysis using QFChart and PineTS. The indicator continuously calculates Bollinger Bands, Keltner Channels, and momentum values using PineTS's Pine Script runtime, while QFChart renders the interactive histogram with color-coded bars and squeeze markers. The chart updates every 3 seconds with live market data from Binance, allowing you to see squeeze conditions forming and releasing in real-time.
This demo showcases several advanced technical features:
PineTS.stream() with event handlers to receive live indicator updates
| Element | Color | Meaning |
|---|---|---|
| Histogram | Dark Green | Bullish momentum increasing |
| Histogram | Light Green | Bullish momentum decreasing |
| Histogram | Dark Red | Bearish momentum increasing |
| Histogram | Light Red | Bearish momentum decreasing |
| Dots | Gray | Normal squeeze active |
| Dots | Black | Extreme squeeze active |
To implement Squeeze Momentum in your own application:
// Create PineTS instance
const pineTS = new PineTS(PineTS.Provider.Binance, 'BTCUSDC', '15m', 500);
// Stream indicator data
const stream = pineTS.stream(sqzmomIndicator, {
pageSize: 100,
live: true,
interval: 3000
});
// Handle live updates
stream.on('data', (ctx) => {
if (!chart) {
// Initialize chart with historical data
chart = new QFChart.QFChart(container, { /* options */ });
chart.setMarketData(ctx.marketData);
indicator = chart.addIndicator('SQZMOM', ctx.plots, {
isOverlay: false,
height: 25
});
} else {
// Update with live data
indicator.updateData(ctx.plots);
chart.updateData([latestBar]);
}
});