OPEN-SOURCE SCRIPT

Weekly Pivot Strategy (LONG ONLY STRATEGY)

Strategy Overview: Weekly Pivot Trading System
Core Concept:
A mean-reversion strategy that trades between weekly pivot levels. It uses calculated support (S1-S4) and resistance (R1-R4) levels derived from the previous week's price action to identify entry and exit points.

Just know, every market is different. You may need to play with the settings to suit you're market

---------------------------------------------------------------------------------------------------------------------

1. Key Features

Weekly Pivot Calculation

Pivot Point = (Previous Week’s High + Low + Close) / 3

Support/Resistance Levels: User-adjustable distances from the pivot (Measured in points).

2. Entry Rules

Buys when price touches S1-S4 (lower = more aggressive).

Each support level triggers a separate entry ("Entry1" at S1, "Entry2" at S2, etc.).

3. Exit Rules

Profit targets set at corresponding R1-R4 levels (R1 for S1 entry, etc.).

No stop-loss (positions remain open until targets are hit).

4. Position Management

Up to 4 concurrent trades per week.

Trades reset weekly with new pivot levels.

No time-based exits.

5.Customization

Adjustable distances for S/R levels.

Position sizing as percentage of equity.

---------------------------------------------------------------------------------------------------------------------

Anticipated FAQs & Answers

Q1: How does this strategy work?

A: It exploits price reversals at weekly support/resistance zones. When price dips to a support level (S1-S4), the strategy buys, expecting a bounce to the corresponding resistance (R1-R4).

Q2: Why use weekly pivots instead of daily?

A: Weekly levels act as stronger psychological zones, reducing noise from short-term fluctuations. This aligns with swing trading/institutional order flow.

Q3: Where are the stop-losses?

A: The original strategy has no stop-loss to allow positions to ride to targets. However, users can add their own stop rules (e.g., below S4 or ATR-based stops).

Q4: How do I adjust risk?

A: Two key controls:

1. default_qty_value: Reduce from 25% to lower position size.

2. S/R distances: Widen offsets for larger buffers.

Q5: Why do trades sometimes not close?

A: Positions remain open indefinitely until price reaches the profit target. This works best in ranging markets but may tie up capital in trends.

Q6: How is this different from standard pivot strategies?

A: Three unique aspects:

1.Weekly reset: Fresh levels every Monday.

2. Multiple entries: Up to 4 trades/week.

3. No repainting: Levels fixed at week start.

Q7: What markets/timeframes does this work on?
A: Best results in:


Markets: Forex, indices, crypto (high liquidity).

Timeframes: 1H or higher (avoids intraweek noise).

Q8: Can I combine this with other indicators?
A: Popular additions:


Trend filter: Only trade S1-S4 in uptrends (e.g., 50 SMA).

Volume confirmation: Require rising volume at support.

RSI divergence: Avoid entries during overextension.

Q9: Why does it enter on touch (not close)?
A: By design, it mimics "limit order" behavior. To require a close below/above, modify the entry condition:

// Replace:
if low <= level
// With:
if close < level // More conservative


Q10: How to avoid whipsaws during volatility?
A: Two solutions:

1.Add a buffer (e.g., require price to close 1% below S1).

2.Use multiple timeframes: Confirm with daily pivot alignment.

Pro Tips for Users
1. Backtest Across Market Phases: Test in both trending and ranging conditions.

2. Adjust Offsets Volatility: Widen S/R distances for high-volatility assets.

Pair with Correlation: Avoid overlapping trades in correlated markets.

This framework balances simplicity with customization potential.

---------------------------------------------------------------------------------------------------------------------

Thank you for taking the time to review this strategy. This is my first finished product. I hope people enjoy testing it.


P.S. Please feel free to change or add whatever you like. If you feel up to the task. Im 100% confident that there are better coders than me that can improve this. :D

คำจำกัดสิทธิ์ความรับผิดชอบ