Posts

How to check if a distribution is normal?

Image
    Many models assumed that the distribution is normal. It is a wise idea to check if your distribution is normal before use it in the model. In this post I want to explain you, some numerical and visual methods you can use to check if a distribution is normal. 1)     Boxplot-Whisker Plot and Histogram: Plotting Boxplot-whisker plot and the histogram of the distribution is a visual way you can use to see if the distribution looks normal. The Boxplot-whisker lets us check the symmetry around the mean and the histogram help us to visualize the overall shape of the distribution. Let’s see it in an example: In this example we create one normal distribution sample and one non-normal distribution sample and use the boxplot-whisker and histogram to visual them. import numpy as np import pandas as pd import scipy.stats as stats import matplotlib.pyplot a...

Momentum Trading Strategy

Image
  Momentum Trading Strategy   In this post I will show you how you can develop a simple momentum trading strategy and evaluate its potential use and statistics. This could be the good foundation for more advanced momentum trading strategies. The general premise this trading signal is that outperforming stocks keep to outperform in some time in a particular market and vice versa for underperformers. In this momentum trading strategy, we going to buy outperformers and short underperformers. So, let’s start. First, we need to import our packages. 1.   import  yfinance as yf   2.   import  pandas as pd   3.   import  numpy as np   For building our trading strategy we need to find our top outperformers and underperformers among a group of stocks or index. I use SP500 socks for this example. We need to pull all SP500 members historical data. You ca...