## Calculating Indicators for Stock Data Forecasting

And here an example how the functions from this module can be used in any perl program:

use warnings;
use stock_data_analysis;
for(\$i=0; \$i<10; \$i++) { \$data[\$i]=\$i; \$vol[\$i]=2; } for(\$i=0; \$i<10; \$i++) { print \$data[\$i]; print "\n"; } @diff_data= stock_data_analysis::do_diff(@data); for(\$i=0; \$i<10; \$i++) { print \$diff_data[\$i]; print "\n"; } print “\n”; print “mean=”; print stock_data_analysis::get_mean(@data); print “\n\n”; @a=stock_data_analysis::sma(4, @data); for(\$i=0; \$i<10; \$i++) { print \$a[\$i]; print "\n"; } print “\n\n”; @a=stock_data_analysis::get_FI(1, \@data, \@vol); for(\$i=0; \$i<10; \$i++) { print \$a[\$i]; print "\n"; } Thus now we can add above indicators to downloaded stock price data in Google spreadsheet. References 1. Financial Stock Market Forecast using Data Mining Techniques K. Senthamarai Kannan, P. Sailapathi Sekar, M.Mohamed Sathik and P. Arumugam, IMECS 2010 2. The Comparison of Methods Artificial Neural Network with Linear Regression Using Specific Variables for Prediction Stock Price in Tehran Stock Exchange, Reza Gharoie Ahangar, Mahmood Yahyazadehfar, Hassan Pournaghshband, (IJCSIS) International Journal of Computer Science and Information Security, Vol. 7, No. 2, February 2010

## Input for Stock Data Prediction Algorithms

What can be used for input to stock data prediction system? In this post we will consider some indicator that often are used for stock data forecasting. The links to information about indicators and how to calculate will be also provided.

Moving averages are often used in technical analysis. A few examples: Simple Moving Average (SMA) – to calculate SMA for period of n days we take sum of prices for the n days going back and divide by n. Then move to next day and do it again.

Exponential Moving Average (EMA) – with this moving average the recent data are getting more weight than other. With SMA all data points are getting the same weight.

Here is the indicator that uses prices and volume: Force Index. In two words it is showing how strong is the current trend, how likely it will continue or change. Force index for 1 period can be calculated as

Force Index(1) = (Close_Price (current) – Close_Price (prev)) x Volume

The list of indicators with the information how they are calculated can be found at . They are divided in 3 groups, price based, volume based and breadth indicators. Breadth indicators are based on statistics derived from the broad market. Some papers on stock data forecasting also describe very well the list of variables that were chosen for input.

If we look we can find that there are many different choices but it can improve the quality of forecast accuracy., Not only price , volume or other market statistics can be used for stock market forecasting. Textual web data can be also used but it requires web/text mining processing. You can find some example at 

## References

1.How to Use Force Index
3. The Comparison of Methods Artificial Neural Network with Linear Regression Using Specific Variables for Prediction Stock Price in Tehran Stock Exchange Reza Gharoie Ahangar,Mahmood Yahyazadehfar,Hassan Pournaghshband (IJCSIS) International Journal of Computer Science and Information Security, Vol. 7, No. 2, February 2010
4.Financial Stock Market Forecast using Data Mining Techniques K. Senthamarai Kannan, P. Sailapathi Sekar, M.Mohamed Sathik and P. Arumugam, IMECS 2010, hong Kong
5.Daily Stock Market Forecast from Textual Web Data B. Wuthrich, V. Cho, S. Leung, D. Permunetilleke, K. Sankaran, J. Zhang, W. Lam, The Hong Kong University of Science and Technology
6. Technical Indicators and Overlays From StockCharts.com – ChartSchool 7.Financial Stock Market Forecast using Data Mining Techniques K. Senthamarai Kannan, P. Sailapathi Sekar, M.Mohamed Sathik and P. Arumugam

Swing stock trading means buying and selling stocks many times when the stock prices are at or near their bottom or top position. Some details and more information can be found at ,.

The simple and well known rule – buy low and sell high can be applied here too. But how do we detect when it is low and when it is high?

Historical data and computer simulation can be the answer. We can pick the strategy and then evaluate it using past data. By changing some parameters and running simulation on the past data we can also improve the strategy.

For example the simple rule – buy when one day stock price decrease is more than some number (delta) and sell when the increase is more than delta can be run on previous stock data with the different delta.