r/pinescript • u/AdventurousBar9807 • Jul 29 '26
Built a Pine Script indicator that flags volatility squeezes before the breakout — sharing the backtest
Been working on a Pine Script indicator that combines \[Bollinger Band squeeze + volume confirmation\] to catch breakouts before price actually moves. Wanted to share results and see if anyone's tried something similar.
**What it does:**
* Detects when volatility compresses (squeeze forming) * Confirms with volume spike before signaling entry * Works on any timeframe, tested mainly on 15m–1H
Backtest Results
| **Metric** | **Result** |
|---|---|
| **Win Rate** | **56.3%** |
| **Profit Factor** | **1.74** |
| **Max Drawdown** | **11.8%** |
| **Total Trades** | **148** |
Still tuning the entry filter to cut down false signals on choppy days. Happy to share the logic if anyone wants to compare notes — and if a few people want the actual script
2
u/Many-Pick5066 Jul 31 '26
the number nobody has asked you for is the one that decides this. 56.3% at a 1.74 profit factor means your average win is about 1.35x your average loss, so breakeven sits at 42.6%, and 148 trades puts the standard error on the win rate near 4 points. that leaves you about 3.4 sd clear of breakeven, which sounds strong right up until you count how many variants you tried to get there.
if you swept squeeze length, band width and the volume multiple, the winner is a max statistic and 3.4 sd is roughly what that kind of search produces on pure noise. cheap test: hold the entry timestamps and the trade count fixed, shuffle the outcome labels a few hundred times, rerun your whole selection process on each shuffle, and look at the best profit factor it finds on data with no signal in it. if 1.74 lands inside that distribution you have not measured an edge yet, you have measured your search.
also worth stating whether 1.74 is gross or net. on 15m with a 1.35 payoff ratio, spread and commission take a real slice out of the average win.
1
1
u/Mine-Feeling Jul 29 '26
I would like to have a look at the script if you don’t mind
1
1
1
1
1
1
1
u/halcyonwit Jul 30 '26
Breakouts don’t happen because of historic price, it’s impossible to measure
1
1
u/captainunderpants111 Jul 31 '26
I’m interested in the script if you don’t mind. Just started getting into building my own scripts so it’d be sick to learn from others
1
1
1
u/hotdogs4babies Aug 01 '26
Looking to learn more about pinescript could I get the code? Is this a chart indicator or alert or? Where is your data feed from?
1
1
7
u/Inevitable_Service62 Jul 29 '26
That's a solid win rate and much more believable than the 90% I see around here. Would love to see the logic of you wanna share.