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.
오픈 소스 스크립트
진정한 트레이딩뷰 정신에 따라 이 스크립트 작성자는 트레이더가 기능을 검토하고 검증할 수 있도록 오픈소스로 공개했습니다. 작성자에게 찬사를 보냅니다! 무료로 사용할 수 있지만 코드를 다시 게시할 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.
오픈 소스 스크립트
진정한 트레이딩뷰 정신에 따라 이 스크립트 작성자는 트레이더가 기능을 검토하고 검증할 수 있도록 오픈소스로 공개했습니다. 작성자에게 찬사를 보냅니다! 무료로 사용할 수 있지만 코드를 다시 게시할 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.