Let's break down the topic backwards, Automated Algorithmic Trading.

Algorithmic trading is buying and selling of stocks based on certain pre-set formula-based conditions.

For example, one would want to buy a stock when its previous day's closing price is higher than the opening price for that day. So simply, a ratio of close/open > 1 would quantify the qualitative idea.

Automated algorithmic trading is buying and selling of stocks based on certain preset conditions automatically using computer codes.

As an example above, an automated algorithmic trading software will trade when the ratio of close/open is greater than 1. And as soon as that happens, the buy order is executed.

The concept sounds simple, isn't it?

The implementation is the tricky part.
The first series of tutorials has focused on throwing in the jargons related to algorithmic trading. A higher deep down tutorials for each of the concepts will be released in the future.

kuants.in

A common myth before we proceed.

"Investment and trading are the same."

They are not.

One of the key difference is the time horizon.

Investment is usually for a long-term holding period. While trading can be monthly, weekly, daily or intraday.

You won't hear people saying they are an intraday investor, or a long-term trader often.

An investment/trading strategy is a set of decision points which are used to achieve a particular target of desired returns from the stock market. Now, a strategy that buys and sells at the correct points fulfilling the desired target returns evaluates to a good investment/trading strategy.

A question comes, how to develop one. There are multiple methods of developing an investment/trading strategy.

In general, people follow the news, use technical analysis, fundamental analysis, and several other functions, different people have their own ways to do an analysis.
An extensive classification is available in lesson 7.
The next lesson throws light on how to develop one.
Developing investment strategies for Algorithmic Trading
Should it be a random formula? Do you wish to invest your money into an unknown randomly generated formula?

No. A strategy is developed from an idea. Any idea from any domain of life you like.

A 1-hour long boring meeting with the boss can be taken as a motivation for an investment idea.

What happens when you get out of that boring meeting?

You feel happy, right?

An analogy to this in terms of investment ideas can be: if the markets are cold for a specified period, neither moving up or down, but just hopping within low range, can you expect a "breakout" , i.e. can you expect that the "boring" period will end with a positive or a negative sentiment?

That's a small invest idea.

An example of a line of thought to qunatify a qualitative idea is as follows:

A cold period in the markets will mean that the prices are not moving much. There is a very low range, meaning the recent volatility i.e. the amount of movement in the markets is lesser than the volatility in the longer range.
Our simulator has a predefined function called volatility(price, time period ). It takes the price of the stock and the time period to be considered to calculate the volatility.

volatility(open,10)   gives the value of the volatility of open prices of the stock of last 10 minutes.

volatility(open,30)   gives the value of the volatility of open prices of the stock of last 30 minutes.
Since the idea of the strategy is that if the recent movement in the market is lesser than the movement in its longer time period, a breakout is expected and you buy at that point.

volatility(close, 10) < volatility(close, 30)
Voila!

The left-hand side of the equation is the movement in recent times, the right-hand side of the equation is the movement in a longer time frame, then this formula causes our systems to buy when the recent 10 minutes volatility is lower than long-term 30 minutes volatility.

More about stock market simulators in the next lesson
Stock Market Simulator
An assumption from the books :
"The stock market has seen all possible kinds of news and events that are possible. Any price movement that is about to happen in the future has already been seen in the history. "
You have developed your idea in the previous lesson.

Its verification can be done through a stock market simulator.

Now, what exactly is that?

It is a computer program that emulates the behavior of the stock markets in the artificial environment.

It takes in your strategy and thinks as it what would have been the results if you had applied that strategy live in a previous time frame. How would have it performed during the global crisis or during elections or a natural calamity and many more events which affect the movement of the stock market?

Why is it necessary?

It lets you know the worth of your investment strategy. It allows you know whether this type of approach would have worked ever in the historical markets or not.

One shouldn't live trade a strategy that has no history of giving good returns.

A question is often asked, are the results of the simulator a proof that the strategy will run in the future?

No, an excellent historical result does not guarantee similar profits in the future. But it does guide you to segregate good and bad investment ideas

Give it a thought.
The simulator is for strategy testing.
Monte Carlo Simulations are for checking the robustness of the same.
Monte Carlo Simulations
Sounds tough right, sounds fancy!!

It is a tool to stress test your investment strategy in different "universes". Seems weird. Don't worry it will all make sense in some time.

The concept of "different universe" is an exciting read and is driven by philosophy.

It states that different versions of you exist simultaneously in a parallel domain.

For example, in one universe, you are a software engineer, in other, you are a Broker.

A Monte Carlo simulation is used after backtesting a strategy having good result metrics.

It is a tool to test the robustness of the strategy in different environments

Hundreds and Thousands of new mathematically generated samples replace the actual stock data to a form in which it might exist in a different universe.

This is the data no one has seen till now and you can simulate on a thousand samples of it.

By our knowledge, it is one of the most sophisticated tools for risk management in today's time. Once a strategy has been backtested on multiple stocks, and Monte Carlo simulations have given good results, the next important step is to create an optimized portfolio, i.e. develop a collection of stocks such that the money is distributed to each stock in the most optimized manner.
Portfolio Optimization
Quote: "One size doesn't fit all." One can simulate all the stocks listed on NSE at a single go but all will not perform well.

Some stocks will respond nicely to the strategy and rest won't.

We need to filter out the non-performing stocks.

A quick question: Do all the well-performing stocks have the same returns? No.

Some perform very well, some perform "only" well.

We would need to optimize the money allocation to different stocks so that out of the well-performing stocks, the best-performing stocks get the highest allocation and the lower well-performing stocks a bit less.

In very broad terms, this is what is called portfolio optimization.
Classifications of different domains in trading

This module is generally related to different types and aspects of investment strategy, trading, risk management and any other aspect that we thought might be helpful.

Classification of strategies based on holding period:
• Long-term investments
• Medium-term investments
Classification of stocks:
• Growth stock
• Value stocks
Classification of methods of stock analysis:
• Fundamental analysis
• Technical analysis
Basic quant strategies:
• Technical indicators
• Price-Volume based strategies
• Sentiment analysis
• Support Vector Machines
• Neural Networks
• Stochastic processes
• Analysis of Variance
• Multivariate regression
• Logistic regression
• Dynamic live strategy and stock selection out of a bucket of stocks and strategies
Stochastic processes
• Random walk
• UB process
• Markov Model
Portfolio allocations
• Markovitz model
• Sharpe model
• Dynamic Allocation
• Static logic based allocation with rebalancing
Components of Risk Management:
• Stop loss
• Limit, order
• Bracket order
• Probabilistic approach
• Classification algorithms
• Monte Carlo simulations
• Sensitivity analysis
• Statistical process control
Types of stock selection methods:
• For long-term investing: Fundamental Ratios
• For medium term: Sentiment
• For day trading: Time Series