Trading Strategystocks
Pocket Pivot Strategy
Institutional buying days: up-day volume > all prior 10 down-day volumes, close in upper portion of range.
What is Pocket Pivot?
Identifies enhanced institutional buying: current up-day volume exceeds all down-day volumes in the prior 10 days, with close in the upper portion of the range. Filters churning and focuses on genuine accumulation. Long-only; exit on first down day. Popular with William O'Neill / CAN SLIM style trading.
Strategy Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| lookback | number | 10 | Days to compare volume |
| upperPortionPct | number | 0.5 | Close in upper % of range (0-1) |
Use Cases
- ✓Institutional accumulation days
- ✓Volume climax on up days
- ✓Stocks only
- ✓Swing / position
Strategy Script (JavaScript)
This strategy runs in VaultCharts using the built-in strategy engine. Below is the full script in a readable format. You can copy it or run it directly in VaultCharts.
strategy.jsVaultCharts built-in
module.exports = {
meta: {
name: "Pocket Pivot",
params: {
lookback: { type: "number", default: 10 },
upperPortionPct: { type: "number", default: 0.5 }
}
},
compute: (data, params, utils) => {
const cleanData = data.filter(d =>
d && Number.isFinite(d.high) && Number.isFinite(d.low) && Number.isFinite(d.close) &&
Number.isFinite(d.open) && Number.isFinite(d.time) && Number.isFinite(d.volume) &&
d.high >= d.low && d.close > 0 && d.volume >= 0
);
if (!cleanData || cleanData.length < 15) return { signals: [] };
const lookback = params?.lookback ?? 10;
const upperPortionPct = params?.upperPortionPct ?? 0.5;
const signals = [];
let position = null;
for (let i = lookback; i < cleanData.length; i++) {
const candle = cleanData[i];
const range = candle.high - candle.low;
const isUpDay = candle.close > candle.open;
if (!isUpDay || range <= 0) {
if (position) {
signals.push({ type: "exit", direction: "long", time: candle.time, price: candle.close, index: i });
position = null;
}
continue;
}
const closePositionInRange = (candle.close - candle.low) / range;
const inUpperPortion = closePositionInRange >= upperPortionPct;
const priorSlice = cleanData.slice(i - lookback, i);
const downDayVolumes = priorSlice.filter(c => c.close < c.open).map(c => c.volume || 0);
const currentVol = candle.volume || 0;
const volumeGreaterThanAllDown = downDayVolumes.length === 0 || downDayVolumes.every(v => currentVol > v);
if (position === 'long') {
if (candle.close < candle.open) {
signals.push({ type: "exit", direction: "long", time: candle.time, price: candle.close, index: i });
position = null;
}
continue;
}
if (!position && volumeGreaterThanAllDown && inUpperPortion) {
signals.push({ type: "entry", direction: "long", time: candle.time, price: candle.close, index: i });
position = 'long';
}
}
return { signals };
}
};Run Pocket Pivot in VaultCharts
VaultCharts includes this strategy as a built-in option. Backtest it, adjust parameters, and use it on your own data—all stored locally on your device.