A professional charting application that displays the Williams VIX Fix indicator using OpenAlgo for market data and TradingView Lightweight Charts for visualization.
Real-time Williams VIX Fix indicator with SBIN data showing price chart and volatility analysis
- Williams VIX Fix Indicator: Complete implementation with customizable parameters
- OpenAlgo Integration: Real-time and historical market data from your OpenAlgo instance
- PineTS Framework: Powered by PineTS - Pine Script in TypeScript
- TradingView Lightweight Charts v5.0.8: Professional-grade charting library (locally hosted)
- Interactive Controls: Customize symbol, timeframe, and indicator parameters
- Responsive Design: Modern UI with DaisyUI components
- Real-time Status: Connection status and error handling
- Modular Architecture: Clean, extensible codebase for easy indicator development
- Python 3.7+ (with pip)
- OpenAlgo server running on
http://127.0.0.1:5000
- Valid OpenAlgo API key
- PineTS - Pine Script in TypeScript framework
- PineTS GitHub - Source code and documentation
- OpenAlgo - Open source trading platform
cd openalgo-pinets
python -m venv venv
venv\Scripts\activate
source venv/bin/activate
pip install -r requirements.txt
Copy the sample environment file and update it with your settings:
cp .env.sample .env
Edit .env
and update your OpenAlgo API key:
OPENALGO_API_KEY=your_actual_api_key_here
OPENALGO_HOST=http://127.0.0.1:5000
Ensure your OpenAlgo server is running on http://127.0.0.1:5000
python app.py
Navigate to http://127.0.0.1:5005
openalgo-pinets/
βββ venv/ # Python virtual environment
βββ app.py # Main Flask application
βββ data_fetcher.py # OpenAlgo data fetcher module
βββ templates/
β βββ index.html # Main UI template
βββ static/
β βββ js/
β β βββ openalgo-provider.js # OpenAlgo data provider module
β β βββ williams-vix-fix-indicator.js # Williams VIX Fix indicator module
β βββ lib/
β β βββ lightweight-charts-5.0.8.js # TradingView Lightweight Charts (local)
β βββ images/
β βββ pinets.png # Application screenshot
βββ requirements.txt # Python dependencies
βββ README.md # This file
The application uses environment variables for configuration. Copy .env.sample
to .env
and update the values:
# OpenAlgo Configuration
OPENALGO_API_KEY=your_openalgo_api_key_here
OPENALGO_HOST=http://127.0.0.1:5000
# Flask Configuration
FLASK_ENV=development
FLASK_DEBUG=True
FLASK_HOST=127.0.0.1
FLASK_PORT=5005
- Never commit your
.env
file - it contains sensitive API keys - The
.env
file is already in.gitignore
for security - Always use
.env.sample
for documentation and examples
The indicator supports the following customizable parameters:
- Period Length (pd): Default 22 - Lookback period for standard deviation high
- BBL Length (bbl): Default 20 - Bollinger Band length
- Multiplier (mult): Default 2.0 - Bollinger Band standard deviation multiplier
- Lookback Period (lb): Default 50 - Lookback period for percentile high
- Highest Percentile (ph): Default 0.85 - Highest percentile threshold
- Lowest Percentile (pl): Default 1.01 - Lowest percentile threshold
- Symbol: Stock symbol (default: SBIN)
- Exchange: NSE or BSE (default: NSE)
- 1 minute (1m)
- 5 minutes (5m) - Default
- 15 minutes (15m)
- 30 minutes (30m)
- 1 hour (1h)
- 1 day (D)
- Start Date: Beginning of data range
- End Date: End of data range
GET /
- Main Williams VIX Fix UIGET /api/data
- Fetch OHLCV data from OpenAlgo
symbol
- Stock symbol (e.g., "SBIN")exchange
- Exchange name (e.g., "NSE")interval
- Timeframe (e.g., "5m")start_date
- Start date (YYYY-MM-DD)end_date
- End date (YYYY-MM-DD)
- Flask - Web framework
- flask-cors - CORS support
- pandas - Data manipulation
- openalgo - OpenAlgo API client
- requests - HTTP client
- openalgo-provider.js - Handles data fetching from OpenAlgo API
- williams-vix-fix-indicator.js - Modular Williams VIX Fix indicator implementation
The OpenAlgoProvider
class handles all data communication with your OpenAlgo instance:
const provider = new OpenAlgoProvider();
const data = await provider.getMarketData('SBIN', 'NSE', '5m', '2025-01-01', '2025-01-24');
The WilliamsVixFixIndicator
class provides a complete, reusable implementation:
const indicator = new WilliamsVixFixIndicator();
const params = { pdLength: 22, bblLength: 20, mult: 2.0 };
const plots = indicator.calculate(marketData, params);
- β Parameter validation - Ensures valid inputs
- β Default parameters - Sensible defaults for all settings
- β Metadata support - Get parameter definitions and descriptions
- β Extensible - Easy to modify or extend functionality
This project demonstrates how to integrate PineTS indicators with web applications:
// PineTS-style indicator development
const context = {
data: { open, high, low, close, volume },
ta: { sma, ema, highest, lowest, stdev },
core: { plot, color }
};
// Calculate Williams VIX Fix using PineTS methodology
const wvf = ta.highest(close, pd).map((hc, i) => ((hc - low[i]) / hc) * 100);
plot(wvf, 'WilliamsVixFix', { style: 'histogram', color: col });
For more indicators and advanced usage, visit the PineTS documentation.
# If virtual environment fails to create
python -m pip install --upgrade pip
python -m pip install virtualenv
# Recreate virtual environment
rm -rf venv # or rmdir /s venv on Windows
python -m venv venv
- Verify OpenAlgo is running: Check
http://127.0.0.1:5000
in your browser - Check API key: Ensure your API key is valid and has proper permissions
- Firewall: Make sure ports 5000 and 8080 are not blocked
- Check browser console for JavaScript errors
- Verify data response - Check network tab in browser dev tools
- Clear browser cache and refresh the page
If port 5005 is already in use, change it in your .env
file:
FLASK_PORT=5006 # Or any available port
- Start the application following the installation steps
- Adjust chart settings using the form controls:
- Select your desired symbol and exchange
- Choose timeframe (5m recommended for intraday analysis)
- Set appropriate date range
- Customize Williams VIX Fix parameters based on your analysis needs
- Click "Load Data" to fetch new data
- Click "Apply Indicator" to recalculate with new parameters
The Williams VIX Fix is a technical indicator that:
- Measures market fear similar to the VIX volatility index
- Identifies potential market bottoms when fear is high
- Uses price action instead of options data (unlike traditional VIX)
- Generates signals when the indicator reaches extreme levels
- High values (green histogram bars) suggest potential buying opportunities
- Range lines (orange/lime) show historical percentile levels
- Upper band (aqua line) indicates overbought fear levels
The included screenshot shows SBIN stock data with:
- Price Chart: Candlestick chart showing price movement over time
- Williams VIX Fix: Lower panel showing volatility spikes (green bars) during market stress periods
- Signal Lines: Range high (lime), range low (orange), and upper band (aqua) providing context levels
- Fear Spikes: Notable green peaks in December 2024 and March 2025 indicating potential buying opportunities
This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0).
See the LICENSE file for details.
- β Free to use - Use the software for any purpose
- β Open source - Access to source code is guaranteed
- β Copyleft - Modifications must also be open source
β οΈ Network use - If you run this on a server, users must have access to the source code- π Attribution required - You must include the license and copyright notice
For more information about AGPL-3.0, visit: https://www.gnu.org/licenses/agpl-3.0.html
Contributions are welcome! Please feel free to submit pull requests or open issues.
For issues or questions:
- Check the troubleshooting section above
- Verify your OpenAlgo setup is working correctly
- Check browser console for JavaScript errors
- Open an issue on GitHub with detailed error information