Technical Analysis Basics for Algotrading

the main concept behind the candle sticks.

how to define the trends:


Higher High and higher lows.

Down Trend:

In down trends we have the low below the low and highs below the previos highs.

in each period the local minimums and maximums should be calculated.

Support and Resistance:

these area are based on the historical behaviuor of seller and buyer on a market. assumptions:

  1. we should cut out the effect of anything that is the result of the parameters that are not recurring. like, the effects of dividends payouts, company news and… in order to have a homougenous data set, by which we can decide about the natural resistance and suppots.
  2. we assume that investors’ percipitation about the stock or coin did not change in the period that we are making the analysis.
SPCE Stock price vs time

as an example, the price of the SPCE is a period of Feb 2021 to March 2021 had a peak and fall, which was not normal. this was because of a special event (Test of the new spaceship), hence we should filter these data out, if we want to find the resistance and support levels in April 2021.

Manual calculations for Support and resistance and Stop loss and take profit on upward trending market.

Tp is at the uppermost area above the green area and the SL is the lowermost area below the red area.


there are a lot of different indicators that should be investigated before designing the models for bots, here are some of the most important ones.

In general, the indicators are very easy to understand and the concept behind them is highly intuitive. for simplicity let's assume the model can be assumed to be like an offline exchange or currency exchange shop. with this in mind:

Volume→ number of clients in the shop

Sell and buy price → like the sell and buy price of the USD against the local currency.

Volatility → The readiness of buyers to buy with higher prices and the sellers to sell with lower prices. it is a source that shows the level of confidence of the clients on a market/ stock/ coin. simply told, it shows the level of stress in the market or on the other side it can show the interest in the market.

Mean Price → Average price of sell and buy

VWAP → Volume Weighted Average price, sum (price * Number of currency sold)/(Volume) it is an indication of the tendency of the majority of people or main big sellers or buyers. the price corrects itself toward the VWAP.

Average True Range → in nutshell it shows that how volatile can be our prices for the currency today. i.e. if the ATR of USD to INN is 10%, we should modify the Stop loss and take profit based on that. The SL and Tp are depending on the market trend. but, as a general rule, we can use the 2–1 reward to risk on our short or long positions with the ATR calculation.

Note: For this to calculate the ATR, use the daily calculation and not the short-term periods.

the ATR calculation is simple:

  1. In each day (In the last 14 days period) calcualte the True Range:

TR=Max [(High-Low)or (high-close) or (Low — close)]

2. Average by the periods of the time employed. for example average of TR in the last 14 day.

3. To compare different investments, we can compare them based on ATR% which is :

ATR%=ATR/Stock price

the higher it is, the more volatile the share can be.

Moving Average:

20MA for the last 20 periods.

Application 1: if the people are buying at prices higher than the MA, it means that the market CAN be uptrending and vice versa.

Application 2: 20 MA, 50 MA, and 200 MA can also be used as a Resistance/support point.

Application 3: to have an approximation of the Stop Loss.

4. Relative strength based calculations:




An Enthusiast Equity Analyst and Independent Financial Researcher with a passion for Fundamental Analysis. I use Medium for the daily records.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Statistical Simulation

Are you ready for designing the experiment?

Measures of Algorithmic Fairness Move Beyond Predictive Parity to Focus on Disparate Error Rates

Introduction to 3D Vision

Jupyter Notebook crashed, so I deployed my Data Science project in the Cloud in 15 minutes (for…

A Reflection on my Experience as a Data Science Intern at Fernish

An Interview with Annabelle Rincon (A Tableau Ambassador and Analytics TUG Co-Lead)

Application of iterative mapping workflow to the croplands in Uzbekistan

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Iman Najafi

Iman Najafi

An Enthusiast Equity Analyst and Independent Financial Researcher with a passion for Fundamental Analysis. I use Medium for the daily records.

More from Medium

Journey to writing an RSI trading algorithm— Week 2

Downloading Historical Stock prices with Alpha Vantage – Towards AI — The  World's Leading AI and Technology Publication

Step-by-step Guide to Algo Trading using PHI 1 | PHI 1 Blog

A Python Between the Sheets

How To Get Forex Data For Analysis