# GoCharting

### Overview

GoCharting is a professional HTML5 charting platform optimized for Indian markets. With a **Premium Plan**, you can set up webhook alerts to automate your trading strategies with OpenAlgo.

{% embed url="<https://www.youtube.com/watch?v=HpkSGNkhoYY>" %}

***

### Prerequisites

#### 1. GoCharting Premium Plan

* Webhook alerts are only available on the **GoCharting Premium Plan**
* Subscribe at [GoCharting](https://gocharting.com) to access webhook features

<figure><img src="https://17901342-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmBwEhITzgv0O0fEGIIRN%2Fuploads%2FSQMcctujt0UUVZtC9CN8%2Fimage.png?alt=media&#x26;token=6f86d424-e3d5-4ed1-81a4-8f465497bd83" alt=""><figcaption></figcaption></figure>

#### 2. OpenAlgo Setup

* OpenAlgo instance running and accessible
* API key configured in OpenAlgo
* Broker connected and authenticated

#### 3. Public URL Configuration

**Option A: Production/Custom Domain**

If you have a custom domain or server:

1. Open your `.env` file
2. Update the `HOST_SERVER` variable:

   ```env
   HOST_SERVER=https://sub.yourdomain.com
   ```

**Option B: Local Development with Tunneling**

If you're running OpenAlgo locally (on your computer) and want to test webhooks, you'll need to expose your local server to the internet using a tunneling service.

**Popular Tunneling Services:**

* **DevTunnel** (Microsoft) - Good for Visual Studio users
* **ngrok** - Popular cross-platform option
* **localtunnel** - Free and simple alternative
* **Cloudflare Tunnel** - Enterprise-grade option

**How Tunneling Works:**

1. Your local OpenAlgo runs on `http://127.0.0.1:5000`
2. Tunneling service creates a public URL pointing to your local server
3. GoCharting can send webhooks to this public URL
4. The tunnel forwards requests to your local OpenAlgo

**Typical URL Formats:**

* DevTunnel: `https://abc123.devtunnels.ms`
* ngrok: `https://abc123.ngrok.io`
* localtunnel: `https://abc123.loca.lt`

**Setup Steps:**

1. Install and configure your chosen tunneling service
2. Start the tunnel pointing to port 5000 (OpenAlgo's default port)
3. Copy the public URL provided by the tunneling service
4. Update your `.env` file:

   ```env
   HOST_SERVER=https://your-tunnel-url.com
   ```
5. Restart OpenAlgo application

⚠️ **Important Notes:**

* Tunnel URLs may change each time you restart (unless using paid plans)
* Free tier tunnels may have bandwidth/time limitations
* Update the webhook URL in GoCharting if your tunnel URL changes
* For production use, consider a custom domain instead of tunneling

***

### Step-by-Step Setup

#### Step 1: Generate Webhook Configuration

**Login to OpenAlgo**

* Navigate to your OpenAlgo dashboard
* Go to **Platforms** from the main navigation menu

<figure><img src="https://17901342-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmBwEhITzgv0O0fEGIIRN%2Fuploads%2FH5UuNmrUNZuarJgf443G%2Fimage.png?alt=media&#x26;token=12a36260-ce1e-44f5-b968-d25d46af48e3" alt=""><figcaption></figcaption></figure>

**Open GoCharting Configuration**

* Click on the **"Configure GoCharting"** card
* You'll be redirected to `/gocharting/`

<figure><img src="https://17901342-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmBwEhITzgv0O0fEGIIRN%2Fuploads%2F3ht6r7cM8z6dsY7LRmGA%2Fimage.png?alt=media&#x26;token=f12ddc38-7ffc-481d-afed-3ef3f196789a" alt=""><figcaption></figcaption></figure>

**Configure Your Trade Parameters**

1. **Generate JSON**
   * Click the **"Generate JSON"** button
   * The webhook configuration will be displayed on the right side
2. **Copy Configuration**
   * **Webhook URL**: Click "Copy" button next to the webhook URL

     ```bash
     https://yourdomain.com/api/v1/placeorder
     ```
   * **JSON Payload**: Click "Copy" button to copy the generated JSON

     ```json
     {
       "apikey": "your_api_key_here",
       "strategy": "GoCharting",
       "symbol": "SAIL",
       "action": "BUY",
       "exchange": "NSE",
       "pricetype": "MARKET",
       "product": "MIS",
       "quantity": "10"
     }
     ```

***

#### Step 2: Create Alert in GoCharting

**Open GoCharting Chart**

* Login to your GoCharting Premium account
* Open the chart for your desired instrument

<figure><img src="https://17901342-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmBwEhITzgv0O0fEGIIRN%2Fuploads%2FYHd5x4cfm1NcmskS4GFD%2Fimage.png?alt=media&#x26;token=431faccf-53b7-4863-b7ba-acd51c51cf91" alt=""><figcaption></figcaption></figure>

**Set Alert Conditions**

* Right-click on the chart or use the alert button
* Click **"Create Alert"**

Configure the alert parameters:

**Setup Messaging**

* **Name**: Give your alert a descriptive name (e.g., "SAIL BUY ALERT")
* **Message**: Paste your copied JSON payload here

  ```json
  {
    "apikey": "your_api_key_here",
    "strategy": "GoCharting",
    "symbol": "SAIL",
    "action": "BUY",
    "exchange": "NSE",
    "pricetype": "MARKET",
    "product": "MIS",
    "quantity": "10"
  }
  ```

**Webhook URL**: Paste your OpenAlgo webhook URL

```
https://yourdomain.com/api/v1/placeorder
```

1. **Create the Alert**
   * Review all settings
   * Click **"CREATE ALERT"** button
   * Your alert is now active!

***

***

### Support & Resources

#### Documentation

* OpenAlgo Docs: <https://docs.openalgo.in>
* GoCharting Help: <https://gocharting.com/docs/scripting/webhookalertsforalgotrading>

#### Community

* OpenAlgo GitHub: <https://github.com/marketcalls/openalgo>
* Report Issues: <https://github.com/marketcalls/openalgo/issues>

#### Video Tutorials

* Check OpenAlgo YouTube channel for video guides
* GoCharting tutorials for alert setup

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.openalgo.in/trading-platform/gocharting.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
