OPEN-SOURCE SCRIPT

Swing High/Low Pivots Strategy [LV]

The Swing High/Low Pivots Strategy was developed as a counter-momentum trading tool.
The strategy is suitable for any market and the default values used in the input settings menu are set for Bitcoin (best on 15min). These values, expressed in minimum ticks (or pips if symbol is Forex) make this tool perfectly adaptable to every symbol and/or timeframe.
Check tooltips in the settings menu for more details about every user input.

  • STRTEGY ENTRY & EXIT MECHANISMS:
    Trades Entry based on the detection of swing highs and lows for short and long entries respectively, validated by:
    - Limit orders placed after each new pivot level confirmation
    - Moving averages trend filter (if enabled)
    - No active trade currently open
    Trades Exit when the price reaches take-profit or stop-loss level as defined in the settings menu. A double entry/second take-profit level can be enabled for partial exits, with dynamic stop-loss adjustment for the remaining position.


  • Enhanced Trade Precision:
    By limiting entries to confirmed swing high (HH, LH) or swing low (HL, LL) pivot points, the strategy ensures that trades occur at levels of significant price reversals. This precision reduces the likelihood of entering trades in the midst of a trend or during uncertain price action.

  • Risk Management Optimization:
    The strategy incorporates clearly defined stop-loss (SL) and take-profit (TP) levels derived from the pivot points. This structured approach minimizes potential losses while locking in profits, which is critical for consistent performance in volatile markets.

  • Trend Filtering for Better Entry:
    The use of a configurable moving average filter adds a layer of trend validation. This prevents entering trades against the dominant market trend, increasing the probability of success for each trade.

  • Avoidance of Noise:
    The lookback period (length parameter) confirms pivots only after a set number of bars, effectively filtering out market noise and ensuring that entries are based on reliable, well-defined price movements.

  • Adaptability Across Markets:
    The strategy is versatile and can be applied across different markets (Forex, stocks, crypto) due to its dynamic use of ticks and pips converters. It adapts seamlessly to varying price scales and asset types.

  • Dual Quantity Entries:
    The original and optionnal double-entry mechanism allows traders to capture both short-term and extended profits by scaling out of positions. This adaptive approach caters to varying risk appetites and market conditions.

  • Clear Visualization:
    The plotted pivot points, entry limits, SL, and TP levels provide visual clarity, making it easy for traders to track the strategy's behavior and make informed decisions.

  • Automated Execution with Alerts:
    Integrated alerts for both entries and exits ensure timely actions without the need for constant market monitoring, enhancing efficiency. Configurable alert messages are suitable for API use.


Any feedback, comments, or suggestions for improvement are always welcome.
Hope you enjoy!
BTCUSDExponential Moving Average (EMA)HHHLLHLLpivotPivot PointsPivot points and levels

סקריפט קוד פתוח

ברוח TradingView אמיתית, מחבר הסקריפט הזה פרסם אותו בקוד פתוח, כך שסוחרים יוכלו להבין ולאמת אותו. כל הכבוד למחבר! אתה יכול להשתמש בו בחינם, אבל השימוש החוזר בקוד זה בפרסום כפוף לכללי הבית. אתה יכול להכניס אותו למועדפים כדי להשתמש בו בגרף.

רוצה להשתמש בסקריפ זה בגרף?


גם על:

כתב ויתור