In this algo trading guide for beginners, we share what you need, how it works and how to place your first algorithmic trade in the stock market. Algo trading refers to trading a financial market using programming, where a computer program watches the market and places orders for you. A program is coded to watch an asset’s price movements and identify when to buy and sell, then place orders accordingly.
When you are starting out, often the hardest part is the setup. You might have a concept around a strategy you want to try in the stock markets, but many new traders wouldn’t know how to link everything up to run an algorithm on the stock market. This algo trading guide for beginners runs you through the early stages of what you need to get set up.
Why Learn Algo Trading?
Algorithmic trading has many benefits, one being that trusting a computer to run the same process over and over again in the aim to earn a profit over time can be very attractive to those wanting more freedom of time. Some of the reasons where algorithmic trading can have an advantage over human trading are listed below:
- Speed & Precision: Algorithms execute trades faster than humans.
- Discipline: No emotional decisions, just logic.
- Scalability: Automate multiple stocks and strategies.
- Back testing: Validate ideas on historical data before risking capital.
- Skill Growth: Combine coding, data analysis, and financial logic.
Your time goes into defining strategies that may last for years, rather than watching the market for trades you have to continually place yourself. The first steps we cover in this algo trading guide for beginners, mainly looks at what you need to run an algorithm. Strategy development and refining your setups will come later.
What You Need & Why – Algo Trading Guide for Beginners
The thing with algorithmic trading is, there’s a bit of setup involved upfront but the time savings and satisfaction of owning a piece of code that works for you every day, is worthwhile. Sometimes beginners look at the downloads and wonder if they really need everything, so in this algo trading guide for beginners we make sure we cover the reason why you need each download.

You need a securities broker account to access the markets, a platform to access the broker and market, a code editor to write the strategy algorithm and the coding language to be installed on your computer, so your computer knows what the coding language is. Let’s break it all down, one by one in this algo trading guide for beginners.
A Securities Broker – Macro Global Markets
To trade stocks algorithmically, you need a broker that provides access to the market you want to trade. Macro Global Markets provides you with access to global stock markets including the ASX, US equities, Hong Kong stocks and much more. Open an account and request a paper trading account by email.
A Platform – Trader WorkStation (TWS)
To access the markets, you need to run your trades through a trading platform. The trading platform allows you to run the algorithm and execute trades with the securities broker. In this algo trading guide for beginners, we use Trader WorkStation (TWS).

A Code Editor – Visual Studio Code
You will need a place where you can write code, even Notepad lets you do this, but a code editor can help identify bugs, visually understand sections of your code and allows plugins and add-ons that can make coding easier.
Using something like Visual Studio Code – a free program you can download from the internet, means you can get started as soon as you have your brokerage access.

