Rajandran R Founder of Marketcalls and Co-Founder Algomojo. Full-Time Derivative Trader. Expert in Designing Trading Systems (Amibroker, Ninjatrader, Metatrader, Python, Pinescript). Trading the markets since 2006. Mentoring Traders on Trading System Designing, Market Profile, Orderflow and Trade Automation.

How to Send Automated Orders from Tradingview to Algomojo Platform

2 min read

This tutorial explores how to send automated orders from Tradingview using webhook method to Algomojo Trading Platform.

Webhook is a unique way of communicating in realtime from one application to another application. Webhooks are automatic. You don’t have to manually utilize them in order to make them work — once they’re set up, they run on their own.

If you are very new to the Algomojo Platform then kickstart with this tutorial

How to Send Automated Option Orders Tutorial

TradingView Webhook

Tradingview Webhooks allow you to send a POST request to a certain URL every time the alert is triggered. This feature can be enabled when you create or edit an alert

Various Modes One can send Alerts from Tradingview Platform

1)Horizontal Line Trigger Alerts
2)Price Crossover Alerts
3)Trendline/Channel Alerts
4)Custom Indicator/Strategy Alerts
5)Tradingview Screener Alerts

Free Version or Paid Version in Tradingview?

Both free version and paid version supports Realtime data for NSE Cash, NSE Futures, MCX Futures with Alerts. However Webhook Alerts are available in Tradingview Pro version onwards.

Trading View Alert Configuration

Here are the different webhook configuration settings for various type of orders. Note for bracket orders one need to send along with token id. Which will be discussed in the upcoming articles.

Webhook URL for placing orders (MKT, LMT, SL, SL-LMT, CO,AMO orders)

Broker - Aliceblue 
https://abapi.algomojo.com/1.0/PlaceOrder 

Broker - Tradejini
https://tjapi.algomojo.com/1.0/PlaceOrder 

Broker - Zebu
https://zbapi.algomojo.com/1.0/PlaceOrder

Webhook Message FormatSample Placeorder Example

{
    "api_key":"c1997d92a3bb556a67dxxxx1446b7087",
    "api_secret":"5306433329e81ba4dfsdfs653417063c71",
    "data":
      {
        "strg_name":"Tradingview Alerts",
        "s_prdt_ali":"BO:BO||CNC:CNC||CO:CO||MIS:MIS||NRML:NRML",
        "Tsym":"RELIANCE-EQ",
        "exch":"NSE",
        "Ttranstype":"B",
        "Ret":"DAY",
        "prctyp":"MKT",
        "qty":"1",
        "discqty":"0",
        "MktPro":"NA",
        "Price":"0",
        "TrigPrice":"0",
        "Pcode":"MIS",
        "AMO":"NO"
      }
}

Webhook URL for placing Bracket Orders

Broker - Aliceblue
https://abapi.algomojo.com/1.0/PlaceBOOrder 

Broker - Tradejini
https://tjapi.algomojo.com/1.0/PlaceBOOrder 

Broker - Zebu
https://zbapi.algomojo.com/1.0/PlaceBOOrder

Webhook Message FormatSample Bracketorder Example

Request example :

{
  "api_key":"c1997d92a3bb556a67dca7d1446b70",
  "api_secret":"5306433329e81ba41203653417063c",
  "data":
    {
      "strg_name": "Bracket Order Strategy",
      "s_prdt_ali":"BO:BO||CNC:CNC||CO:CO||MIS:MIS||NRML:NRML",
      "TokenNo":"317",
      "exch":"NSE",
      "Ttranstype":"B",
      "Ret":"DAY",
      "qty":"0",
      "discqty":"0",
      "Price":"0",
      "ltpOratp":"NA",
      "SqrOffAbsOrticks":"Ticks",
      "SqrOffvalue":"1",
      "SLAbsOrticks":"Ticks",
      "SLvalue":"1",
      "trailingSL":"0",
      "tSLticks":"1"
    }
}

Webhook URL for placing Multi Client/Basket orders

Broker - Aliceblue
https://abapi.algomojo.com/1.0/PlaceMultiOrder 

Broker - Tradejini
https://tjapi.algomojo.com/1.0/PlaceMultiOrder 

Broker - Zebu
https://zbapi.algomojo.com/1.0/PlaceMultiOrder

Webhook Message FormatSample Multiorder Example

