Price Oscillator is a technical indicator calculating the percentage difference between two price moving averages. It is basically another name for the MACD indicator. Crossovers of two moving averages correspond to crossovers of absolute price oscillator [APO (MACD)] and zero central signal line around it oscillates.
To understand price oscillator, we need to know the exponential moving averages (EMA) concept. In simple term, EMA is the average price over a certain number of days, with more recent days weighted more heavily i.e. exponentially. EMA needs to be calculated over a period of appropriate length to maximize meaningful data while minimizing…
Back-testing which is in the form of performance testing is one of the most complicated tasks involved in an algorithmic trading research system. There are several things such as software latencies, network latencies, slippage, fees etc. are involved to build an algorithmic trading framework. The basic idea is to that is given historical data, what would be the performance of the trading strategy.
Here, we will explore as how we can use machine learning algorithm to predict future direction and define a strategy for trading. …
Linear programming is widely used for optimization and applications can be found almost in every industry operating under conflicting constraints. We will here work with a simple and quite common use case of cost optimization problem. The problem can be formulated as a standard linear optimization problem with the objective function is to minimize the transportation cost, subject to supply & demand with equality and inequality constraints.
Let us create some synthetic data. For easy understanding and computational ease, the relevant information is in tabular format as shown below:
Optimization method has a wide application in the industry in many diverse fields such as machine learning, finance, aviation & logistics etc. to name a few. Once we zeroed down on the problem statement, the next step is to solve the problem with the best available options.
To simplify, the idea is to find the best available solution which is at least as good and any other possible solution. If we want to quantify and express the problem in mathematics, we need to come with an objective of solving the problem which is the objective function in mathematics. …
Profitability of stock market trading is directly related to the prediction of trading signals. Here, we will discuss about some basic to advanced and popular technical analysis to build trading signals. Our focus will be on signal generation and visualization. A long list of technical indicators are available covering principal domains such as trend, momentum, volume, volatility, and support and resistance. We will cover a few of these here.
However, once signal is generated, strategy is defined, the next most important task is performance testing which is not the scope of this article. However, it’s not only the strategy decides…
Prediction and classification are important and of great interest for the simple fact that successful prediction of stock prices lead to rewarding benefits. However, there is no universal common set of rules but a series of highly complicated and quite difficult tasks are involved for such prediction.
Here, we will show a simple use case to showcase how classification rule can be applied to obtain a trading strategy and conclude with a performance testing of the strategy by running a simple script.
Let us load the data from Quandl.
BC = BC.loc['2010-01-01':,]
Back-testing is an important step to get the statistics to ensure effective trading strategy. It comes with some of the key points such as profit and loss, net profit and loss, invested capital, number of trades/orders return, Sharpe ratio etc. Here, we will discuss as how to design a financial trading strategy using open source Python tools and we’ll review the results of the back-test by going through some plots generated by pyfolio.
Let us load the data as shown below.
def dataExtraction(): dataset = web.DataReader('^IXIC', data_source = 'yahoo', start = '2010-01-01') dataset = dataset.sort_index(ascending=True) # Plot the closing prices…
Error correction model (ECM)is important in time-series analysis to better understand long-run dynamics. ECM can be derived from auto-regressive distributed lag model as long as there is a cointegration relationship between variables. In that context, each equation in the vector auto regressive (VAR) model is an autoregressive distributed lag model; therefore, it can be considered that the vector error correction model (VECM) is a VAR model with cointegration constraints.
Cointegration relations built into the specification so that it restricts the long-run behavior of the endogenous variables to converge to their cointegrating relationships while allowing for short-run adjustment dynamics. …
Feature selection method is a data pre-processing step in conjunction with machine learning for classification or regression purposes. The main motivation for reducing the dimensionality of the data and keeping the number of features as low as possible is to reduce the training time and enhance the classification accuracy of the algorithms we use; moreover, reduced dimensions provide a more robust generalization and a faster response with unseen data. Unlike feature extraction, feature selection does not alter the data.
There are three main groups of feature selection in general: (1) wrapper, (2) embedded and (3) filter methods. Each group has…
Vector auto regression (VAR) to first difference generally creates integrated time-series (TS) models. But we may eliminate valuable information about the relationship among variables by differencing, where Vector Error Correction model (VECM) is applicable.
VAR involves multiple exog variables which are important to predict future state of endog variable. Using Granger causality (GC) we can determine the importance of multiple variables and GC is only relevant with TS variables. We will use VAR to investigate GC here.
Here our use case is that, we have data of Western Texas Intermediate, Brent Crude oil and HenryHub Spot price and we shall…
Data Science Practice Lead at KSG Analytics Pvt. Ltd.