Coding Language – Python
The coding language, Python, operates on a logical basis that can be fairly easy to make sense of (as we will share with you later in this guide). You will need python installed to your computer to run python code.
Here’s an example line of code of how the trade can be identified:
if last_price < lower_band
This simply means that if the last price of the stock was less than the lower Bollinger Band then the code might say to enter the trade. The format of python is very logical once you get a feel for it, and our templates and tutorials help guide you on the logic and structure of algorithmic trading frameworks.
Once you have created the logic, you can build your algorithm and simply press run (or play) button on your code editor to run it. Ensure your platform is running and logged in to the paper trading account to test it out.
Other Things You Need in this Algo Trading Guide for Beginners
A computer, laptop or VPS is required to run the platform and code. While a VPS is preferred, a computer will do while you build your knowledge and experience as an algorithmic trader. You will also need an internet connection.
Steps to Get Set Up – Algo Trading Guide for Beginners
- Get your account with Macro Global Markets then request a paper trading account to test your strategy.
- Download the TWS platform, code editor and coding language.
- Once you’ve got this, you’re a good part of the way set up. Then you can test your connection with code provided later in this algo trading guide for beginners.
Access The Market
To get things working, open the TWS platform and log in (to your paper account while you learn).
Once you have code, you can run it from your visual editor and it will function with the platform to place trades or create alerts as per your algorithm. We will cover more on the code later on in this algo trading guide for beginners.
Is it Secure?
It wouldn’t be an algo trading guide for beginners without talking about safety! The great thing about using TWS and python on your own computer or VPS, is that the code doesn’t leave your system, depending on how you set it up.
The code and TWS both run on your local machine on 127.0.0.1 meaning:
- No trading logic or strategy data needs to be sent to external cloud services.
- Your bot communicates with TWS over localhost, not over the open internet.
- You retain full control of your trading environment and API credentials.
Many APIs require the input of logins to the code, whereas this method doesn’t require authentication, reducing the touch points of where you could be vulnerable (this is a very good thing for security).
The Code – Algo Trading Guide for Beginners
In the Members Area we provide educational templates and scripts to help you build your algorithm. To allow python to interact with the platform (TWS), you need to have the library ib_insync installed.
To install the library, you simply open Command Prompt (one way to access this is to press the Windows key then type “cmd” and it should come up).
Here’s a Paper Version code that can show if you were able to connect to TWS or not. For Live version, the default port is 7496, so you would simply change the port.
from ib_insync import *
# Connect to TWS on the default paper trading port
ib = IB()
ib.connect('127.0.0.1', 7497, clientId=1)
if ib.isConnected():
print("Successfully connected to Trader Workstation (TWS)!")
else:
print("Failed to connect. Check if TWS is open and API is enabled.")
ib.disconnect()
When you run this code, you should receive a message from your print functions showing either Success or Fail. If the code fails, you will need to check your settings in the platform.
Risk Management
It’s important to cover risk management in this Algo trading guide for beginners, since it’s one of the most critical factors for success in trading and investing. When coding your algorithm, it can be helpful to code some fail-safes and protections to avoid unwanted or unexpected stock purchases.
Maximum Trade Size – You can set the code to trade no more than a set percentage of capital per trade.
Limit Maximum Drawdown – You can set the code to limit your drawdown by closing positions if a limit is reached.
Set Stops Lots and Target Profits – Coding stop losses and targets can help manage the positions from the beginning, and protect against bigger price movements than anticipated.
Monitoring – Monitoring the algorithm and the trade outcomes is important, particularly during early phases of testing. Checking that the logic plays out as expected means you can have more confidence that your trades are being placed in line with the logic you have coded.
Rate Limits
It wouldn’t be an algo trading guide for beginners without talking about rate limits.
Rate Limits are a common concept in making requests from various platform. The platform allows for 6 requests per 10 seconds, and 60 requests in 10 minutes.
Rate limits protect server infrastructure, allow for control on data licensing costs, prevent abuse and misuse. The same limits also help to influence efficient design off algorithms, from batching requests to caching results to ensure the code continues to work and to reduce latency. In other words, it helps drive innovation in the trader’s code.
Why Trade Stocks – Algo Trading Guide for Beginners
Asset Traits of Shares
Stocks represent part ownership in a company. Often a company is far more focused compared to that of a country (such as with Forex or Stock Index), where people can focus their attention towards opportunities by geographical locations, industry, product or service and even target based on the innovation and leadership of individuals and board of directors.
Stocks can sometimes lag compared with that of an underlying asset, take gold miners vs the gold price for example. Individual equities can also be host to other niche opportunities inspired by the management style, board of directors, management of financials, business decisions, negotiations and deals made by the company.
The quarterly and annual reporting can provide detailed insights into the performance of the company, including its current position. Stocks are a unique investment in the sense that gathering similar quality of information on larger scale investment types, such as the commodity gold or silver, can be much more challenging, given that global movements of an entire commodity can be more challenging to navigate. Stocks on the other hand, report quarterly and annually, including their holistic and consolidated financial reports all in one place. Often the number of people looking at this information is far less than that of a commodity or currency.
Stock Selection – Algo Trading Guide for Beginners
Stocks come in all shapes and sizes, from massive blue-chip companies generating massive earnings with huge employee numbers, down to small caps that are yet to draw a profit and run on a tight team of people.
There are many ways you can focus your attention on certain stocks, be it an industry or sector focus, a stability or profitability approach or even targeting stocks that are expected to commence earnings in the coming months. Your trading personality will often determine the types of stocks you like and will enjoy trading.

Stock selection can often be influenced by the price of stocks, their volatility and price compared with indicator values such as a Bollinger Band or RSI. Technical traders will often look for patterns, value and volatility, while fundamentalists will often aim for strong books and future prospects of the underlying company.
This algo trading guide for beginners is just the start. Whatever your style, make a start and learn what works for you, we even have a competition you can be a part of to help you continue learning along the way.
Join the Competition – Algo Traders Test Your Skills
Macro Global Markets runs a competition for traders and coders to show off their skills in AlgoStockX Arena. Enhance your knowledge of financial markets and coding methods as you refine your skills in a real, rewarding market. The algo trading guide for beginners is just the start of your journey, the next step is to compete and improve. The AlgoStockX Arena is perfect for those looking to hone in their skills and go head-to-head in a paper or real environment.