{
    "api_key":"c1997d92a3bb556a67dca7d1446b70",
    "api_secret":"5306433329e81ba41203653417063c",
    "data":
      {
          "orders" : 
            [
                {
                "order_refno":"1",
                "user_apikey":"c1997d92a3bb556a67dca7d1446b70",
                "api_secret":"5306433329e81ba41203653417063c",
                "strg_name": "Test Strategy",
                "s_prdt_ali":"BO:BO||CNC:CNC||CO:CO||MIS:MIS||NRML:NRML",
                "Tsym":"RELIANCE-EQ",
                "exch":"NSE",
                "Ttranstype":"B",
                "Ret":"DAY",
                "prctyp":"MKT",
                "qty":"1",
                "discqty":"0",
                "MktPro":"NA",
                "Price":"0",
                "TrigPrice":"0",
                "Pcode":"CNC",
                "AMO":"NO"
                },
                {
                "order_refno":"2",
                "strg_name": "Test Strategy",
                "user_apikey":"c1997d92a3bb556a67dca7d1446b70",
                "api_secret":"5306433329e81ba41203653417063c",
                "s_prdt_ali":"BO:BO||CNC:CNC||CO:CO||MIS:MIS||NRML:NRML",
                "Tsym":"INFY-EQ",
                "exch":"NSE",
                "Ttranstype":"B",
                "Ret":"DAY",
                "prctyp":"MKT",
                "qty":"0",
                "discqty":"0",
                "MktPro":"NA",
                "Price":"0",
                "TrigPrice":"0",
                "Pcode":"CNC",
                "AMO":"NO"
                }
            ]
      }
}

Webhook URL for placing Option Orders (ITM/OTM/ATM)

Broker - AliceBlue
https://abapi.algomojo.com/1.0/PlaceFOOptionsOrder 

Broker - Tradejini
https://tjapi.algomojo.com/1.0/PlaceFOOptionsOrder 

Broker - Zebu
https://zbapi.algomojo.com/1.0/PlaceFOOptionsOrder

Webhook Message FormatSample Option Order Example (4 strike wide OTM call option from the At the money strike price)

{
  "api_key":"c1997d92a3bb556a67dca7d1446b7087",
  "api_secret":"5306433329e81ba41203653417063c71",
  "data":
    {
      "strg_name":"Options",
      "spot_sym":"NIFTY",
      "expiry_dt":"20OCT20",
      "opt_type":"CE",
      "Ttranstype":"B",
      "prctyp":"MKT",
      "qty":"75",
      "Price":"0",
      "TrigPrice":"0",
      "Pcode":"NRML",
      "strike_int":"50",
      "offset":"4"
    }
}

Where to Check the Order in Realtime in Algomojo

You can use order logs to check for any incoming automated orders generating from Tradingview Webhooks in Realtime and can also download the logs for later use.

Let me know in comments if you find this tutorial useful or incase if you need more details about algomojo integration with tradingview you can comment your inputs below.

Rajandran R Founder of Marketcalls and Co-Founder Algomojo. Full-Time Derivative Trader. Expert in Designing Trading Systems (Amibroker, Ninjatrader, Metatrader, Python, Pinescript). Trading the markets since 2006. Mentoring Traders on Trading System Designing, Market Profile, Orderflow and Trade Automation.

Metatrader 4 – Simple Expert Advisor for Algomojo Platform

f writing a simple expert advisor for Metatrader 4 to send automated orders from MT4 to Algomojo - Cloud-Based Trading Platform. This tutorial provides...
Rajandran R
1 min read

Algomojo Platform Now Open to Firstock Users

We are proud to provide our Algomojo access to Firstock users. Firstock a Bangalore based discount broking firm partnered with Algomojo to provide algotraders...
Rajandran R
4 min read

Algomojo – Sending Simultaneous Orders to Multi Clients –…

Designed a simple interface in excel on sending simultaneous orders from the excel application to multiple trading accounts. Code uses algomojo API to...
Rajandran R
10 min read

One Reply to “How to Send Automated Orders from Tradingview to Algomojo…”

  1. Hi Rajendra R,

    how to place limit order using below JSON. like “prctyp”:”MKT”, it is using market price which take 1 to 5 seconds, instead of i want to use LMT so when indicator return BUY it will send to broker for same as a limit order. please resolve the issue.

    {
    “api_key”:””,
    “api_secret”:””,
    “data”:
    {
    “strg_name”:”UPLBS”,
    “s_prdt_ali”:”BO:BO||CNC:CNC||CO:CO||MIS:MIS||NRML:NRML”,
    “Tsym”:”UPL-EQ”,
    “exch”:”NSE”,
    “Ttranstype”:”{{strategy.order.comment}}”,
    “Ret”:”DAY”,
    “prctyp”:”MKT”,
    “qty”:”120″,
    “discqty”:”0″,
    “MktPro”:”NA”,
    “Price”:”0″,
    “TrigPrice”:”0″,
    “Pcode”:”MIS”,
    “AMO”:”NO”
    }
    }

Leave a Reply

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