INVITE-ONLY SCRIPT

system signals 15

116
System Signals 15

## Overview
This is a comprehensive Pine Script v5 trading strategy that combines multiple technical indicators and market conditions to generate buy/sell signals. The strategy offers 7 different modes, each with unique entry criteria, plus advanced risk management features.

## Strategy Modes Explained

### Mode 1: Only Divergence
- **Entry Condition**: Pure RSI divergence signals
- **Buy Signal**: Bullish divergence (regular or hidden) detected
- **Sell Signal**: Bearish divergence (regular or hidden) detected
- **Use Case**: For traders who rely solely on momentum divergence

### Mode 2: Divergence + SuperTrend
- **Entry Condition**: RSI divergence + SuperTrend confirmation
- **Buy Signal**: Bullish divergence detected AND SuperTrend changes to bullish (trend2 == 1)
- **Sell Signal**: Bearish divergence detected AND SuperTrend changes to bearish (trend2 == -1)
- **Logic**: Waits for trend confirmation after divergence is spotted

### Mode 3: Divergence + SuperTrend + Volume
- **Entry Condition**: All Mode 2 conditions + volume filter
- **Buy Signal**: Mode 2 conditions + volume above SMA threshold
- **Sell Signal**: Mode 2 conditions + volume above SMA threshold
- **Benefit**: Adds volume confirmation to reduce false signals

### Mode 4: Divergence + Volume
- **Entry Condition**: RSI divergence + volume confirmation (no trend requirement)
- **Buy Signal**: Bullish divergence + volume above threshold
- **Sell Signal**: Bearish divergence + volume above threshold
- **Strategy**: Volume-confirmed divergence without waiting for trend change

### Mode 5: SuperTrend + Volume
- **Entry Condition**: SuperTrend change + volume confirmation (no divergence needed)
- **Buy Signal**: SuperTrend turns bullish + volume above threshold
- **Sell Signal**: SuperTrend turns bearish + volume above threshold
- **Approach**: Pure trend following with volume confirmation

### Mode 6: SuperTrend Only
- **Entry Condition**: SuperTrend direction change only
- **Buy Signal**: SuperTrend changes to bullish
- **Sell Signal**: SuperTrend changes to bearish
- **Use**: Simple trend following system

### Mode 7: Session Liquidity Sweep (Special Mode)
- **Entry Condition**: 3-candle pattern after session high/low liquidity sweep
- **Complex Logic**:
- Detects when price sweeps session highs/lows
- Waits for 3-candle pattern completion
- Enters on return to middle candle level
- **Advanced**: Uses session-based liquidity concepts

## Key Filters and Conditions

### 1. Session Time Filter
```pinescript
startHour/startMinute to endHour/endMinute
```
- Allows trading only during specified hours
- Configurable start and end times
- Can be enabled/disabled

### 2. Volume Filter
```pinescript
volumeThreshold = volumeSMA * volumeMultiplier
```
- **Volume SMA Length**: 15 periods (default)
- **Volume Multiplier**: 40% above SMA (default)
- Ensures trades only occur during higher volume periods

### 3. RSI Divergence Detection
```pinescript
RSI Period: 22 (default)
Lookback Left: 10, Lookback Right: 10
```
- **Regular Bullish**: Price makes lower low, RSI makes higher low
- **Regular Bearish**: Price makes higher high, RSI makes lower high
- **Hidden Bullish**: Price makes higher low, RSI makes lower low
- **Hidden Bearish**: Price makes lower high, RSI makes higher high

### 4. SuperTrend Indicator
```pinescript
ATR Period: 10
ATR Multiplier: 3.0
```
- Dynamic support/resistance levels
- Trend direction indicator
- Used for trend change detection

### 5. Trend Bands Filter
```pinescript
Length: 4
```
- Custom trend strength indicator
- Shows bullish/bearish strength levels
- Optional trend condition filter

### 6. Session High/Low Distance Filter
- **Points Mode**: Maximum distance in points from session levels
- **Percentage Mode**: Maximum percentage distance from session levels
- Prevents entries too far from key levels

## Risk Management System

### 1. Time-Based Take Profit/Stop Loss
The strategy uses different TP/SL percentages based on trading sessions:

