Buy Sell Algorithm with Moving Average

Data Scientists working in the field of finance usually make calculations such as portfolio optimization, trading transactions and portfolio return. This work is very important on the stock market. Because every decision made affects the amount of profit to be made. Therefore, it should be integrated into the system being worked on by choosing the steps carefully. There is a mechanism in the stock exchange that interacts with the world, and companies that can quickly adapt to its changes should quickly make a difference and become sustainable. In this way, while revealing their difference, they can change their marketing style and be active in the market. Companies that offer consultancy as a brand and have a high potential to adapt to changes can frequently mention their names. Machine learning and deep learning algorithms are deeply worked in the background of robot consultants. Every company that offers robot consultants has a solid infrastructure in its own right. Even if the coding part is a bit complicated, the moment we reach the conclusion part, we will see the whole success with our own eyes. Based on this, I put the output as an example in the bottom picture.

Actually, the picture you see above represents the final state of the project. For those who want to reach, I will leave the whole code in the resources section and you will be able to adapt it to your own systems easily. I should indicate that as a note. I did this encoding using the company Aselsan Turkey Located in the stock market. In addition, any transaction you see here is not investment advice. After specifying these, we add the libraries as you see below and read our data set. Then we code the describe () function to get statistical output about the data. The variable we are dealing with here will be on the ‘close’ variable, which represents the closing of the exchange. I made my own analysis by taking the dates of the data set as of January 1, 2017. You can make your analysis at any time you want, but the only thing that should be, the historical data set for the stock must be in the necessary libraries so that you can use it as I use it. Otherwise, your code will not run and will generate errors. You can examine the details of the code for which I put the Github link. If you have any questions, you can contact me at my e-mail address.

There are many different methods of technical analysis within the stock market. Here we will continue on the moving average entirely. The moving average method is one of the most common methods used in the stock market. Thanks to this method, there are many people who instantly follow the trading style transactions in the stock market. There are still technical analysis methods that we will add to these. Examples include RSI, Bolinger Band, MACD, and Fibonacci Correction Levels. The lines you see at the bottom are the moving average method that will make horse sell transactions for us with the window () function. The blue line in the image represents the actual prices. Apart from this, the intersection points of other lines turn to us as buy and sell and we can measure the return ourselves. Thanks to the function I named buy_sell, it takes the necessary actions for us. This makes the preparation for us. The functioning of this place for us indicates that all of the transactions are completed. Now only the necessary assignments have been made and the visual representation of the function is as I showed it at the beginning. To do this, the matplotlib library will help you.

The rest of this article will come as long as I improve myself and I am thinking of writing this in a series. I aim to explain to you the effects of the trading and technical analysis methods used in the stock exchange and help everyone who thinks about a career in this field. There are many start-ups in the stock market that trade through robot advisors. In addition, large companies on the basis of the sector continue to provide continuity while discovering new things in the market by investing in many small companies that will work in this field and are open to development. As it is known, the stock market can be affected by even the smallest things and change the profit and loss situations quickly. Large companies, who have information about what will happen before, preserve their profit margin by taking firm steps in the market by predicting such volatile environments. There are many technical analysis methods in the analysis systems used while creating them. The scalability of such processes can also guarantee how the system will react and that it will respond positively. I will continue to evaluate the share prices and process the technical analysis methods on the Python programming language. You can follow up and give feedback for this.