ChartInk
Last updated
Last updated
OpenAlgo supports integration with Chartink for automated trading based on scanner alerts. This integration allows you to:
Create and manage trading strategies
Configure symbols with quantities and product types
Currently Supports only NSE and BSE Symbols
Handle intraday and positional strategies
Automate order placement based on Chartink alerts
Auto square-off positions for intraday strategies
ChartInk Paid Account (Supports Webhook Features to send Alerts to OpenAlgo)
Ngrok with Custom Domain Configuration (Provides Webhooks to Chartink/Tradingview) if hosted locally in Laptop/Desktop.
Configure the .env file with Custom Domain (you cannot run Chartink by default with localhost or 127.0.0.1:5000)
OpenAlgo uses a dual-queue system to handle orders efficiently:
Regular Order Queue (Entry Orders):
Handles BUY and SHORT orders
Processes up to 10 orders per second
Orders are batched for maximum throughput
Example: 50 BUY orders complete in ~5 seconds
Smart Order Queue (Exit Orders):
Handles SELL and COVER orders
Maintains 1-second delay between orders
Higher priority than entry orders
Example: 50 SELL orders complete in ~50 seconds
Multiple Strategy Handling:
All strategies share the same queues
Exit orders always processed before entries
Rate limits maintained across strategies
Each strategy respects its trading hours
Auto Square-off Processing:
Uses smart order queue
1-second delay between position closures
Processes positions sequentially
Example: 20 positions take ~20 seconds to close
Go to the Chartink section in OpenAlgo
Click "New Strategy" button
Fill in the strategy details:
Name: A unique name for your strategy (will be prefixed with 'chartink_')
Type: Choose between Intraday or Positional
For Intraday strategies:
Start Time: Trading start time (default: 09:15)
End Time: Trading end time (default: 15:00)
Square Off Time: Auto square-off time (default: 15:15)
The alert name in Chartink MUST include one of these keywords (not case-sensitive):
BUY - For entering long positions
Examples:
"BUY Alert"
"Alert for BUY 2024-12-13"
"Supertrend BUY Signal"
SELL - For exiting long positions or regular selling
Examples:
"SELL Alert"
"Alert for SELL 2024-12-13"
"Supertrend SELL Signal"
SHORT - For entering short positions (selling first)
Examples:
"SHORT Alert"
"Alert for SHORT 2024-12-13"
"Supertrend SHORT Signal"
COVER - For exiting short positions (buying to cover)
Examples:
"COVER Alert"
"Alert for COVER 2024-12-13"
"Supertrend COVER Signal"
Keywords can appear anywhere in the alert name
Keywords are not case-sensitive (buy/BUY/Buy all work)
Alert will fail if no valid keyword is found
Only one action will be taken even if multiple keywords are present
After creating a strategy, you need to configure the symbols to trade:
Click "Configure Symbols" on your strategy
Add symbols individually:
Search and select Symbol (with exchange badge)
Select Exchange (NSE by default)
Enter Quantity
Select Product Type (MIS for Intraday, CNC for Positional)
Or bulk add symbols using CSV format:
Creating a Scanner
Click "Create a new scanner" button
Create the Scanner conditions and Press Save Scan
Enter an alert name that includes one of the action keywords
Creating Alert
Once the Scanner is Saved Click Create Alert
Find the "Webhook url(optional)" field
Copy and paste your strategy's webhook URL:
Configure other alert settings as needed
Click "Save alert" button
When your scanner conditions are met, Chartink sends an alert to your webhook URL
OpenAlgo receives the alert and:
Validates the webhook ID
Checks if strategy is active
Validates the alert name for action keyword
For intraday strategies, checks if within trading hours
Matches symbols from alert with your configured symbols
Places orders according to your configuration
For intraday strategies:
Orders are only placed between Start Time and End Time
At Square Off Time, all open positions are automatically closed
Uses MIS product type for better leverage
For positional strategies:
Orders can be placed any time during market hours
No automatic square-off
Uses CNC product type for delivery trades
When a Chartink alert is received:
For new positions:
For square-off (intraday):
Active strategies process incoming alerts
Inactive strategies ignore alerts
Toggle status from strategy view
Add/remove symbols any time
Update quantities as needed
View all configured symbols with exchange badges
Bulk import for multiple symbols
Delete confirmation for symbol removal
For intraday strategies:
Start Time: When to start accepting alerts
End Time: When to stop accepting alerts
Square Off Time: When to close all positions
Use Chartink Custom Watchlists
Create custom watchlists with only your trading symbols
Avoid scanning large portfolios like NIFTY500, NIFTY200
Helps manage positions efficiently
Reduces processing time for orders
Better control over trading universe
Test your strategy with small quantities first
Verify order placement
Check position management
Monitor square-off process
Validate webhook integration
Use proper stop-losses in your Chartink scanner
Implement risk management rules
Set appropriate price conditions
Add volume filters if needed
Monitor the first few alerts
Verify order execution
Check processing times
Validate symbol matching
Ensure proper position tracking
Keep your webhook URL private
Don't share webhook URLs
Regularly check for unauthorized alerts
Monitor strategy activity
Include action keyword in scan name
Use clear, consistent naming
Follow keyword rules strictly
Avoid multiple keywords
For intraday strategies:
Ensure orders are placed during trading hours
Monitor square-off at configured time
Plan for processing delays with large lists
For large symbol lists:
Entry orders process faster (10/sec)
Exit orders take longer (1/sec)
Plan strategy timing accordingly
Consider splitting into multiple strategies
OpenAlgo handles various error scenarios:
Invalid webhook IDs
Missing action keywords in alert names
Inactive strategies
Outside trading hours
Symbol mismatches
Order placement failures
All errors are logged and can be viewed in the API analyzer.
Only supports NSE and BSE exchanges
Intraday square-off is all-or-nothing
No partial position closures
No modification of existing orders
Market orders only
Alert name must contain valid action keyword
Each strategy has a unique webhook ID
API keys are required for order placement
Session validation for web interface
Secure storage of credentials
Rate limiting on endpoints
Confirmation dialogs for deletions
Check strategy status (active/inactive)
Verify trading hours for intraday
Confirm symbol configurations
Check alert name contains valid keyword
Check API analyzer for errors
Verify webhook URL in Chartink
For issues or questions:
Check the logs in API analyzer
Review error messages
Contact support with:
Strategy ID
Error details
Time of occurrence
Relevant logs
Alert name and webhook URL used