#### Period 1 (8:00-12:00 GMT)
- **Take Profit**: 0.10% (default)
- **Stop Loss**: 0.12% (default)

#### Period 2 (13:00-17:00 GMT)
- **Take Profit**: 0.15% (default)
- **Stop Loss**: 0.18% (default)

#### Period 3 (18:00-22:00 GMT)
- **Take Profit**: 0.08% (default)
- **Stop Loss**: 0.10% (default)

#### Default (Outside Sessions)
- **Take Profit**: 0.12% (default)
- **Stop Loss**: 0.14% (default)

### 2. Three Stop Loss Types

#### A. Fixed Stop Loss
```pinescript
fix_stop = 4% (default)
```
- Static percentage-based stop loss
- Calculated from entry price
- Simple and predictable

#### B. Trailing Stop Loss
```pinescript
trailing_stop = 0.8% (default)
```
- **Long Positions**: Stop loss trails price upward
- **Short Positions**: Stop loss trails price downward
- Locks in profits as trade moves favorably
- **Logic**:
```pinescript
longstoppriceTrailing = max(current_trailing_level, previous_trailing_level)
```

#### C. Candle-Based Stop Loss
- Uses recent high/low levels
- **Long**: Stop below recent low + offset
- **Short**: Stop above recent high + offset
- **Offset**: 2.0 pips (default)
- **Risk-Reward Ratio**: 1.5:1 (default)

### 3. Daily Trade Limits (Mode 6 Only)
```pinescript
maxDailyTrades = 5 (default)
```
- Prevents overtrading
- Resets at start of new trading day
- Helps maintain discipline

### 4. Position Sizing
```pinescript
contracts = 1 (default)
```
- Configurable contract/share quantity
- Applied to all entries

## Session Management

### Asia Session (00:00-09:00 GMT)
- Tracks session high/low levels
- Background color: Yellow (when Mode 6 active)

### London Session (08:00-17:00 GMT)
- Overlap with Asia creates opportunities
- Background color: Orange (when Mode 6 active)

### New York Session (13:00-22:00 GMT)
- Highest volume period
- Background color: Blue (when Mode 6 active)

### Session Liquidity Logic (Mode 7)
1. **Level Detection**: Identifies when one session takes out another session's high/low
2. **Pattern Formation**: Waits for 3-candle pattern after level taken
3. **Entry Trigger**: Price returns to specified percentage of middle candle
4. **Direction Logic**:
- If high taken → expect short opportunity
- If low taken → expect long opportunity

## Visual Elements

### 1. Trend Lines and Levels
- SuperTrend lines (green for bullish, red for bearish)
- Session high/low levels
- Swing high/low levels

### 2. Entry/Exit Visualization
- Entry price line (blue)
- Take profit lines (green)
- Stop loss lines (red)
- Filled areas showing risk/reward zones

### 3. Signal Indicators
- Buy signals: Green triangle up
- Sell signals: Red triangle down
- RSI divergence markers
- Trend change alerts

## Performance Monitoring

### Real-Time Statistics Table
- **Percent Profitable**: Win rate percentage
- **Total Trades**: Number of completed trades
- **Winning/Losing Trades**: Breakdown of results
- **Net Profit**: Overall profit/loss
- **Open Trades**: Current active positions

### Alert System
- Real-time buy/sell alerts
- Trend change notifications
- Divergence detection alerts
- Liquidity sweep alerts

## Strategy Recommendations

### For Beginners
- Start with **Mode 6** (SuperTrend only)
- Use **Fixed Stop Loss** initially
- Enable **Session Time Filter** for specific hours

### For Intermediate Traders
- Try **Mode 2 or 3** (Divergence + SuperTrend)
- Experiment with **Trailing Stop Loss**
- Use **Volume Filter** for confirmation

### For Advanced Traders
- Explore **Mode 7** (Session Liquidity Sweep)
- Combine multiple filters
- Fine-tune time-based TP/SL levels
- Utilize **Daily Trade Limits**

## Risk Warnings

