OPEN-SOURCE SCRIPT
Orderflow Label with Offset

This Pine Script automatically displays orderflow labels on the chart to visualize the current market structure and potential breakout or reversal zones.
It compares the current candle’s high and low with those of the previous cycle (e.g., 90 minutes) and places descriptive labels that highlight possible bullish or bearish behavior.
Functionality & Logic (Step-by-step explanation)
Inputs:
cycleLength: Defines the duration of one “cycle” in minutes (for example, 90 minutes).
labelXOffset: Moves the label a few bars to the right, so it doesn’t overlap the current candle.
labelStyleOffset: Controls whether labels appear pointing to the right or left side of the chart.
Previous Cycle:
The script uses request.security to retrieve the high and low from the previous cycle timeframe.
These act as reference points (similar to key levels or market structure highs/lows).
Current Candle:
The script reads the current bar’s high, low, and close values for comparison.
Orderflow Conditions:
bullSupport: The current high and close are both above the previous high → bullish breakout (strong continuation).
bullReject: The high breaks above the previous high but closes below → bullish rejection / possible top.
bearRes: The low and close are both below the previous low → bearish breakdown (continuation to downside).
bearReclaim: The low goes below the previous low but closes above → bearish reclaim / possible reversal.
Label Logic:
Before creating a new label, the previous one is deleted (label.delete(flowLbl)) to avoid clutter.
The label’s X position is shifted using xPos = bar_index + labelXOffset.
The style (left/right) is set based on the user’s preference.
Displayed Labels:
🟢 Bullish Breakout → price closes above the previous cycle high.
🟠 Bullish Rejection → fake breakout or possible top.
🔴 Bearish Breakdown → price closes below the previous cycle low.
🟡 Bearish Reclaim → failed breakdown or potential trend reversal.
⚪ Neutral (Wait) → no clear signal, advises patience and watching for setups (like CHoCH or FVGs).
Visual Behavior:
The labels appear slightly to the right of the bar for better visibility.
The color and text alignment dynamically adjust depending on whether the label is pointing left or right.
It compares the current candle’s high and low with those of the previous cycle (e.g., 90 minutes) and places descriptive labels that highlight possible bullish or bearish behavior.
Functionality & Logic (Step-by-step explanation)
Inputs:
cycleLength: Defines the duration of one “cycle” in minutes (for example, 90 minutes).
labelXOffset: Moves the label a few bars to the right, so it doesn’t overlap the current candle.
labelStyleOffset: Controls whether labels appear pointing to the right or left side of the chart.
Previous Cycle:
The script uses request.security to retrieve the high and low from the previous cycle timeframe.
These act as reference points (similar to key levels or market structure highs/lows).
Current Candle:
The script reads the current bar’s high, low, and close values for comparison.
Orderflow Conditions:
bullSupport: The current high and close are both above the previous high → bullish breakout (strong continuation).
bullReject: The high breaks above the previous high but closes below → bullish rejection / possible top.
bearRes: The low and close are both below the previous low → bearish breakdown (continuation to downside).
bearReclaim: The low goes below the previous low but closes above → bearish reclaim / possible reversal.
Label Logic:
Before creating a new label, the previous one is deleted (label.delete(flowLbl)) to avoid clutter.
The label’s X position is shifted using xPos = bar_index + labelXOffset.
The style (left/right) is set based on the user’s preference.
Displayed Labels:
🟢 Bullish Breakout → price closes above the previous cycle high.
🟠 Bullish Rejection → fake breakout or possible top.
🔴 Bearish Breakdown → price closes below the previous cycle low.
🟡 Bearish Reclaim → failed breakdown or potential trend reversal.
⚪ Neutral (Wait) → no clear signal, advises patience and watching for setups (like CHoCH or FVGs).
Visual Behavior:
The labels appear slightly to the right of the bar for better visibility.
The color and text alignment dynamically adjust depending on whether the label is pointing left or right.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.