OPEN-SOURCE SCRIPT

Daytrade Forex Scalper TwinPulse Auction Timer Indicator

109
What this indicator is

TwinPulse Auction Timer is a multi component execution aid designed for liquid markets. It looks for two families of opportunities

Breakouts that leave a compression area after a fresh sweep

Reversals that trigger after a sweep with strong wick polarity

It does not try to predict future prices. It measures present auction conditions with transparent rules and shows you when those conditions align. You get a simple table that says LONG SHORT or WAIT, optional session shading, clean entry and exit level visuals, and alerts you can wire to your workflow.

Why it is different

Most tools show a single signal. TwinPulse combines several independent signals into an Edge Score that you can tune. The components are

• Pulse. A signed measure of wick asymmetry with candle body direction
• Compression. Current true range compared with an average range
• Sweep timer. Bars elapsed since the most recent sweep of a prior high or low
• Bias. Direction of a higher timeframe candle
• Regime. Efficiency ratio and the relation of micro to macro volatility
• Location. Distance from the daily anchored VWAP
• Session. London and New York filter by time windows

Each component is visible in the inputs and in the table so you can understand why a suggestion appears. The script uses request.security() with lookahead off in all calls so it does not peek into the future. Shapes may move while a bar is open since price is still forming. They stop moving when the bar closes.

What you will see on the chart

• L and S shapes on entry bars
• An Exit shape at the price where a stop or the runner target would have been hit
• Four horizontal lines while a trade is active
Entry
Stop
TP1 at one R
TP2 at the runner target expressed in R
• Labels anchored to each line so you can instantly read Entry SL TP1 and TP2 with current values
• Optional shading during your session windows
• Optional daily VWAP line

The table in the top right shows
Action LONG SHORT IN LONG IN SHORT or WAIT
Session ON or OFF
Bias UP DOWN or FLAT
Pulse value
Compression value
Edge L percent and Edge S percent

How it works in detail

Pulse
For each bar the script measures up wick minus down wick divided by range and multiplies that by the sign of the candle body. The result is averaged with pulse_len. Positive numbers indicate aggressive buying. Negative numbers indicate aggressive selling. You control the minimum absolute value with pulse_thr.

Compression
Compression is the ratio of current range to an average range. You can choose the range basis. HL SMA uses simple high minus low smoothed by range_len. ATR uses classic True Range smoothed by atr_len. Values below comp_thr indicate a coil.

Sweeps and the timer
A sweep occurs when price trades beyond the highest high or lowest low seen in the previous sweep_len bars. A strict sweep requires a close back inside that prior range. The timer measures how many bars have elapsed since the last sweep. Breakout setups require the timer to exceed timer_thr.

Bias on a confirmation timeframe
A higher timeframe candle is read with confirm_tf. If close is above open bias is UP. If close is below open bias is DOWN. This keeps breakouts aligned with the prevailing drift.

Regime filters
Efficiency ratio measures the straight line change over the sum of absolute bar to bar changes over er_len. It rises in trendy conditions and falls in noise. Minimum efficiency is controlled by er_min.
Micro to macro volatility ratio compares a short lookback average range with a longer lookback average range using your chosen basis. For breakouts you usually want micro volatility to be near or above macro hence mvr_min. For reversals you often want micro volatility that is not overheated relative to macro hence mvr_max_rev.

VWAP distance gate
Daily anchored VWAP is rebuilt from the open of each session. The script computes the absolute distance from VWAP in units of your average range and requires that distance to exceed vwap_dist_thr when use_vwap_gate is true. This keeps entries away from the mean.

Edge Score
Each gate contributes a weight that you control. The script sums weights of the satisfied gates and divides by the sum of all weights to produce an Edge percent for long and an Edge percent for short. You can then require a minimum Edge percent using edge_min_pct. This turns the indicator into a step by step checklist that you can tune to your taste.

Using the indicator step by step

Choose markets and timeframes
The logic is designed for liquid instruments. Major currency pairs, index futures and cash index CFDs, and the most liquid crypto pairs work well. On intraday use one to fifteen minutes for signals and fifteen to sixty minutes for confirmation. On swing use one hour to one day for signals and one day for confirmation.

Decide on entry mode
Breakouts require a compression area and a sweep timer. Reversals require a strict sweep and a strong pulse. If you are unsure leave the default which allows both.

Pick a range basis
For FX and crypto HL SMA is often stable. For indices and single name equities with gaps ATR can adapt better. If results look too reactive increase the window. If results are too slow reduce it.

Tune regime filters
If you trade trend continuation raise er_min and mvr_min. If you trade counter rotation lower them and rely on the reversal path with the strict sweep condition.

Set the VWAP gate
Enabling it helps you avoid entries at the mean. Push the threshold higher on range bound days. Reduce it in strong trend days.

Table driven decision
Watch Action and the Edge percents. If the script says WAIT you can read Pulse and Compression to see what is missing. Often the best trades appear when both Edge percents are well separated and your session switch is ON.

Use the visuals
When a suggestion triggers you will see entry stop and targets. You can mirror the levels in your own workflow or use alerts.

Consider bar close
Signals are computed in real time. For a strict process you can wait until the bar closes to reduce noise.

Inputs explained with quick guidance

Setup
Signal TF chooses where the logic is computed. Leave blank to use the chart.
Confirm TF sets the higher timeframe for bias.
Session filter restricts signals to the London and New York windows you specify.
Invert flips long and short. It is useful on inverse instruments.

