Rajandran R Creator of OpenAlgo - OpenSource Algo Trading framework for Indian Traders. Building GenAI Applications. Telecom Engineer turned Full-time Derivative Trader. Mostly Trading Nifty, Banknifty, High Liquid Stock Derivatives. Trading the Markets Since 2006 onwards. Using Market Profile and Orderflow for more than a decade. Designed and published 100+ open source trading systems on various trading tools. Strongly believe that market understanding and robust trading frameworks are the key to the trading success. Building Algo Platforms, Writing about Markets, Trading System Design, Market Sentiment, Trading Softwares & Trading Nuances since 2007 onwards. Author of Marketcalls.in

Automate your Tradingview Alerts into Orders using Dev Tunnels

2 min read

Ensuring smooth, real-time communication between Trading Alerts and trading platform is crucial. TradingView’s robust charting and alert system combined with OpenAlgo’s flexible strategy execution environment creates a powerful duo—if you can connect them securely. In this guide, we’ll show you how to bridge the gap between TradingView and OpenAlgo using Microsoft’s Dev Tunnels, transforming your development setup into a real-time trading powerhouse.

What Are Dev Tunnels?

Dev Tunnels is a feature built into Visual Studio Code (VS Code). It enables developers to securely expose local web services to the public internet without wrestling with complex networking or cloud infrastructure. Although Dev Tunnels are perfect for ad-hoc testing and development, remember that they are not designed for production workloads.

Key Benefits of Dev Tunnels

Flexibility: Ideal for testing webhooks, APIs, and various integrations—especially for services like TradingView.

Security: Dev Tunnels establish encrypted, secure connections between your local environment and the public internet.

Simplicity: Skip the hassle of configuring cloud servers or proxies. With just a few clicks, you have a publicly accessible URL.

TradEdge 7.0 – Apr 2025 Edition
80+ hours of Live Online Mentorship Program on Market Profile, Orderflow Analytics, VSA

Live Classes Starting from 5th April 2025 onwards

Prerequisites

Before diving into the setup, ensure you have the following:

  • Visual Studio Code (VS Code): Installed on your machine.
  • OpenAlgo: Running locally (for example, on port 5000).
  • TradingView Account: Set up for alert creation.
  • GitHub or Microsoft Account: For authenticating with Dev Tunnels.

Step-by-Step Setup Guide

1. Start and Verify OpenAlgo

Begin by launching your OpenAlgo application locally from your VS Code. Open your browser and navigate to the OpenAlgo dashboard (e.g., http://127.0.0.1:5000/dashboard) to verify that the service is up and running.

2. Create a Dev Tunnel in VS Code

  • Open VS Code where your OpenAlgo project is running.
  • Navigate to the Ports tab located at the bottom of the VS Code interface.
  • Click on “Forward a Port” to start the process.

3. Configure the Forwarded Port

  • Enter the port number on which OpenAlgo is running (e.g., 5000), then press Enter.
  • This action forwards the specified port to a public URL.

4. Set Port Visibility to Public

  • In the Ports tab, right-click on the forwarded address.
  • Select “Port Visibility” and then “Public.”
  • VS Code will warn you that this action will expose your service to the internet—confirm to proceed.
  • If prompted, sign up or log in using your GitHub or Microsoft account to create an encrypted URL.
  • Once completed, verify your new public URL.

5. Obtain Your Custom Webhook URL

  • Refer to the OpenAlgo documentation and navigate to “API Documentation” → “V1” → “Orders API” → “Placeorder”.
  • Copy the custom domain information provided. For instance:
    POST https://your-custom-domain/API/v1/placeorder
  • Append your unique Dev Tunnel URL to this endpoint.
    Example:
    https://h03ml9j.5000.inc1.devtunnels.ms/api/v1/placeorder

6. Create an Alert in TradingView

  • Open your desired chart on TradingView and configure the conditions for your alert.
  • Click the “Alert” icon to create a new alert.
  • In the alert settings, navigate to the “Notifications” tab.
  • Enable the “Webhook URL” option and paste your custom OpenAlgo webhook URL from the previous step.

7. Configure the TradingView Alert Message (JSON Payload)

The JSON payload sent by TradingView is pivotal—it instructs OpenAlgo on how to execute orders.

  • Return to the OpenAlgo documentation and copy the JSON payload structure.
  • Ensure your TradingView alert message matches the required format so that OpenAlgo can correctly interpret and act on the alert.

8. Trigger an Alert and Verify

  • Activate your TradingView alert settings and position the alert trigger line near the current trading range.
  • Once the alert is live, monitor OpenAlgo’s Orderbook and live mode to confirm that orders are being executed as expected.
  • When the order is successfully placed and completed, the alert will cease, marking a successful integration.

Conclusion

By leveraging Dev Tunnels, you can effortlessly and securely connect TradingView alerts to your local OpenAlgo instance. This setup is ideal for testing new trading strategies, exploring API integrations, and streamlining your algorithmic trading workflow. Remember, while Dev Tunnels are fantastic for development and testing, a more robust solution (such as cloud servers) is recommended for production environments.

Embrace this streamlined approach and elevate your algo trading game today!

Rajandran R Creator of OpenAlgo - OpenSource Algo Trading framework for Indian Traders. Building GenAI Applications. Telecom Engineer turned Full-time Derivative Trader. Mostly Trading Nifty, Banknifty, High Liquid Stock Derivatives. Trading the Markets Since 2006 onwards. Using Market Profile and Orderflow for more than a decade. Designed and published 100+ open source trading systems on various trading tools. Strongly believe that market understanding and robust trading frameworks are the key to the trading success. Building Algo Platforms, Writing about Markets, Trading System Design, Market Sentiment, Trading Softwares & Trading Nuances since 2007 onwards. Author of Marketcalls.in

OpenAlgo Roadmap for 2025

Rajandran R
3 min read

OpenAlgo – Major UI Enhancement using Claude Sonnet 3.5

OpenAlgo, the personal algo trading platform, has released an exciting new update (v1.0.12), packed with powerful enhancements to streamline your trading experience. This latest...
Rajandran R
2 min read

Leave a Reply

Get Notifications, Alerts on Market Updates, Trading Tools, Automation & More