# Stock Technical Analysis Introduction of Optimal Value Calculation Site

I think there are many people who make full use of technical analysis in stock trading.

But in technical analysis

• I’m wondering what the value of the parameter should be.
• I spend a lot of time adjusting the parameters.

Do you have such troubles?

In this article, I will introduce a self-made parameter automatic calculation site. The results of this site are updated automatically every day.

It will be the appearance and link of HP.

### How to read the calculation result

As an example, let’s take a look at the BB (Bollinger Bands) section.

The orange arrow part is the calculation result. In the case of this example, the optimum parameter values ​​are Length: 13 days, standard deviation: 2.0, and the rate of return at that time: 30.9% .

## Background of launching the site

Someone around me said that they spend a lot of time adjusting the parameters of technical analysis.

There are various opinions regarding parameter adjustment.

• Parameter values ​​that many people use should be used
• Even if it takes time to adjust, it is not worth the effort
• No longer the realm of art. The person’s natural territory (Is it impossible for ordinary people?)

We have no intention of denying these opinions on this site.

However, as one of the judgment factors for stock trading

Analyze with statistically valid parameter values

I think things are also worth it.

I searched for such a site but couldn’t find it for free. (It may not have been searched for …)

I thought so, so I made it.

I run my own Argo on my PC and trade stocks automatically, so I thought it would be easy to make.

Actually, that wasn’t the case. It took a long time! !!

## How to calculate

The details will be long, so I have summarized them here .

I think there are various methods for adjusting parameters.

On this site

A method that uses the most profitable parameter value in the latest data

(From the perspective of “permissible risk,” which is the most important factor in stock trading, it may be better to have the highest Sharpe ratio. I am still thinking about it.)

This is the main feature of the automatic calculation site.

• Use daily bars
• Calculated once a day (updated around 15:30)
• The latest data period used for the calculation is 3 patterns of 50 days, 100 days, and 200 days (each result can be viewed.)

## Stocks being calculated

• SPY (S & P500 interlocking ETF)
• QQQ (Nasdaq 100 interlocking ETF)

I adopted the one of the royal road. Speaking of the royal road, I think that it is an ETF linked to the American stock index, so I chose the three most famous ones.

(I was worried about whether to include the global stock VT, but I removed it. I thought that there was little demand as an option because it has a high correlation coefficient with the S & P 500. I think it will be another discussion for long-term investment. But··)

• RSI
• BB (Bollinger Bands)
• MACD
• EMA (Exponential Smoothing Moving Average)

We have adopted these four because it is a technical analysis that is often used by the majority of people.

We would like to consider other analysis methods if there are many requests.

I have summarized it here , including the ones that may have questions .

## Below, miscellaneous notes

From here on, it will be miscellaneous notes such as software information and thoughts while creating the software. I wrote it as I wanted, so it’s not organized at all.

In addition, there are some parts that do not take into account the prerequisite knowledge of the reader.

If you are aware of this and have time to spare, we would appreciate it if you could get along with us.

### Points to keep in mind when creating

The UI (appearance of the site) does not use motion etc., and I tried to keep it simple. I thought it was important only to understand the calculation results.

Isn’t it true that there is no technical ability on the front side?
・・・・・・・・・・・・

### Library information used (excerpt)

• Languages: Python, JavaScript
• Library: Numpy, Pandas, etc.
• DB: PostgreSQL
• ORM: SQLAlchemy
• Chart drawing: Plotly.js
I wasn’t used to Plotly and it was really hard.
The code part using Plotly, similar contents are scattered in multiple places?
There were only errors and it couldn’t be helped!
I’ll refactor it properly at a later date (sweat)
In this way, debt to the future will accumulate …

Need this information?
It doesn’t matter, but the name “Hexagonal Architecture, Clean Architecture” is cool!
Listen to me

### Points to keep in mind when creating

Initially I used TA-Lib to calculate the technical analysis.
I don’t think the real person understands the meaning of that conversation …
I deployed to Heroku, but I just can’t install the library …
As usual, You don’t listen to me …
I thought it would be difficult because it’s a C ++ wrapper, but on the internet, I should have put in a buildpack! !
Leave it alone …

For BuildPack, I tried Heroku Python TA-Lib package .

I tried various things for a long time, but I couldn’t.

Looking at the development page of GitHub, it is highly possible that the Python version is not supported because it has not been updated since around 2018.

Maybe there is some way …

### Illustration

The administrator likes to draw illustrations, but the drawing ability is not good, so I made it public so that I could see it using such a shape.