Chapter 1:Applications of Advanced Regression Analysis for Trading and Investment
The prediction of Forex time series is one of the most challenging problems in forecasting.
a parametric model in statistics is a family of distributions that can be described using a finite number of parameters.
a model is considered non-parametric if all the parameters are in infinite dimensional parameter space.
Essentially, he concludes that non-parametric models dominate parametric ones. Of the non-parametric models, nearest neighbours dominate NNR models.
the data is obtained from Datastream for the historical forex.
FX price movements are generally non-stationary and quite random in nature, not suitable for learning purposes. To overcome this problem the series is transformed into rates of return given a formula:
Rt=( Pt/pt-1) -1
The advantage of using a return series is that it helps making the time series stationary (use statistical property)
To confirm that a series is stationary we perform the Augmented Dickey-fuller and Phillips-Perron test statistics to show 1% significance level.
ADF and PP from the above mentioned is a test for a unit root in a time series sample.
a unit root is a feature of processes that evolve through time that can cause problems in statistical inference if its not adequately dealt with.
Augmented Dickey-Fuller
Uses a negative number, the more negative it is, the stronger the rejection of the hypothesis that there is a unit root at some level of confidence
Phillips-perron
it is used in time series analysis to test the null hypothesis that a time series is integrated of order 1.
the Phillips–Perron test makes a non-parametric correction to the t-test statistic
The benchmark models used:
Naive strategy:
Assumes that the most recent period change is the best predictor of the future.
MACD Strategy:
a moving average is obtained by finding the mean for a specified set of values and then using it to forecast the next period
ARMA Methodology:
useful to a single stationary series or when economic theory is not useful. a highly refined curve fitting device that uses current and past valuesof the dependent variables to produce accurate short term forecast.
Does not assume any particular pattern in a time series,but uses an iterative approach to identify a possible model from a general class of models.
Tests of adequacy determines a satisfactory model. The general class of ARMA models is for stationary time series, if the series is not stationary an appropriate transformation is required.
Likelihood ratio(LR) is used for redundant or omitted variables
*used to compare the fit of two models, one the null model is a special case of the other alternative model
Ramseys RESET test was used for model miss-specification.
*a general specification test for the linear regression model.it tests whether nonlinear combinations of the fitted values help explain the response variable.
significance of the model is tested via F-Test
*a statistical test in which the test statistics has an F-distribution under the null hypothesis. its used to compare statistical models that have been for to a data set, in order to identity the model that best fits the population from which the data were sampled.
serial correlation LM test(Breusch–Godfrey test) shows further confirmation of the model at 99% confidence interval.
*used to assess the validity of some of the modelling assumptions inherent in applying regression-like models to observed data series
Logit estimation:
logit model belongs to a group of models termed "Classification models"
a multivariate statistical technique used to estimate the probability of an upward or downward movement in a variable.
Neural Network are universal appropriators capable of approximating any continuous function.
The advantage of NNR models over traditional forecasting methods is that the model best adapted to a particular problem cannot be identified. therefore its better to resort to a method that is a generalization of the many models that rely on an a priori model.
The problem of NNR models is because of their Black-box nature. excessive training times, overfitting, large number of parameters required for training are some of the problems.
Therefore deciding on the appropriate network involves much TRIAL AND ERROR.
financial applications time series may well be quasi-random or at least contain noise.
quasi-random: n-tuple to fill n-space uniformly.
Occam's Razor: selecting among competing hypothesis which makes the fewest assumptions.
unnecessary complex models should not be preferred to simpler ones.
the objective is to find a model with the smallest possible complexity and yet still describe the dataset without overfitting
a reasonable strategy in desigining NNR models is to start with one later containing a few hidden nodes and increase the complexity while monitoring the generalisation ability. a crucial factor is determining the number of layers and hidden nodes.
Backpropagation networks are the most common multilayer network and are the most used type in financial time series forecasting (Kaastra and Boyd, 1996).
Because of the pattern matching of NNR models the representation of data is critical for a successful network design.raw data is rarely fed into the network. they are scaled between the upper and lower bounds of the activation function.
another crucial parameter of the network is the learning rate. smaller learning rate slows the learning process. while larger rates cause the rror function to change wildly without continuously improving.
linear cross-correlation analysis: give some indication of which variables to include in a model, or atleast a starting point to the analysis
How to perform Linear-Cross-Correlation?
explained variance:how much variation in that model given a dataset
post training weight analysis helps establish the importance of the explanatory variables because of no standard statistical tests for NNR models. the idea is to find a measure of contribution a given weight has to the overall output of the network. Such analysis includes examination of a Hinton Graph.
Hinton Graph represents graphically the weight matrix within a network
The MAE and RMSE statistics are scale-dependent measures but allow a comparison between the actual and forecast values, the lower the values the better the forecasting accuracy.
When it is more important to evaluate the forecast errors independently of the scale of the variables, the MAPE and Theil-U are used. They are constructed to lie within [0,1], zero indicating a perfect fit.
The study used rates of return. Mehta 1995 suggests the use of first difference as a way to generate data sets for neural networks.
CONCLUSION
in order to use a NNR model we need to process the time series to a stable non moving series and arrange the input of the network based on the activation function available to the network. Everything else about the NNR remains the same, the regular network parameters should be tested via trial and error to find the best number of hidden nodes or hidden layers.
Wednesday, August 22, 2012
Saturday, August 11, 2012
Online Trading Academy DVD- Professional Trader Summary
EPS. EPS of a company is measured against its industry, if its lower than the industry EPS then its undervalued. if its higher then its overpriced
http://biz.yahoo.com/p/industries.html
the higher the spread the more the volatility and much more risky
concentrate with a spread of 0.5
buy low, sell high
buy near support, sell near resistant
everything known or knowable is reflect in its price and volume 60 to 80% correlation
there is no real tool just a series of tools
intraday (5 min, 3 min, 1 min, tick)
Daily (1 year, 180, 90, 60 days)
Weekly/monthly (long term-decade charts)
what chart to use in a situation?
OpenHighLowClose (OHLC)
Close most important. determines who won
trend line at 67% is as much as you can go. slope of the line
double top- upward trend just before the second top you will see longer candles and trend changes after
be a defensive trader.
when you see the gap on a weenkend. wait 1 hour to see if there are any changes before trading.a gap down fills up 32% from the closing on friday.
if after gap down, within the house if you see goes up at 60% of the original price, the 60% chnage will close higher
while below 32% might close lower than the opening 70% of the time the percentage is based on fibonnacci
scalping-timeframe is seconds to minutes (need level 2)
very quick when you have alot of tickets.
objective is not to loose, if you do, loose very little
speed is everything-high cost of commissions-high buy power or many trades.
3 rewards to 1 risk
you need to have alot of cash because 100 shares is not worth it. you do 1000 plus shares
momentum trade.immediate momentum swing (need level 2)get out when you can not when you have to.
1 to 10 minute trader
if momentum is slow : GET OUT
swing trade: based on technical analysis. 10 minutes to 2 weeks(2 to 3 days to develop)
look for distinct trend or pattern trade and stick with it
position trader: weeks to months. uses technical anaylsis, stop loss at support lines. Larger risk.
alert to major changes in the market.ties up capital for long periods.
buy on a winner. if you want to buy 1000 stocks of a certain sector, try to find the top dog in an industry. 300 share of microsoft, 300 share of apple, 300 share of quest technology,which ever goes down the most, sell and buy on the one that goes up the most. when left with 2, sell the loss and add to the winner.
dont play mind games, STICK to your PLAN.maintain accuntability.
have an overall strategy (FUNDING, initial capital)
have an each trading day strategy. (think of loss and win on trading)
dont focus on the money, focus on the trade.
if you trade with less than 50% probability, your a fool. anything less, your a gambler.
dont count your chips when your sitting at the table. do that after your out of the game.
discipline is knowing you will follow your rules.
be consistent and repeatability. dont try to do home runs. if you can be profitable with a very small amount its only a matter of volume.
review your plan every day, dont change during trading.
if the plan of trading doesnt work a couple of times, then change or tweek it.
create a worksheet, when did you buy,what did you buy, why did you buy, what prices are there,what stop signs did you put, what is the profit margin.
your in and out according to rule, not anything else.Investors Business Daily.(Check this as a NEWS, they tell you why they think it
will go up through analytical technique. "PAY")
learn from the loosers.very important to learn if you loose, you cant always
win.
85-85-B-B-B is a rating.
85-85:EPS and Relative price strength rating is better than 85% its highly good.
1 - 99 pecrcent rating
B-B-B:Industry Relative price strength rating - sales+profit+return equity -
Accumulation distribution rating
"A" Best to "E" worst
SmartMoney.com - shows you the lead dog
Avg Volume: Average Daily Volume
Share outstanding??
beta - measure the volatilty relative to S&P(1.5 means 50% more)
PPG - price to earning to growth
open up the definitions if you dont answer in the website.
insider trading- legal stuff--shows you the buyer and sellers that are director.big stock move
play with real stocks.dont go for small penny.100$ buys alot of small
stocks.Price 15$-80$
pick the stock with an average volume of 1Million
average trading range:atleast 1$ movement but less that 8%
go to the industy you know about. so when you see the news you know whats going on.
to loose professionaly:
analyze, once you open a trade, only do risk management
be systematic, do not let your emotions change your trading behavior. follow plan and rules.
if there is a significant spread from the buying and selling(Buy:30 - Sell 35).
we sell short at 35 and buy at 30. we gain 5$. we should look at the number of stocks available also.
bid=buy
ask=offer=sell
Take the offer (lift the offer from ask) = Hit the Bid(selling to willing buyer)
demand=support=buyer=bid
supply=resistance=seller=ask
In Level 2
GO short if the number of sell is higher than buy
Go Long if the number of buyer is higher than seller
Look at the economy,then the market then the sector then the stock.
if economy is high, then market is good, and a sector will boom so the stocks should look good.
Know your tool and how to use it.(trading execution)
a float is whats left of the stock. big names always have floats. so you cant
short if the float is low.you cant short if your brokerage doesnt have inventory in a bull market things go down twice as much is it goes up. sell short in a bull market when its up incase it does down.
you can only short on an upstick waiting costs money.sell if you have stocks
10 laws of day trading:
Use Small Shares (dont take large risks until you build a buffer)
When in doubt, get out! (if it doesnt behave like expected, GET OUT)
Learn the difference between gambling and day trading (no overnites)
Dont add to losers(average UP, add to winning position)
dont overtrade (trade more only as you get experience and only if winning,not opposite)9-11.215-330/time
You must use stop loss points
Have a daily limit loss ( 1 to 2% risk capital) capital 25000$ = 250$-500$ limit
be logical not emotional ( control your temper)
dont trade if there are computer problems or slow quotes from the market
be disciplined (hearing is one thing,doing is something else)
OLD KOREAN TRADING PRINCIPLE
Dont lose money, if you do lose money, lose very little money
Labels:
DVD,
online trading academy,
Professional Series,
Summary DVD
Monday, August 6, 2012
Summary Book 1 - Chapter 6: Optimizing Parameters and Filtering Trading Signals
Quantitative trading strategies harnessing the power of quantitative techniques to create a winning trading program:
Optimization allows the trader to fine tune a strategy. however many believe fitting strategies to past data yields unrealistic expectations.
parameters are tweaked once a successful strategy is found. ex. Length of the moving average, the volatility multiplier.
to simplify the number of parameters we can use more than one unit per test. for example increment by five insread of one.
optimization is a technique to maximize the expected value of a trading strategy.
The first would use parameters for the current period that had performed best in the prior period. The idea behind this strategy is that strings of past performance are likely to continue, and that as traders we want to stay with parameter sets that are performing the best. The second test selected parameter sets for the current period that performed the worst in the prior period. The idea behind this strategy is that performance is likely to mean revert over time. Parameter sets that have been “cold” and performing poorly are likely to revert and perform well in the future.
avoid trend-following signals when futures are caught in trading ranges but to take trend-following signals when stocks are in trading ranges.
based on the ADX indicator we can select a specific strategy
ADX<15 RSI osscillator
ADX>25 Channel Breakout
Positive autocorrelation exists when greater than average values tend to lead to greater than average values in the next period, and vice versa. Negative autocorrelation exists when greater than average values lead to less than average values.
markets trend roughly 60 percent of the time. The fact that the average falls greater than 50 percent suggests that markets do in fact trend, and we can apply trend-following strategies to exploit this inefficiency.
Optimization allows the trader to fine tune a strategy. however many believe fitting strategies to past data yields unrealistic expectations.
parameters are tweaked once a successful strategy is found. ex. Length of the moving average, the volatility multiplier.
to simplify the number of parameters we can use more than one unit per test. for example increment by five insread of one.
optimization is a technique to maximize the expected value of a trading strategy.
The first would use parameters for the current period that had performed best in the prior period. The idea behind this strategy is that strings of past performance are likely to continue, and that as traders we want to stay with parameter sets that are performing the best. The second test selected parameter sets for the current period that performed the worst in the prior period. The idea behind this strategy is that performance is likely to mean revert over time. Parameter sets that have been “cold” and performing poorly are likely to revert and perform well in the future.
avoid trend-following signals when futures are caught in trading ranges but to take trend-following signals when stocks are in trading ranges.
based on the ADX indicator we can select a specific strategy
ADX<15 RSI osscillator
ADX>25 Channel Breakout
Positive autocorrelation exists when greater than average values tend to lead to greater than average values in the next period, and vice versa. Negative autocorrelation exists when greater than average values lead to less than average values.
markets trend roughly 60 percent of the time. The fact that the average falls greater than 50 percent suggests that markets do in fact trend, and we can apply trend-following strategies to exploit this inefficiency.
Summary Book 1 - Chapter 5 - Performance of Portfolios
Quantitative trading strategies harnessing the power of quantitative techniques to create a winning trading program:
DON’T PUT ALL YOUR EGGS IN ONE BASKET
Employed by Casino and betting houses for thousands of years.
diversification is spreading your money in a variety of investments.its a risk management strategy
goal help protect the overall value of the portfolio against loss.
Investment that gain value could potentially compensate for those that lose value.
NOTE: diversification only helps when combining non-correlated returns.
Diversification is based on mathematical principles—its advantages are not subject to debate.
Several Diversification Strategies:
Trade ACROSS MARKETS
Oil, Forex, Sugar Market
Trade ACROSS UNCORRELATED STRATEGIES
Moving Average, Channel Breakout
Trade ACROSS PARAMETERS WITHIN STRATEGIES
20/40 of Channel breakout and 40/80 of channel breakout
There is not holy grail. because performance DECAYs over time to zero profitability.
DON’T PUT ALL YOUR EGGS IN ONE BASKET
Employed by Casino and betting houses for thousands of years.
diversification is spreading your money in a variety of investments.its a risk management strategy
goal help protect the overall value of the portfolio against loss.
Investment that gain value could potentially compensate for those that lose value.
NOTE: diversification only helps when combining non-correlated returns.
Diversification is based on mathematical principles—its advantages are not subject to debate.
Several Diversification Strategies:
Trade ACROSS MARKETS
Oil, Forex, Sugar Market
Trade ACROSS UNCORRELATED STRATEGIES
Moving Average, Channel Breakout
Trade ACROSS PARAMETERS WITHIN STRATEGIES
20/40 of Channel breakout and 40/80 of channel breakout
There is not holy grail. because performance DECAYs over time to zero profitability.
Saturday, July 28, 2012
Summary Book 1 - Chapter 4 Evaluating Trading Strategy Performance
Quantitative trading strategies harnessing the power of quantitative techniques to create a winning trading program:
Poppers theory focuses on the growth of human knowledge and the methods used in making new discoveries.
never accept that a strategy is going to be profitable.
assume the strategy is profitable until a better strategy is found or a there is a problem with it in historical data and performance.
a trading theory may change and not hold accross time. no strategy will continue to be profitable forever.
Flaws in current performance measures of a trading strategy:
Net Profit- widely quoted performance statistics. it is the dollar profit earned or lost during the life of the back-test.
maximize return per unit of risk.
Note:Absolute returns are not important as they do not measure the risk involved such as volatility of the stock,standard deviation of the price.
Profit factor- calculated by dividing the total profit gained on winning trades by the total loss on losing trades.
profitable strategy factor will be greater than one. unprofitable strategy will be less than one.
Gross Profit +1750
Gross Loss -1500
1750/1500 = profit factor of 1.17
profit to drawdown- ratio of net profit to maximum drawdown.
a drawdown occurs when net profit falls from its highest point.
calculated each trading day with the maxium value being the maximum drawdown.
deviding net profit by maximum drawback is a measure of reward to risk.
Riskier strategies have larger maximum drawdowns.
the problem with this is: this method net profit does not increase linearly with time.
profit to drawdown ration varies depending on the length of time in the test.
One of my requirements for performance measures is the ability to compare various strategies regardless of the time frame studied.
Percent of profitable trades- used to gauge strategy success. the number of winning trades divided by the total number of trades in the back-test.
BETTER PERFORMANCE MEASURE
KRatio and sharpe ration, measures compare reward to risk in order to assess strategy performance.
Sharp Ratio:
if return is widely dispersed with large and winner and loser,its a risky trade because of the high standard deviation.
if returns are wrapped around the mean, the strategy has a smaller standard deviation and is less risky.
Sharpe ratio = Average return / Standard deviation of returns * Scaling factor
the scaling factor is the square root of time periods in a year.
when testing a strategy calculate the sharpe ratio and focus on finding strategies that produce sharpe ratios greater than positive one.
the sharpe ratio is its flaws. so to compliment it we use the K-ratio.
instead of looing at returns irrespective of when they occur, the Kratio calculates performance based on the stability of the equity curve.
first we need to create an equity curve to calculate K-ratio (graph of cumulative profits over time)
equity curve should increase linearly with respect to time.
if risk is constant thoughtout the life of the test, no adjustments need to be made to the equity curve.
start by calculating a linear regression (best fit line that minimizes the square error between forecast and actual) of the equity curve.
b1 in the equity curve is the proxy for reward in the k-ratio.
equity cruve i = b0 + b1 . trend i
risk in k-ratio is measured by calculating the standard error of the b1 regression coefficient.
large standard error indicates slope of the equity curve is inconsistent over time. small errors indicate consistent equity curve.
![]() |
| calculating K-Ratio in Excel |
The K-ratio is calculated by dividing the b1 estimate by both the standard error of b1 and the number of periods in the performance test. By dividing by the number of data points, we normalize the K-ratio to be consistent regardless of the periodicity used to calculate its components.
K-ratio is a unitless measure of performance, Weekly performance of corn futures can be compared with tick data performance of trading IBM.
The Sharpe and K-Ratio are measures of trading strategy performance.
COMPARISON OF BENCHMARK STRATEGIES
the following 2 are benchmark strategies.
Channel breakout-trend following method
Enter long if today’s close is the highest close of the past 40 days.
Exit long if today’s close is the lowest close of the past 20 days.
Enter short if today’s close is the lowest close of the past 40 days.
Exit short if today’s close is the highest close of the past 20 days.
moving average crossover-trend following method
Enter long if the 10-day simple moving average of closes crosses above the 40-day simple moving
average of closes.
Enter short if the 10-day simple moving average of closes crosses below the 40-day simple moving
average of closes.
we calculate the K-Ratio and sharpe ratio of the channel breakout and moving average crossover over a portfolio of markets.
always trade with the trend.trend following is profitable as shown by history.
a strategy may decline through the days, meaning the average of returns may reduce every year for a
certain strategy.
Equity Curve and Regression Band Forecast. We can forecast equity growth using past data. If equity
falls below the lower band, we must reevaluate the potential of the strategy.
any strategy that performs badly can always be reversed to generate profit. simply by doing the opposite. sell when the signal is a buy, buy when the signal is a sell.
Some trading strategies may produce profits due solely to an overall rising or falling underlying market.
sometimes a strategy may work because of the markets uptrend. in order to remove the bias of the markets up direction we use the following formula:
return strategy = b0 + b1 return market + b2 returnmarket^2 + epsilon
if the t-statistics is less than +1 then chances are its performing due to markets runup or decline.
if t-statistics is greater than one, then strategy is valid and not biased
Magical thinking: people think that their behaviour causes something to happen while its another power that is making it happen. just because a strategy worked a few times in history doesnt mean it will work again.
Labels:
Aresh saharkhiz,
book summary,
Chapter 4,
K-Ratio,
Quantitative trading strategies,
Sharpe Ratio
Wednesday, July 25, 2012
Summary Book 1 - Chapter 3 Creating Trading Strategies
Quantitative trading strategies harnessing the power of quantitative techniques to create a winning trading program:
3 building blocks for a trading system
1. Enteries - signals of buy and sell
2. Exits - indicate expected value of a trade has diminished to the point that the trade should be closed.
3. Filters - persuade the trader to only take entries with highest expected profits over the life of the system
Trend-following technique - buy signal while the market is in a period of strength.
sell signals are during period of weakness.
Moving average-the mean of a time series updated each trading day.
Most common moving averages are:Simple,Weighted, Exponential.
The simple moving average is an average of values recalculated every day.
Sum the previous days closing value and devide by the number of days.
Exponential moving average is calculated using todays price and yesterdays moving average value.alpha is the smoothing factor which is 2 devided by the number of days plus 1.
A weighted moving average assigns higher weights to more recent data.
Trading signals are triggered when the price of a stock goes above the moving average, higher prices are likely and it signals that its time to buy.
When prices cross below the moving average, a declining market is expected and its time to sell.
a moving average of 20 to 100 days are commonly used to generate buy and sell signals. shorter moving averages will respond quicker to recent price movement.
longer moving averages produce trading signals infrequently.
when combining moving average methods such as exponential and simple, 10 and 40 days are used to generate signals.
if a market is prone to short and violent moves with many reversals along the way, moving average systems are likely to suffer. this drawback is called a whipsaw, asociated with choppy market action.
Channel breakout;
channels created when plotting a running tally of the highest highs and lowest lows over a fixed interval of days.
in a 40 day channel breakout: buy if market close was the highest of the past 40 days.
sell when the market close lower than any other close of the past 40 days.
A surge above the upper channel line shows extraordinary strength that can signal the start of an uptrend. Conversely, a plunge below the lower channel line shows serious weakness that can signal the start of a downtrend
Momentum-
take the difference between one value and another value at some point in time.
Momentum = Value Today - Value X days ago
Buy when todays close is greater than the close x days ago
Sell when todays close is less than the close x days ago
Volatility breakouts-
large short-term price jumps tend to be precursors of further movement in the same direction.
it is comprised of 3 pieces:
1. reference value - measurement price of the move from the start
2. volatility measure - computes the typical valatility of the market to separate significant movement from random price changes
3. volatility multiplier - determines the sensitivity of price movement required to trigger entry signals.
buy when prices close above the upper trigger.
sell when prices close below the lower trigger.
the most logical valatility measure is to calculate a standard deviation of price returns.
another volatility measure is to calculate the average true range.
1. the largest value of todays high minus todays low
2. largest value of todays high minus yesterdays close
3. largest value of yesterdays close minus todays low
Excel Sheet showing how to calculate the 14 day Average True Range
average the true range over a set number of days to calculate ATR (average true range)
another volatility measure is the standard deviation of market prices.
this method does not allow strict interpretation using the normal distribution.
Volatility breakout entry points are derived by multiplying the volatility multiplier
by the volatility measure and adding that value to the reference value.
Volatility Breakout Rules
-Upper trigger = Reference Value (yesterday’s close, today’s open, short-term moving average) plus the Volatility Multiplier times Volatility Measure (standard deviation of price returns, average true range, standard deviation of
price). Buy when today’s close is greater than the upper trigger.
-Lower trigger = Reference Value (yesterday’s close, today’s open, short-term moving average) plus the Volatility Multiplier times Volatility Measure (standard deviation of price returns, average true range, standard deviation of
price). Sell when today’s close is less than the lower trigger
When a trend has become overextended or exhausted we define the technique as an Oscillator.
Sell signals are given using range statistics to explain that prices have risen too high and buy signals when prices are too low.
the premise behind standard oscillators is that once prices move to levels far from average, a reversal is eminent.
one method is the Relative strength index(RSI is the most popular). a market top is completed when the indicator rises above 70, while bottoms when fall below 30.
RSI sums the price changes of up days and compares them with the price changes of down days to calculate the RSI value.
RSI = 100 - ( 100 / ( 1+ (U/D) ) )
U is the average of all up moves
D is the average of all down moves
NOTE: The Relative Strength Index (RSI) rises and falls between 0 and 100
a stochastic oscillator compares current prices to the high and low range over a look-back period.
Traditional settings use 80 as the overbought threshold and 20 as the oversold threshold
Fast %K stochastic is a smoothed out raw %K using a 3 day moving average
The fast %D stochastic is the smoothed out of the fast %K stochastic using another 3 day moving average.
the Raw %K stochastics = (Todays Close - Lowest low) / (Highest High - lowest low)
The moving average Convergence/Divergence (MACD) is an oscillator created by taking the difference between two exponential
averages.
1. a 12 day exponential weighted average with alpha=0.15
2. a 26 day exponential moving average with alpha=0.075
MACD = 12 Day EMA of close - 26 day EMA of close
MACD signal = 9 Day EMA of MACD
a popular patter of prices
SELL - Key reversal sell
todays high > yesterdays high
todays close < yesterdays close
BUY-key reversal buy
Todays Low < yesterdays low
Todays close > yesterdays close
signals that close profitable trades are called EXITS
signals that close unprofitable trades are called "STOPS"
Profit Targets close profitable
trades using range statistics.if we buy IBM at 100$ and the average true range of the past 20 days above the entry price of 100$ is 2$ then we sell at
100$ + (3)(2$) = 106$ we sell at 106$
A trailing exit has many examples to lock in profit before trade turns.
exit when market makes a 5 day low.
exit when market closes below previous pivot point
a pivot point is created when one days low is lower than both the
previous and following days low. (V Shape)
2 days before and 2 days after. or
3 days before and 3 days after.
LOSING IS A PART OF ALL TRADING (page 94 fail-safe exits)
FAIL SAFE EXIT
the trade goes against you by an amount equal to 2 times the average true range of the past 20 days.
if we buy IBM at 100$ and the average true range is 1.5$ we sell if 100 - (2*1.5$) = 97$ to minimize losses.
filters are used to either give a green light to trade or a red light that overrides buy and sell signal.
Trend filters:
Average directional movement index (ADX)
Vertical Horizontal Filter (VHF)
A typical use of a filter is to only take signals when values of these filters are greater than some threshold.
OUTSIDE BOOK SCOPE:
ADX is used to determine the direction and strength of a trend.
1. Calculate the True Range (TR), Plus Directional Movement (+DM) and Minus Directional Movement (-DM) for each period.
2. Smooth these periodic values using the Wilder's smoothing techniques. These are explained in detail in the next section.
3. Divide the 14-day smoothed Plus Directional Movement (+DM) by the 14-day smoothed True Range to find the 14-day Plus Directional Indicator (+DI14). Multiply by 100 to move the decimal point two places. This +DI14 is the Plus Directional Indicator (green line) that is plotted along with ADX.
4. Divide the 14-day smoothed Minus Directional Movement (-DM) by the 14-day smoothed True Range to find the 14-day Minus Directional Indicator (-DI14). Multiply by 100 to move the decimal point two places. This -DI14 is the Minus Directional Indicator (red line) that is plotted along with ADX.
5. The Directional Movement Index (DX) equals the absolute value of +DI14 less - DI14 divided by the sum of +DI14 and - DI14.
6. After all these steps, it is time to calculate the Average Directional Index (ADX). The first ADX value is simply a 14-day average of DX. Subsequent ADX values are smoothed by multiplying the previous 14-day ADX value by 13, adding the most recent DX value and dividing this total by 14.
strong trend is present when ADX is above 25 and no trend is present when below 20.
3 building blocks for a trading system
1. Enteries - signals of buy and sell
2. Exits - indicate expected value of a trade has diminished to the point that the trade should be closed.
3. Filters - persuade the trader to only take entries with highest expected profits over the life of the system
Trend-following technique - buy signal while the market is in a period of strength.
sell signals are during period of weakness.
Moving average-the mean of a time series updated each trading day.
Most common moving averages are:Simple,Weighted, Exponential.
The simple moving average is an average of values recalculated every day.
Sum the previous days closing value and devide by the number of days.
Exponential moving average is calculated using todays price and yesterdays moving average value.alpha is the smoothing factor which is 2 devided by the number of days plus 1.
![]() |
| Sample Computation on EXCEL |
A weighted moving average assigns higher weights to more recent data.
Trading signals are triggered when the price of a stock goes above the moving average, higher prices are likely and it signals that its time to buy.
When prices cross below the moving average, a declining market is expected and its time to sell.
a moving average of 20 to 100 days are commonly used to generate buy and sell signals. shorter moving averages will respond quicker to recent price movement.
longer moving averages produce trading signals infrequently.
when combining moving average methods such as exponential and simple, 10 and 40 days are used to generate signals.
if a market is prone to short and violent moves with many reversals along the way, moving average systems are likely to suffer. this drawback is called a whipsaw, asociated with choppy market action.
Channel breakout;
channels created when plotting a running tally of the highest highs and lowest lows over a fixed interval of days.
in a 40 day channel breakout: buy if market close was the highest of the past 40 days.
sell when the market close lower than any other close of the past 40 days.
A surge above the upper channel line shows extraordinary strength that can signal the start of an uptrend. Conversely, a plunge below the lower channel line shows serious weakness that can signal the start of a downtrend
Momentum-
take the difference between one value and another value at some point in time.
Momentum = Value Today - Value X days ago
Buy when todays close is greater than the close x days ago
Sell when todays close is less than the close x days ago
Volatility breakouts-
large short-term price jumps tend to be precursors of further movement in the same direction.
it is comprised of 3 pieces:
1. reference value - measurement price of the move from the start
2. volatility measure - computes the typical valatility of the market to separate significant movement from random price changes
3. volatility multiplier - determines the sensitivity of price movement required to trigger entry signals.
buy when prices close above the upper trigger.
sell when prices close below the lower trigger.
the most logical valatility measure is to calculate a standard deviation of price returns.
another volatility measure is to calculate the average true range.
1. the largest value of todays high minus todays low
2. largest value of todays high minus yesterdays close
3. largest value of yesterdays close minus todays low
Excel Sheet showing how to calculate the 14 day Average True Range
average the true range over a set number of days to calculate ATR (average true range)
another volatility measure is the standard deviation of market prices.
this method does not allow strict interpretation using the normal distribution.
Volatility breakout entry points are derived by multiplying the volatility multiplier
by the volatility measure and adding that value to the reference value.
Volatility Breakout Rules
-Upper trigger = Reference Value (yesterday’s close, today’s open, short-term moving average) plus the Volatility Multiplier times Volatility Measure (standard deviation of price returns, average true range, standard deviation of
price). Buy when today’s close is greater than the upper trigger.
-Lower trigger = Reference Value (yesterday’s close, today’s open, short-term moving average) plus the Volatility Multiplier times Volatility Measure (standard deviation of price returns, average true range, standard deviation of
price). Sell when today’s close is less than the lower trigger
When a trend has become overextended or exhausted we define the technique as an Oscillator.
Sell signals are given using range statistics to explain that prices have risen too high and buy signals when prices are too low.
the premise behind standard oscillators is that once prices move to levels far from average, a reversal is eminent.
one method is the Relative strength index(RSI is the most popular). a market top is completed when the indicator rises above 70, while bottoms when fall below 30.
RSI sums the price changes of up days and compares them with the price changes of down days to calculate the RSI value.
RSI = 100 - ( 100 / ( 1+ (U/D) ) )
U is the average of all up moves
D is the average of all down moves
NOTE: The Relative Strength Index (RSI) rises and falls between 0 and 100
a stochastic oscillator compares current prices to the high and low range over a look-back period.
Traditional settings use 80 as the overbought threshold and 20 as the oversold threshold
![]() |
| stochastic oscillator |
Fast %K stochastic is a smoothed out raw %K using a 3 day moving average
The fast %D stochastic is the smoothed out of the fast %K stochastic using another 3 day moving average.
the Raw %K stochastics = (Todays Close - Lowest low) / (Highest High - lowest low)
The moving average Convergence/Divergence (MACD) is an oscillator created by taking the difference between two exponential
averages.
1. a 12 day exponential weighted average with alpha=0.15
2. a 26 day exponential moving average with alpha=0.075
MACD = 12 Day EMA of close - 26 day EMA of close
MACD signal = 9 Day EMA of MACD
a popular patter of prices
SELL - Key reversal sell
todays high > yesterdays high
todays close < yesterdays close
BUY-key reversal buy
Todays Low < yesterdays low
Todays close > yesterdays close
signals that close profitable trades are called EXITS
signals that close unprofitable trades are called "STOPS"
Profit Targets close profitable
trades using range statistics.if we buy IBM at 100$ and the average true range of the past 20 days above the entry price of 100$ is 2$ then we sell at
100$ + (3)(2$) = 106$ we sell at 106$
A trailing exit has many examples to lock in profit before trade turns.
exit when market makes a 5 day low.
exit when market closes below previous pivot point
a pivot point is created when one days low is lower than both the
previous and following days low. (V Shape)
2 days before and 2 days after. or
3 days before and 3 days after.
LOSING IS A PART OF ALL TRADING (page 94 fail-safe exits)
FAIL SAFE EXIT
the trade goes against you by an amount equal to 2 times the average true range of the past 20 days.
if we buy IBM at 100$ and the average true range is 1.5$ we sell if 100 - (2*1.5$) = 97$ to minimize losses.
filters are used to either give a green light to trade or a red light that overrides buy and sell signal.
Trend filters:
Average directional movement index (ADX)
Vertical Horizontal Filter (VHF)
A typical use of a filter is to only take signals when values of these filters are greater than some threshold.
OUTSIDE BOOK SCOPE:
ADX is used to determine the direction and strength of a trend.
1. Calculate the True Range (TR), Plus Directional Movement (+DM) and Minus Directional Movement (-DM) for each period.
2. Smooth these periodic values using the Wilder's smoothing techniques. These are explained in detail in the next section.
3. Divide the 14-day smoothed Plus Directional Movement (+DM) by the 14-day smoothed True Range to find the 14-day Plus Directional Indicator (+DI14). Multiply by 100 to move the decimal point two places. This +DI14 is the Plus Directional Indicator (green line) that is plotted along with ADX.
4. Divide the 14-day smoothed Minus Directional Movement (-DM) by the 14-day smoothed True Range to find the 14-day Minus Directional Indicator (-DI14). Multiply by 100 to move the decimal point two places. This -DI14 is the Minus Directional Indicator (red line) that is plotted along with ADX.
5. The Directional Movement Index (DX) equals the absolute value of +DI14 less - DI14 divided by the sum of +DI14 and - DI14.
6. After all these steps, it is time to calculate the Average Directional Index (ADX). The first ADX value is simply a 14-day average of DX. Subsequent ADX values are smoothed by multiplying the previous 14-day ADX value by 13, adding the most recent DX value and dividing this total by 14.
strong trend is present when ADX is above 25 and no trend is present when below 20.
- Theory: Large moves are a result of new information entering the markets.This information may not be immediately digested by all market participants.
- Trading rule: Buy when today’s price change is greater than two standard deviations of the 20-day standard deviation of price changes.
- Formulate a theory
- Create an experiment
- draw conclusion
"I learned that following a detailed trading plan based
on sound historical results is the only way to trade effectively. And oh yeah, make
sure you’re awake and sober when placing your trades."
Labels:
Aresh saharkhiz,
chart pattern,
Quantitative trading strategies,
summary,
terms,
trading strategies
Summary Book 2 - Chart Patterns (Chapter 2)
For Up Trendlines
3 points on a trendline is valid.
draw the trendline along two minor lows in a forming price to see where the 3rd point may be.
a trendline starting with two close touches may not hold up in the longer term.
two points spaced too far apart may not have much value.
On average, trendlines with touches spaced widely apart perform better than those spaced close together.
on average long trendlines perform better than short ones
increasing the volume of stock as the trend continues is a good sign.
a breakout occurs when prices close below the trendline.
a high volume downward breakout propels prices further.
a plunge is a price trend that shows little price overlap from day to day leading to, but not including the breakout day.
INCOMPLETE
3 points on a trendline is valid.
draw the trendline along two minor lows in a forming price to see where the 3rd point may be.
a trendline starting with two close touches may not hold up in the longer term.
two points spaced too far apart may not have much value.
On average, trendlines with touches spaced widely apart perform better than those spaced close together.
on average long trendlines perform better than short ones
increasing the volume of stock as the trend continues is a good sign.
a breakout occurs when prices close below the trendline.
a high volume downward breakout propels prices further.
a plunge is a price trend that shows little price overlap from day to day leading to, but not including the breakout day.
INCOMPLETE
Subscribe to:
Posts (Atom)