Logic options
Entry mode allows Breakouts Reversals or Both.
Average range basis selects HL SMA or ATR.
ATR length is used when ATR is selected.
Pulse source can be Regular OHLC or Heikin Ashi. Heikin Ashi smooths noisy series, but the script still runs on regular bars and you should publish and use it on standard candles to respect the platform guidance.

Core numeric settings
Sweep lookback controls the size of the liquidity pool targeted by the sweep condition.
Pulse window smooths the wick polarity measure.
Average range window controls your base range when you use HL SMA.
Pulse threshold sets the minimum polarity required.
Compression threshold sets the maximum current range relative to average to consider the market coiled.
Expansion timer bars sets how much time has passed since the last sweep before you allow a breakout.

Regime filters
Efficiency ratio length and minimum value keep you out of aimless drift.
Micro and Macro range lengths feed the micro to macro ratio.
Minimum micro to macro for breakouts and maximum micro to macro for reversals steer the two entry families.
VWAP gate and distance threshold keep you away from the mean.

Levels and trade management visuals
Runner target in R sets TP2 as a multiple of initial risk.
Stop distance as average range multiple sets initial risk size for the visuals.
Move stop to entry after one R touch turns on break even logic once price has traveled one risk unit.
Trail buffer as R fraction uses the last sweep as an anchor and keeps a dynamic stop at a chosen fraction of R beyond it.
Cooldown after exit prevents immediate re entries.

Edge Score
Weights for pulse compression timer bias efficiency ratio micro to macro VWAP gate and session let you align the checklist with your style.
Minimum Edge percent to suggest applies a final filter to LONG or SHORT suggestions.

UI
Table and markers switch the compact dashboard and the shapes.
TP and SL lines and labels draw and name each level.
TP1 partial label percent is printed in the TP1 label for clarity.
Session shading helps with focus.
Daily VWAP line is optional.

Alerts

The script provides alerts for Long Short Exit and for Edge percent crossing the threshold on either side. Use them to drive notifications or to sync with webhooks and your broker integration. Alerts trigger in real time and will repaint during a bar. For conservative use trigger on bar close.

Recommended presets

Intraday trend continuation
Confirm TF fifteen minutes
Entry mode Breakouts
Range basis HL SMA
Pulse threshold near 0.10
Compression threshold near 0.60
Timer around 18
Minimum efficiency ratio near 0.20
Minimum micro to macro near 1.00
VWAP gate enabled with distance near 0.35
Edge minimum 50 or higher

Intraday mean reversion at sweeps
Entry mode Reversals
Pulse source Regular OHLC
Compression threshold can be a little higher
Maximum micro to macro near 1.60
Efficiency ratio minimum lower near 0.12
VWAP gate enabled
Edge minimum 40 to 60

Swing trend continuation
Signal TF one hour
Confirm TF one day
Range basis ATR
ATR length around 14
Average range window 20 to 30
Efficiency ratio minimum near 0.18
Micro to macro windows 12 and 60
Edge minimum 50 to 70

These are starting points only. Your instrument and timeframe will require small adjustments.


Limitations and honest warnings

No indicator is perfect. TwinPulse will mark attractive conditions that do not always lead to profitable trades. During economic releases or very thin liquidity the assumptions behind compression and sweeps may fail. In strong gap environments the HL SMA basis may lag while ATR may overreact. Heikin Ashi pulse can help in choppy markets but it will lag during sharp reversals. Session times use the exchange time of your chart. If you switch symbol or exchange verify the windows.

Edge percent is not a probability of profit. It is the fraction of satisfied gates with your chosen weights. Two traders can set different weights and see different Edge readings on the same bar. That is the design. The score is a guide that helps you act with discipline.

This indicator does not place orders or manage real risk. The lines and labels show a model entry a model stop and two model targets built from the average range at entry and from recent swing points. Use them as references and not as hard rules. Always test on historical data and demo first. Past results do not guarantee anything in the future.

Credits and originality

All code in this publication is original and written for this indicator. The concept of the efficiency ratio originates from Perry Kaufman. The use of a daily anchored volume weighted average price is a standard industry tool. The specific combination of pulse from wick polarity strict sweep timing compression and the tunable Edge Score is unique to this script at the time of publication. If you reuse parts of the open source code in your own work remember to credit the author and contribute meaningful improvements.

How to read the table at a glance

Action reflects your current state.
IN LONG or IN SHORT appears while a trade is active.
LONG or SHORT appears when conditions for entry are met and the Edge threshold is satisfied.
WAIT appears when at least one gate is missing.

Session shows ON during your chosen windows.
Bias shows the color of the confirmation candle.
Pulse is the smoothed polarity number.
Comp shows current range divided by the average range. Values below one mean compression.
Edge L percent and Edge S percent show the long and short checklists as percents.

Final thoughts

Markets move because orders accumulate at certain prices and at certain times. The indicator tries to measure two things that often matter at those turning points. One is the existence of a hidden imbalance revealed by wick polarity and by sweeps of prior extremes. The other is the presence of energy stored in a coil that can release in the direction of a drift. Neither force guarantees profit. Together they can improve your selection and your timing.

Use the defaults for a few days so you learn the personality of the signals. After that adjust one group at a time. Start with the session filter and the Edge threshold. Then tune compression and the timer. Finally adjust the regime filters. Keep notes. You will learn which weights matter for your market and timeframe. The result is a process you can apply with consistency.

Disclaimer
This script and description are for education and analysis. They are not investment advice and they do not promise future results. Use at your own risk. Test thoroughly on historical data and in simulation before considering any live use.

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.