1. **Backtesting Required**: Test thoroughly before live trading
2. **Market Conditions**: Performance varies across different market environments
3. **Parameter Sensitivity**: Small changes in settings can significantly impact results
4. **Slippage Consideration**: Real trading may differ from backtest results
5. **Risk Management**: Never risk more than you can afford to lose

## Conclusion

This strategy offers tremendous flexibility through its multiple modes and comprehensive filtering system. The sophisticated risk management features, including trailing stops and time-based TP/SL levels, make it suitable for various trading styles and market conditions. However, proper testing and gradual implementation are essential for success.

Advanced Order Management: Limit Orders & Offset
Limit Order System

How Limit Orders Work in This Strategy:
For Long Entries:
pinescriptif (orderType == "Market")
strategy.entry("Long", strategy.long)
else
limitPrice = close * (1 - limitOffset / 100)
strategy.entry("Long", strategy.long, limit=limitPrice)

Market Order: Enters immediately at current market price
Limit Order: Waits for price to drop by the offset percentage before entering
Example: If current price is $100 and offset is 0.1%, limit order placed at $99.90

For Short Entries:
pinescriptif (orderType == "Market")
strategy.entry("Short", strategy.short)
else
limitPrice = close * (1 + limitOffset / 100)
strategy.entry("Short", strategy.short, limit=limitPrice)

Limit Order: Waits for price to rise by the offset percentage before entering
Example: If current price is $100 and offset is 0.1%, limit order placed at $100.10

Benefits of Limit Orders with Offset
1. Better Entry Prices

Avoids chasing momentum
Gets filled at more favorable prices
Reduces slippage in volatile markets

2. Risk Reduction

Prevents entering at temporary price spikes
Allows for slight retracements before entry
Better risk-reward ratios

3. Market Efficiency

Takes advantage of brief pullbacks
Reduces impact of bid-ask spreads
More precise execution

Offset Strategy Examples
Conservative Approach (0.05-0.1% offset)

Minimal price improvement
Higher fill probability
Good for trending markets

Moderate Approach (0.1-0.2% offset)

Balance between price improvement and fill rate
Suitable for most market conditions
Recommended for beginners

Aggressive Approach (0.2-0.5% offset)

Maximum price improvement
Lower fill probability
Best for ranging/choppy markets

Stop Loss Offset System
pinescriptSL_offset_pips = input.float(2.0, title='StopLoss Offset (Pips)', minval=0.0, step=1.0)
SL_offset = SL_offset_pips * pip_value
Candle-Based Stop Loss with Offset:
pinescriptCandlelongStopPrice = strategy.position_avg_price * (1 - CandleSLpercentageL) + SL_offset
CandleshortStopPrice = strategy.position_avg_price * (1 + CandleSLpercentageS) + SL_offset
Why Offset is Important:

Prevents False Stops: Small market noise won't trigger stops
Accounts for Spreads: Ensures stops are beyond bid-ask spread
Reduces Whipsaws: Gives trades breathing room
Professional Approach: Mimics institutional trading practices

Practical Implementation Tips
For Day Trading:

Use smaller offsets (0.05-0.1%)
Market orders for momentum trades
Limit orders for counter-trend entries

For Swing Trading:

Larger offsets acceptable (0.2-0.5%)
Limit orders preferred for better entries
Wider stop loss offsets (3-5 pips)

For Scalping:

Minimal offsets (0.02-0.05%)
Quick market orders often preferred
Tight stop loss offsets (1-2 pips)

Order Management Best Practices
1. Market Conditions Consideration

Trending Markets: Smaller offsets, more market orders
Ranging Markets: Larger offsets, more limit orders
High Volatility: Increase all offsets
Low Volatility: Decrease offsets

2. Time of Day Adjustments

Market Open: Wider offsets due to volatility
Mid-Session: Standard offsets
Market Close: Wider offsets for gap protection

3. Asset-Specific Settings

Forex: Smaller pip-based offsets
Stocks: Percentage-based offsets
Crypto: Larger offsets due to volatility
Commodities: Medium offsets

4. Risk Management Integration
pinescript// Dynamic offset based on ATR
dynamicOffset = ta.atr(14) * 0.5 / close * 100
Consider using volatility-based offsets for optimal performance.

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.