Tradingview Smart Order Strategy Automation – Without Writing any Single Line of Code

Algomojo strives to bring intelligent trade execution practices in the form of Arrow API controls. This tutorial helps you to convert any Tradingview strategy into Smart Automation without writing single line of code. So that even a common man who wants to perform automation can implement their algo trading solutions in tradingview without having any prior knowledge of Tradingview Pinescript / Programming Language.

Why Tradingview?

TradingView is a trading platform for traders and investors that offers a range of tools for analyzing and visualizing market data, such as charts, indicators, strategies, backtesting tools, and social trading features. One of the features offered by TradingView is the ability to create and test trading strategies using a built-in programming language called PineScript.

Tradingview Strategies

Tradingview these days is quite popular for trading strategies and more than 10000+ open-source trading strategies are already available in the Tradingview public library.

To create a strategy in TradingView, users must first choose a chart and apply any desired indicators or studies. They can then use PineScript to define the conditions under which they want to buy or sell, as well as set any other parameters such as stop-loss and take-profit levels. Once the strategy is complete, users can backtest it using historical data to see how it would have performed in the past. They can also use the Strategy feature to monitor the market in real time, automate the trades using the webhook feature, and receive alerts when their defined conditions are met.

Algomojo Smart Order Feature (Arrow API)

Recently Algomojo released Arrow API with more intelligent controls like smart order, spit order controls, and Oneshot square-off controls common for all the Algomojo-supported brokers.

PlaceSmartOrder is an intelligent API control used to match the position book of the trading account

Action (API Parameter)Quantity (API Parameter)Position Size (API Parameter)Current Open Position (Trading Account)Action Taken by Algomojo (Execution)
BUY10000No Open Position Found. Hence Buy +100 qty
BUY100100-100BUY 200 to match the Open Position given in API Parameter
BUY100100100No Action was Taken as the Position is already matched
BUY100200100BUY +100 to match the Open Position given in API Parameter
SELL10000No Open Position Found. Hence SELL -100 qty
SELL100-100+100SELL 200 to match the Open Position given in API Parameter
SELL100-100-100No Action was Taken as the Position is already matched
SELL100-200-100SELL – 100 to match the Open Position given in API Parameter

Steps to Integrate Tradingview with Algomojo SmartOrder – Arrow API

Step 1: Select the Trading Strategy to be Automated. Apply the Strategy to the Chart

Step 2 : Verify the Backtesting Results (open the strategy tester and check the equity and drawdown)

Step 3: Set the Trading Quantity in the Properties Section – open the strategy settings (gear icon) and goto the properties tab and set the order size as shown below.

Step 4: Create the Alert

Tradingview Sample PlaceSmartOrder API Request / Response to be pasted in the Alert Message Box

{
    "api_key":"8f0ff8aae1f4041e72beq1524a9fef61d",
    "api_secret":"8961b38c5b7b5a4gabcf2a77fdbe0b70",
    "data":
    {
        "broker":"an",
        "strategy":"Tradingview Strategy",
        "exchange":"NSE",
        "symbol":"RELIANCE-EQ",
        "action":"{{strategy.order.action}}",
        "product":"MIS",
        "pricetype":"MARKET",
        "quantity":"100",
        "price":"0",
        "position_size":"{{strategy.position_size}}",
        "trigger_price":"0",
        "disclosed_quantity":"0",
        "amo":"NO",
        "splitorder":"NO",
        "split_quantity":"2"
    }

}

Tradingview Sample PlaceSmartOrder API Request / Response to Execute Larget Orders with Split Functionality

{
    "api_key":"8f0ff8aae1f4041e72beq1524a9fef61d",
    "api_secret":"8961b38c5b7b5a4gabcf2a77fdbe0b70",
    "data":
    {
        "broker":"an",
        "strategy":"Tradingview Strategy",
        "exchange":"NFO",
        "symbol":"NIFTY29DEC2218500CE",
        "action":"{{strategy.order.action}}",
        "product":"MIS",
        "pricetype":"MARKET",
        "quantity":"5000",
        "price":"0",
        "position_size":"{{strategy.position_size}}",
        "trigger_price":"0",
        "disclosed_quantity":"0",
        "amo":"NO",
        "splitorder":"YES",
        "split_quantity":"1800"
    }

}

Refer the Algomojo Arrow API appendix section for the possible usage of API parameters

Step 5 : Set the Webhook URL to PlaceSmartOrder Endpoint URL in the notification tab https://amapi.algomojo.com/v1/PlaceSmartOrder as shown below

Bingo! Now the Alerts are Configured. Its any signals fired will be automatically reflected in your trading account in an intelligent way and that too without writing a single line of code.

1 thought on “Tradingview Smart Order Strategy Automation – Without Writing any Single Line of Code”

  1. As understood, the quantity and input parameters contracts to match. In the explanation blog, a table was mentioned. But in case, say as per TV Strategy, I’m putting the quantity as per my capital and margin availability from broker. As the quantity is dynamic, then how this thing can be mitigated?

Leave a Comment

Your email address will not be published. Required fields are marked *