OPEN-SOURCE SCRIPT
Algoticks.in: Bollinger Bands Strategy (Sample)

Bollinger Bands Strategy - User Guide
Overview
This is a Mean Reversion strategy using Bollinger Bands. It generates trading signals when price moves outside the bands and then crosses back, or simply crosses the bands depending on the logic. It integrates with Algoticks.in API for automated trading on Delta Exchange.
Strategy Logic
Quick Setup
1. Add to TradingView
2. Configure Strategy Parameters
Strategy Settings
General API Settings
Order Settings: Basic
Order Settings: Entry Type
Choose how orders are executed:
Entry Prices (for Limit/Stop orders)
Limit Price:
Example:
Trigger Price: Same logic as Limit Price, used for Stop orders
Exit / Bracket Prices (SL/TP)
Stop Loss (SL):
Take Profit (TP): Same structure as SL
Example:
3. Options Trading Setup (Only if Segment = Options)
Strike Selection Method
User Defined Mode:
Dynamic Mode:
Expiry Date Formats:
4. Create Alert for Automation
The alert will automatically send JSON payloads to your API when signals occur.
Example Configurations
Standard Mean Reversion
[code]
Strategy: Length = 20, StdDev = 2.0
Segment: futures
Order Type: market_order
Quantity: 1
SL: 1% (Relative)
TP: 2% (Relative)
[/code]
Wide Band Reversal
[code]
Strategy: Length = 20, StdDev = 2.5
Segment: futures
Order Type: market_order
Quantity: 1
SL: 1.5% (Relative)
TP: 3% (Relative)
[/code]
Important Notes
Troubleshooting
Overview
This is a Mean Reversion strategy using Bollinger Bands. It generates trading signals when price moves outside the bands and then crosses back, or simply crosses the bands depending on the logic. It integrates with Algoticks.in API for automated trading on Delta Exchange.
Strategy Logic
- Long Signal: When Price crosses below the Lower Band (Oversold / Dip Buy)
- Short Signal: When Price crosses above the Upper Band (Overbought / Top Sell)
- Automatically closes opposite positions before entering new ones
Quick Setup
1. Add to TradingView
- Open TradingView and go to the chart
- Click "Pine Editor" at the bottom
- Paste the script code
- Click "Add to Chart"
2. Configure Strategy Parameters
Strategy Settings
- Length (default: 20): The lookback period for the SMA basis
- StdDev (default: 2.0): The number of standard deviations for the bands
General API Settings
- Paper Trading: Enable for testing without real money
- Signal Type: Choose "Trading Signal" (default) for tracking
- Exchange: DELTA (Delta Exchange)
- Segment:
- futures - Perpetual contracts
- options - Call/Put options
- spot - Spot trading
- futures - Perpetual contracts
Order Settings: Basic
- Quantity: Number of contracts (e.g., 1, 0.5, 2)
- Validity:
GTC - Good Till Cancelled
IOC - Immediate or Cancel
FOK - Fill or Kill
DAY - Day order
- Product: cross_margin or isolated_margin
Order Settings: Entry Type
Choose how orders are executed:
- Market Order: Immediate fill at best price
- Limit Order: Fill at specified price or better
- Stop Market: Triggers at stop price, then market order
- Stop Limit: Triggers at stop price, then limit order
Entry Prices (for Limit/Stop orders)
Limit Price:
- Price: The value to use
- Type: Last Price / Mark Price / Index Price
- Mode:
Absolute - Exact price (e.g., 65000)
Relative - Offset from entry price
- % Checkbox: If checked, relative uses percentage; if unchecked, uses points
Example:
- Absolute: 65000 → Order at exactly 65000
- Relative 1% (checked): Entry ± 1% of entry price
- Relative 100 (unchecked): Entry ± 100 points
Trigger Price: Same logic as Limit Price, used for Stop orders
Exit / Bracket Prices (SL/TP)
Stop Loss (SL):
- Type: Price type to monitor (Mark Price recommended)
- Mode: Absolute or Relative
- %: Percentage or points
- SL: Stop loss value (e.g., 2 for 2%)
- Trig: Optional trigger price (creates Stop-Limit SL)
Take Profit (TP): Same structure as SL
Example:
- Long entry at 65000, SL = 2% → Exit at 63700 (65000 - 2%)
- Short entry at 65000, TP = 3% → Exit at 63050 (65000 - 3%)
3. Options Trading Setup (Only if Segment = Options)
Strike Selection Method
User Defined Mode:
- Manually specify exact strike and option type
- Best for: Trading specific levels
- Required fields:
- Strike Price: e.g., "65000"
- Option Type: Call or Put
- Strike Price: e.g., "65000"
Dynamic Mode:
- System calculates strike based on ATM price
- Best for: Automated strategies
- Required fields:
- Algo Type: Options Buying or Selling
- Strike Offset: 0 (ATM), +1 (above ATM), -1 (below ATM)
- Strike Interval: Gap between strikes (e.g., BTC: 500, ETH: 50)
- Algo Type: Options Buying or Selling
Expiry Date Formats:
- T+0 - Today
- T+1 - Tomorrow
- current week - This Friday
- next week - Next Friday
- current month - Last Friday of month
- 131125 - Specific date (13 Nov 2025)
4. Create Alert for Automation
- Right-click on chart → "Add Alert"
- Condition: Select your strategy name
- Alert Actions: Webhook URL
- Webhook URL: Your Algoticks.in API endpoint
- Message: Leave as {{strategy.order.alert_message}} (contains JSON)
- Click "Create"
The alert will automatically send JSON payloads to your API when signals occur.
Example Configurations
Standard Mean Reversion
[code]
Strategy: Length = 20, StdDev = 2.0
Segment: futures
Order Type: market_order
Quantity: 1
SL: 1% (Relative)
TP: 2% (Relative)
[/code]
Wide Band Reversal
[code]
Strategy: Length = 20, StdDev = 2.5
Segment: futures
Order Type: market_order
Quantity: 1
SL: 1.5% (Relative)
TP: 3% (Relative)
[/code]
Important Notes
- Paper Trading First: Always test with paper trading enabled before live trading
- Order Tags: Automatically generated for tracking (max 18 chars)
- Position Management: Strategy closes opposite positions automatically
- Signal Confirmation: Uses barstate.isconfirmed to prevent repainting
- JSON Payload: All settings are converted to JSON and sent via webhook
Troubleshooting
- No signals: Check if price is actually touching the bands
- Orders not executing: Verify webhook URL and API credentials
- Wrong strikes: Double-check Strike Interval for your asset
- SLBollinger Bands Strategy - User Guide
Overview
This is a Mean Reversion strategy using Bollinger Bands. It generates trading signals when price moves outside the bands and then crosses back, or simply crosses the bands depending on the logic. It integrates with Algoticks.in API for automated trading on Delta Exchange.
Strategy Logic- Long Signal: When Price crosses below the Lower Band (Oversold / Dip Buy)
- Short Signal: When Price crosses above the Upper Band (Overbought / Top Sell)
- Automatically closes opposite positions before entering new ones
Quick Setup
1. Add to TradingView- Open TradingView and go to the chart
- Click "Pine Editor" at the bottom
- Paste the script code
- Click "Add to Chart"
2. Configure Strategy Parameters
Strategy Settings- Length (default: 20): The lookback period for the SMA basis
- StdDev (default: 2.0): The number of standard deviations for the bands
General API Settings- Paper Trading: Enable for testing without real money
- Signal Type: Choose "Trading Signal" (default) for tracking
- Exchange: DELTA (Delta Exchange)
- Segment:
- futures - Perpetual contracts
- options - Call/Put options
- spot - Spot trading
- futures - Perpetual contracts
Order Settings: Basic- Quantity: Number of contracts (e.g., 1, 0.5, 2)
- Validity:
GTC - Good Till Cancelled
IOC - Immediate or Cancel
FOK - Fill or Kill
DAY - Day order
- Product: cross_margin or isolated_margin
Order Settings: Entry Type
Choose how orders are executed:- Market Order: Immediate fill at best price
- Limit Order: Fill at specified price or better
- Stop Market: Triggers at stop price, then market order
- Stop Limit: Triggers at stop price, then limit order
Entry Prices (for Limit/Stop orders)
Limit Price:- Price: The value to use
- Type: Last Price / Mark Price / Index Price
- Mode:
Absolute - Exact price (e.g., 65000)
Relative - Offset from entry price
- % Checkbox: If checked, relative uses percentage; if unchecked, uses points
Example:- Absolute: 65000 → Order at exactly 65000
- Relative 1% (checked): Entry ± 1% of entry price
- Relative 100 (unchecked): Entry ± 100 points
Trigger Price: Same logic as Limit Price, used for Stop orders
Exit / Bracket Prices (SL/TP)
Stop Loss (SL):- Type: Price type to monitor (Mark Price recommended)
- Mode: Absolute or Relative
- %: Percentage or points
- SL: Stop loss value (e.g., 2 for 2%)
- Trig: Optional trigger price (creates Stop-Limit SL)
Take Profit (TP): Same structure as SL
Example:- Long entry at 65000, SL = 2% → Exit at 63700 (65000 - 2%)
- Short entry at 65000, TP = 3% → Exit at 63050 (65000 - 3%)
3. Options Trading Setup (Only if Segment = Options)
Strike Selection Method
User Defined Mode:- Manually specify exact strike and option type
- Best for: Trading specific levels
- Required fields:
- Strike Price: e.g., "65000"
- Option Type: Call or Put
- Strike Price: e.g., "65000"
Dynamic Mode:- System calculates strike based on ATM price
- Best for: Automated strategies
- Required fields:
- Algo Type: Options Buying or Selling
- Strike Offset: 0 (ATM), +1 (above ATM), -1 (below ATM)
- Strike Interval: Gap between strikes (e.g., BTC: 500, ETH: 50)
- Algo Type: Options Buying or Selling
Expiry Date Formats:- T+0 - Today
- T+1 - Tomorrow
- current week - This Friday
- next week - Next Friday
- current month - Last Friday of month
- 131125 - Specific date (13 Nov 2025)
4. Create Alert for Automation- Right-click on chart → "Add Alert"
- Condition: Select your strategy name
- Alert Actions: Webhook URL
- Webhook URL: Your Algoticks.in API endpoint
- Message: Leave as {{strategy.order.alert_message}} (contains JSON)
- Click "Create"
The alert will automatically send JSON payloads to your API when signals occur.
Example Configurations
Standard Mean Reversion
[code]
Strategy: Length = 20, StdDev = 2.0
Segment: futures
Order Type: market_order
Quantity: 1
SL: 1% (Relative)
TP: 2% (Relative)
[/code]
Wide Band Reversal
[code]
Strategy: Length = 20, StdDev = 2.5
Segment: futures
Order Type: market_order
Quantity: 1
SL: 1.5% (Relative)
TP: 3% (Relative)
[/code]
Important Notes- Paper Trading First: Always test with paper trading enabled before live trading
- Order Tags: Automatically generated for tracking (max 18 chars)
- Position Management: Strategy closes opposite positions automatically
- Signal Confirmation: Uses barstate.isconfirmed to prevent repainting
- JSON Payload: All settings are converted to JSON and sent via webhook
Troubleshooting- No signals: Check if price is actually touching the bands
- Orders not executing: Verify webhook URL and API credentials
- Wrong strikes: Double-check Strike Interval for your asset
- SL
- Long Signal: When Price crosses below the Lower Band (Oversold / Dip Buy)
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。