OPEN-SOURCE SCRIPT
Order Block Stop Survival Study

Credit
The order block detection and the retest condition used as the trigger of this study are adapted from "Power Order Blocks [ChartPrime]" by ChartPrime, published open source under the Mozilla Public License 2.0. Full credit to ChartPrime for that detection method. This script is published open source under the same licence.
What it adds to the original
The original draws order blocks and marks the moment price comes back to them. It never answers the question that actually decides whether you can trade them: when price taps an order block, does a stop of a given size survive long enough for the trade to work, and does that beat entering at a random moment on the same chart?
This script answers exactly that, and it puts the two numbers side by side.
How to read the table
Each row is a stop distance, expressed in ATR multiples or in absolute price.
On OB retest: out of every first touch of a fresh order block, how often the target was reached before the stop.
Random entry: the same measurement made at arbitrary moments on the same chart, both directions.
Edge: the difference in percentage points. Green when the setup beats chance, red when it does not.
The highlighted row is the stop distance you actually use, so you can place your own habit among the others.
The break-even line
A percentage means nothing without a reference. The line under the table gives the success rate that merely breaks even for your chosen target: 50 percent at 1R, 33.3 at 2R, 25 at 3R. Above it you are ahead, below it you are behind, whatever the raw number looks like.
First touch only
By default only the first return to a fresh block is counted, because that is the setup a trader takes. Turn the option off to include later touches of an already used zone. Comparing the two is informative in itself: on most instruments the edge is visibly thinner once worn out zones are included.
Long and short counts are shown
The footer reports how many setups were long and how many were short. If one side dominates heavily on a strongly trending sample, part of any measured edge is the trend rather than the order block. Showing the split lets you judge that instead of taking the result on faith.
How it works
At each sampled bar the script steps back so the entire outcome of the setup already sits in the past, then walks forward bar by bar and records which level was reached first. There is no forward-looking data and no repainting by construction.
When a single bar touches both the stop and the target, the script counts the stop. Inside a bar there is no way to know which came first, and overstating survival would be dishonest.
Settings
Max bars to resolve, target as an R multiple of the stop, and the sampling step of the random baseline.
Displacement multiplier, number of active blocks and minimum spacing between retests, all inherited from the original detection.
Five stop distances plus your own, ATR based or absolute.
Pip size: gold 0.1, forex majors 0.0001, JPY pairs 0.01, 0 to hide pips on crypto.
Colours, text size, border width and table position are configurable.
Limitations
Spread, slippage and commissions are ignored, so a real edge is thinner than the one displayed, and a small edge may not survive costs at all.
The statistics describe the history loaded on your chart. They do not predict anything.
This is a study. It produces no entry signal and no performance claim.
Below the minimum number of setups the table warns instead of showing percentages built on too little data.
The order block detection and the retest condition used as the trigger of this study are adapted from "Power Order Blocks [ChartPrime]" by ChartPrime, published open source under the Mozilla Public License 2.0. Full credit to ChartPrime for that detection method. This script is published open source under the same licence.
What it adds to the original
The original draws order blocks and marks the moment price comes back to them. It never answers the question that actually decides whether you can trade them: when price taps an order block, does a stop of a given size survive long enough for the trade to work, and does that beat entering at a random moment on the same chart?
This script answers exactly that, and it puts the two numbers side by side.
How to read the table
Each row is a stop distance, expressed in ATR multiples or in absolute price.
On OB retest: out of every first touch of a fresh order block, how often the target was reached before the stop.
Random entry: the same measurement made at arbitrary moments on the same chart, both directions.
Edge: the difference in percentage points. Green when the setup beats chance, red when it does not.
The highlighted row is the stop distance you actually use, so you can place your own habit among the others.
The break-even line
A percentage means nothing without a reference. The line under the table gives the success rate that merely breaks even for your chosen target: 50 percent at 1R, 33.3 at 2R, 25 at 3R. Above it you are ahead, below it you are behind, whatever the raw number looks like.
First touch only
By default only the first return to a fresh block is counted, because that is the setup a trader takes. Turn the option off to include later touches of an already used zone. Comparing the two is informative in itself: on most instruments the edge is visibly thinner once worn out zones are included.
Long and short counts are shown
The footer reports how many setups were long and how many were short. If one side dominates heavily on a strongly trending sample, part of any measured edge is the trend rather than the order block. Showing the split lets you judge that instead of taking the result on faith.
How it works
At each sampled bar the script steps back so the entire outcome of the setup already sits in the past, then walks forward bar by bar and records which level was reached first. There is no forward-looking data and no repainting by construction.
When a single bar touches both the stop and the target, the script counts the stop. Inside a bar there is no way to know which came first, and overstating survival would be dishonest.
Settings
Max bars to resolve, target as an R multiple of the stop, and the sampling step of the random baseline.
Displacement multiplier, number of active blocks and minimum spacing between retests, all inherited from the original detection.
Five stop distances plus your own, ATR based or absolute.
Pip size: gold 0.1, forex majors 0.0001, JPY pairs 0.01, 0 to hide pips on crypto.
Colours, text size, border width and table position are configurable.
Limitations
Spread, slippage and commissions are ignored, so a real edge is thinner than the one displayed, and a small edge may not survive costs at all.
The statistics describe the history loaded on your chart. They do not predict anything.
This is a study. It produces no entry signal and no performance claim.
Below the minimum number of setups the table warns instead of showing percentages built on too little data.
Open-source script
In true PulseWire spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Swing crypto depuis 2018, gold en intraday depuis 2ans. Chaque trade passe dans mon journal : tradoshi.com
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by PulseWire. Read more in the Terms of Use.
Open-source script
In true PulseWire spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Swing crypto depuis 2018, gold en intraday depuis 2ans. Chaque trade passe dans mon journal : tradoshi.com
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by PulseWire. Read more in the Terms of Use.
