Rajandran R Creator of OpenAlgo - OpenSource Algo Trading framework for Indian Traders. 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

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

3 min read

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. One the OrderSize is Set the Same Position Sizing will be reflect over the charts.

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.

Rajandran R Creator of OpenAlgo - OpenSource Algo Trading framework for Indian Traders. 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

Introducing OpenAlgo V1.0: The Ultimate Open-Source Algorithmic Trading Framework…

OpenAlgo V1.0 is an open-source algorithmic trading platform to automate your trading strategies using Amibroker, Tradingview, Metatrader, Python etc. Designed with the modern trader...
Rajandran R
2 min read

Dive Into the TradingView Paper Trading Competition: A Chance…

Welcome to an exhilarating opportunity presented by TradingView – a paper trading competition that not only tests your trading acumen but also offers a...
Rajandran R
1 min read

Introducing PineGPT – To Build Better Tradingview Pinescript Codes

PineGPT is a customGPT for ChatGPT4 users designed to provide expert guidance on creating and understanding TradingView Pine Script indicators and trading strategies. PineGPT...
Rajandran R
1 min read

Leave a Reply

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