PROTECTED SOURCE SCRIPT
更新済 My Backtest Module

### 📊 Universal Backtest Module - Pro Structure
**A Fully Customizable Strategy Framework for Advanced Backtesting & Signal Analysis**
This powerful Pine Script strategy is designed as a **universal testing module** for traders and developers who want to evaluate custom trading logic across multiple conditions, timeframes, and risk parameters — all within a single, flexible structure.
> ⚠️ **Note:** This script is intended for **educational and backtesting purposes only**. It does **not** provide financial advice, nor does it guarantee profits. Always test strategies thoroughly before applying them to live markets.
---
### 🔧 Key Features
✅ **Multi-Source Entry Signals**
Combine up to two independent buy/sell signals using flexible logic:
- **OR Logic**: Trigger on any signal (edge-based).
- **AND Logic (Latched)**: Requires both signals at any point (flip-flop style).
- **AND No Latch**: Both signals must be active simultaneously.
✅ **Dynamic Trade Direction Control**
Choose between:
- Long & Short (Both)
- Long Only
- Short Only
With optional **close-on-opposite-signal** and **wait-for-opposite-reentry** logic.
✅ **Precision Timing Filters**
- Date range filtering (start/end dates)
- Intraday session control (supports up to 3 custom sessions)
- Visual session shading for clarity
✅ **Advanced Risk Management**
- Multiple Stop Loss types:
- Fixed Points / Percent
- ATR-based (adjustable multiplier)
- Swing-based (automatically detects pivots)
- External SL source
- Dynamic position sizing:
- Fixed lot
- % of equity risk (with max fallback)
✅ **Smart Take Profit Options**
- Fixed Points, Percent, RR Ratio, ATR, Fibonacci extensions
- Support for **external TP levels** (user-defined sources)
- Optional **multiple partial exits** with customizable size distribution
- Fibonacci TP levels (1.0, 1.618, 2.618, 4.236) based on SL distance
✅ **Flexible Exit Tools**
- Breakeven stop activation after TP1 hit
- Internal swing-based trailing stop
- External trailing stop (custom source)
- Max holding time (auto-close after X candles)
- Custom close conditions via user-defined logic
- Close & reverse functionality
✅ **Visual Clarity & Feedback**
- Clear visual markers for Buy/Sell signals
- Real-time SL, Entry, and TP lines with color-coded risk/reward zones
- On-chart TP level labels showing prices and allocation percentages
- Session background highlighting
- Trade statistics summary label
---
### 🛠️ Ideal For:
- Testing new indicator combinations
- Validating entry/exit logic under various market filters
- Comparing signal fusion methods (OR vs AND)
- Simulating professional-grade risk management rules
- Educational demonstrations in algorithmic trading
---
### ⚠️ Important Notes
- This is a **backtesting tool**, not a live trading bot.
- Past performance is **not indicative of future results**.
- Strategy performance depends entirely on the quality of input signals.
- Always validate results across multiple assets and timeframes.
- Use in conjunction with sound money management principles.
---
### 📌 How to Use
1. Attach the script to your chart.
2. Configure **Buy/Sell Signal Sources** (e.g., RSI crossovers, moving averages, etc.)
3. Set your preferred **trade direction, session, and date filters**
4. Define **stop loss and take profit rules**
5. Adjust position sizing and exit behavior
6. Run the backtest and analyze results in the **Strategy Tester tab**
💡 *Tip: Combine with other indicators by referencing their output values as signal sources.*
---
### ❌ Disclaimer
This script is shared for **informational and educational purposes only**. By using it, you agree that:
- The author is **not responsible** for any financial losses.
- Trading involves significant risk; only risk capital should be used.
- You are solely responsible for your trading decisions.
🚫 **This script does not promote get-rich-quick schemes, guaranteed profits, or unverified performance claims.**
---
🔁 **Version:** 5 (Pine Script v5)
📦 **Category:** Strategy
📈 **Overlay:** Yes
🧪 **Purpose:** Backtesting, Signal Validation, Risk Modeling
---
✅ **Safe for Public Sharing**
✔ Complies with TradingView’s community standards
✔ No misleading performance claims
✔ No automated trading promises
✔ No copyrighted or plagiarized content
---
> 💬 *"Knowledge is power — test wisely, trade responsibly."*
---
Let me know if you'd like a **short version** for the script's header comment or a **public post summary** for the TradingView feed!
**A Fully Customizable Strategy Framework for Advanced Backtesting & Signal Analysis**
This powerful Pine Script strategy is designed as a **universal testing module** for traders and developers who want to evaluate custom trading logic across multiple conditions, timeframes, and risk parameters — all within a single, flexible structure.
> ⚠️ **Note:** This script is intended for **educational and backtesting purposes only**. It does **not** provide financial advice, nor does it guarantee profits. Always test strategies thoroughly before applying them to live markets.
---
### 🔧 Key Features
✅ **Multi-Source Entry Signals**
Combine up to two independent buy/sell signals using flexible logic:
- **OR Logic**: Trigger on any signal (edge-based).
- **AND Logic (Latched)**: Requires both signals at any point (flip-flop style).
- **AND No Latch**: Both signals must be active simultaneously.
✅ **Dynamic Trade Direction Control**
Choose between:
- Long & Short (Both)
- Long Only
- Short Only
With optional **close-on-opposite-signal** and **wait-for-opposite-reentry** logic.
✅ **Precision Timing Filters**
- Date range filtering (start/end dates)
- Intraday session control (supports up to 3 custom sessions)
- Visual session shading for clarity
✅ **Advanced Risk Management**
- Multiple Stop Loss types:
- Fixed Points / Percent
- ATR-based (adjustable multiplier)
- Swing-based (automatically detects pivots)
- External SL source
- Dynamic position sizing:
- Fixed lot
- % of equity risk (with max fallback)
✅ **Smart Take Profit Options**
- Fixed Points, Percent, RR Ratio, ATR, Fibonacci extensions
- Support for **external TP levels** (user-defined sources)
- Optional **multiple partial exits** with customizable size distribution
- Fibonacci TP levels (1.0, 1.618, 2.618, 4.236) based on SL distance
✅ **Flexible Exit Tools**
- Breakeven stop activation after TP1 hit
- Internal swing-based trailing stop
- External trailing stop (custom source)
- Max holding time (auto-close after X candles)
- Custom close conditions via user-defined logic
- Close & reverse functionality
✅ **Visual Clarity & Feedback**
- Clear visual markers for Buy/Sell signals
- Real-time SL, Entry, and TP lines with color-coded risk/reward zones
- On-chart TP level labels showing prices and allocation percentages
- Session background highlighting
- Trade statistics summary label
---
### 🛠️ Ideal For:
- Testing new indicator combinations
- Validating entry/exit logic under various market filters
- Comparing signal fusion methods (OR vs AND)
- Simulating professional-grade risk management rules
- Educational demonstrations in algorithmic trading
---
### ⚠️ Important Notes
- This is a **backtesting tool**, not a live trading bot.
- Past performance is **not indicative of future results**.
- Strategy performance depends entirely on the quality of input signals.
- Always validate results across multiple assets and timeframes.
- Use in conjunction with sound money management principles.
---
### 📌 How to Use
1. Attach the script to your chart.
2. Configure **Buy/Sell Signal Sources** (e.g., RSI crossovers, moving averages, etc.)
3. Set your preferred **trade direction, session, and date filters**
4. Define **stop loss and take profit rules**
5. Adjust position sizing and exit behavior
6. Run the backtest and analyze results in the **Strategy Tester tab**
💡 *Tip: Combine with other indicators by referencing their output values as signal sources.*
---
### ❌ Disclaimer
This script is shared for **informational and educational purposes only**. By using it, you agree that:
- The author is **not responsible** for any financial losses.
- Trading involves significant risk; only risk capital should be used.
- You are solely responsible for your trading decisions.
🚫 **This script does not promote get-rich-quick schemes, guaranteed profits, or unverified performance claims.**
---
🔁 **Version:** 5 (Pine Script v5)
📦 **Category:** Strategy
📈 **Overlay:** Yes
🧪 **Purpose:** Backtesting, Signal Validation, Risk Modeling
---
✅ **Safe for Public Sharing**
✔ Complies with TradingView’s community standards
✔ No misleading performance claims
✔ No automated trading promises
✔ No copyrighted or plagiarized content
---
> 💬 *"Knowledge is power — test wisely, trade responsibly."*
---
Let me know if you'd like a **short version** for the script's header comment or a **public post summary** for the TradingView feed!
リリースノート
Update 05-Sep-2025:1. Add Signal3
2. Fix some bugs
保護スクリプト
このスクリプトのソースコードは非公開で投稿されています。 無料かつ制限なしでご利用いただけます ― 詳細についてはこちらをご覧ください。
免責事項
これらの情報および投稿は、TradingViewが提供または保証する金融、投資、取引、またはその他の種類のアドバイスや推奨を意図したものではなく、またそのようなものでもありません。詳しくは利用規約をご覧ください。
保護スクリプト
このスクリプトのソースコードは非公開で投稿されています。 無料かつ制限なしでご利用いただけます ― 詳細についてはこちらをご覧ください。
免責事項
これらの情報および投稿は、TradingViewが提供または保証する金融、投資、取引、またはその他の種類のアドバイスや推奨を意図したものではなく、またそのようなものでもありません。詳しくは利用規約をご覧ください。