TradeAutomation

How to Automate Your Stock and ETF Trading Strategies

Education
AMEX:SPY   SPDR S&P 500 ETF TRUST
It is estimated that over 70% of trades that happen on the stock market are executed by algorithms (source). Until relatively recently, automated quantitative trading systems were largely not accessible to normal people. Today I am sharing with the community an overview of a functional method to automate trades using TradingView strategy alerts and Interactive Brokers.

Overview: The intent of this post it to help point those that are interested in automating their trades in the direction of a functional methodology that can achieve a level of trade automation for a retail investor. There are hours of additional reading that can be found by researching the steps of this process online, as I have done, to deploy your own automated trading server.

Disclaimer: I am not affiliated in any way with the companies or software used in this process.

Trade Automation Process: This particular path to trade automation involves little to no coding, outside of the trade strategies you would need coded in TradingView's PineScript language. If you do not know PineScript, you can always hire a Pine Coder to code your idea into a backtest-able trading strategy that can be automated.

  • Setup and Deploy an AWS RDP Server
    This will be a Windows based remote desktop server that will remain online in the cloud. Trades will be relayed and placed from this server. Specs should be the current minimum requirements for all software you install on the server.
  • Install Interactive Brokers IB Gateway Software on the RDP Server
    This is an Interactive Brokers software that can pickup trade signals from other software using the IB Gateway API.
  • Install TradeRelay.net Software on the Same RDP Server
    This software will create a webhook URL that you can forward TradingView alerts to, and will relay those alerts to place trades using the IB Gateway API.
  • Configure Software
    Port settings, maintenance/restart settings, tickers settings, etc. will need to be configured on the IB Gateway and TradeRelay software in order for the two pieces of software to interact properly.
  • Code Your Trading Strategies in PineScript
    PineScript is the coding language used to create strategies and indicators in TradingView. Once you have strategies in PineScript, you can backtest and automate alerts for them.
  • Setup Alerts for your Strategies Using Webhooks in TradingView
    Specific webhook formatting and instructions for this are found in the TradeRelay documentation. These webhooks will transmit signals to the TradeRelay software you have installed on your new AWS RDP server.
  • RDP into your Server and Open Software
    In order for trades to be relayed, your RDP server must be logged into IB Gateway and TradeRelay. Click start on TradeRelay, and you should get a message confirming that the software has synced with IB Gateway.
With this methodology you can automate market orders for stocks and ETFs. You can also modify the IB Gateway settings to only require a manual login weekly (on Sundays).

Enjoy!

Want to build custom alerts and custom strategies? Interested in automated trading?

Hire me to code or automate your trading strategy, or schedule a free consultation at:
www.TradeAutomation.net
Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.