Free Essay

Technical Analysis and Risk Management

In:

Submitted By yuanpei
Words 943
Pages 4
Objective:
The objective of this paper is to test whether the technical analysis indicator MACD is effective in real trading. We will use the S&P 500 Index as our samples, and our main idea is to find the average return and VaR when we buy at the time MACD shows a “golden cross” and sell at the time when there is a “death cross”.
MACD:
Before we do the test, let’s start to define the MACD as well as its components. MACD is one of the most popular indicators used in the technical analysis. And it is mainly comprised of MACD line, signal line, and the histogram. MACD line and the signal line are calculated by using the EMA (exponential moving average) function, while the histogram is the difference between the MACD line and signal line. MACD line is the difference between exponential moving averages of 12 day stock price and the exponential moving averages of 26 days stock price. The signal line is the exponential moving averages of 9 day MACD. (12, 26, 9) is the well-recognized moving average lengths used in the industry, but can be altered with other appropriate numbers.
 MACD Line = EMA [stockprice, 12] – EMA [stockprice, 26]
 Signal Line = EMA [MACD, 9]
 Histogram = MACD Line – Signal Line
In technical analysis, there is a basic rule to apply the MACD into practice, say when the MACD line up crosses the signal line, the stock price is expected to rise in the short term, while the MACD later on down crosses the signal line, the stock price may be expected to go down in short run.
So their cross points are always treated as signals to buy or sell, in which the up cross point is called “golden cross”, while the down cross is called “death cross”. Our test is to show whether MACD is helpful and how much this buy at “golden cross”, sell at “death cross” strategy can generate in real transaction.
Transaction strategy:
When the Signal Line crosses the MACD line from above, we define it as a Sell Signal. When the Signal Line crosses the MACD line from below, we define it as a Buy Signal. So when a buy signal occurs, we close our previous short position and buy 1 contract of the S&P 500 ETF. And when the sell signal occurs, we close our previous long position and sell 1 contract of the S&P 500 ETF.
Return and VaR:
We calculate 2 sets of return of our transactions. One is the transaction return. It is the return of each transaction we have made based on our transaction strategy. The other is the daily return. We ignored transaction costs in our calculation. It is the daily return during each of our transactions. In order to get a concept of the risk of this trading strategy, we also calculated the 5% VaR for both of the transaction return and the daily return. W

Code:
%retrieve data start_date = '03011950'; % a really early date will go to the first day of trading end_date = '12122012'; subject_name = '^GSPC'; subject = hist_stock_data(start_date,end_date,subject_name); sdate = subject.Date(end:-1:1); p = subject.AdjClose(end:-1:1); %calculate exponential moving average lamda=0.94; ema12=ema(p,lamda,12); ema26=ema(p,lamda,26); %define macd diff=ema12-ema26; dem=ema(diff,lamda,9); macd=diff-dem; %starting backtesting ii=0; for i=26:(length(macd)-1); a=macd(i); b=macd(i-1); if a*b0; %one transaction return for n=1:2:(l-2); m=signal(n); m1=signal(n+1); m2=signal(n+2); ret(n)=1-p(m1)/p(m); ret(n+1)=p(m2)/p(m1)-1; %daily return for u=m:m1-1; q=q+1; ret1(q)=1-p(u+1)/p(u); end for u=m1:m2-1; q=q+1; ret1(q)=p(u+1)/p(u)-1; end end ret(l-1)=1-p(signal(l))/p(signal(l-1)); for last = signal(n+2):signal(end)-1; q=q+1; ret1(q)=1-p(last+1)/p(last); end else %one transaction return for n=1:2:(l-2); m=signal(n); m1=signal(n+1); m2=signal(n+2); ret(n)=p(m1)/p(m)-1; ret(n+1)=1-p(m2)/p(m1); %daily return for u=m:m1-1; q=q+1; ret1(q)=p(u+1)/p(u)-1; end for u=m1:m2-1; q=q+1; ret1(q)=1-p(u+1)/p(u); end end ret(l-1)= p(signal(l))/p(signal(l-1))-1; for last = signal(n+2):signal(end)-1; q=q+1; ret1(last)=p(last+1)/p(last)-1; end end % identify if length() is odd or even
%if mod(l,2)==0;
% ret=[ret;lastret]; %else ret=ret;
% ret1=ret1;
%end

%total return within horizon totalret=prod((ret+1))-1 check = prod((ret1+1))-1-totalret;

%trading strategy accuracy accuracy=proportion(ret>0) %trading strategy outperformance outperformance=totalret-totalret_index %trading strategy's 1day VaR at 95% & 99%
VaR05=quantile(ret1,.05)
VaR01=quantile(ret1,.01)

%indice's 1day VaR at 95% & 99% indexVaR05=quantile(ret1_index,.05) indexVaR01=quantile(ret1_index,.01)

Results: totalret = -0.3077 accuracy = 0.4228 outperformance = -82.1771
VaR05 = -0.0146
VaR01 = -0.0263 indexVaR05 = -0.0145 indexVaR01 = -0.0259 totalret_index = 81.8694
As we can see in the result, this trading strategy is not profitable at all. The total index return during the testing period is 8187%, while the total return of our trading strategy is -30.77%.
The VaR of our trading strategy is about the same as the index VaR.

Similar Documents

Premium Essay

Very Good Dude

...RISK MANAGEMENT GUIDE FOR DOD ACQUISITION Sixth Edition (Version 1.0) [pic] AUGUST, 2006 Department of Defense Preface The Department of Defense (DoD) recognizes that risk management is critical to acquisition program success (see the Defense Acquisition Guidebook (DAG), Section 11.4). The purpose of addressing risk on programs is to help ensure program cost, schedule, and performance objectives are achieved at every stage in the life cycle and to communicate to all stakeholders the process for uncovering, determining the scope of, and managing program uncertainties. Since risk can be associated with all aspects of a program, it is important to recognize that risk identification is part of the job of everyone and not just the program manager or systems engineer. That includes the test manager, financial manager, contracting officer, logistician, and every other team member. The purpose of this guide is to assist DoD and contractor Program Managers (PMs), program offices and Integrated Product Teams (IPTs) in effectively managing program risks during the entire acquisition process, including sustainment. This guide contains baseline information and explanations for a well-structured risk management program. The management concepts and ideas presented here encourage the use of risk-based management practices and suggest a process to address program risks without prescribing specific methods or tools....

Words: 12584 - Pages: 51

Premium Essay

The Dabhol Project

...Young BUS 519 Project Risk Management May 13, 2012 Abstract This paper pertains to the Dabhol power project case regarding the risks and the causes of the risks that the project faced during this project. A Risk Breakdown Structure (RBS) was done to identify main project categories for further analysis. A Risk Breakdown Structure (RBS) includes all possible sources of risk listed as risk categories to make it easier to identify them to key stakeholders. From the RBS, a prioritized risk list was developed in order to identify those risks associated with the project that would require response plans. The methods for analyzing risks for prioritization include qualitative and quantitative risk analysis. This paper further explains quantitative and qualitative analysis. As a result of the analysis, a risk priority list was developed reflecting the top three risks from the RBS. Those top three risks are identified from the technical, management, and commercial categories of the RBS. And finally, this paper describes the nature of the three risks in addition to the significance of each one to the Dabhol project success. A Risk Breakdown Structure (RBS) includes all possible sources of risk listed as risk categories to make it easier to identify them to key stakeholders. The main categories of risks are assessed for the Dabhol project in the following RBS: RBS LEVEL 0 | RBS LEVEL 1 | RBS LEVEL 2 | 0. PROJECT RISK | 1. TECHNICAL RISKS | 1.1 Scope...

Words: 1352 - Pages: 6

Premium Essay

Wengart Aircraft

...Risk Factor Analysis— A New Qualitative Risk Management Tool John P. Kindinger, Probabilistic Risk and Hazards Analysis Group, Los Alamos National Laboratory John L. Darby, Probabilistic Risk and Hazards Analysis Group, Los Alamos National Laboratory Introduction Project risk analysis, like all risk analyses, must be implemented using a graded approach; that is, the scope and approach of the analysis must be crafted to fit the needs of the project based on the project size, the data availability, and other requirements of the project team. Los Alamos National Laboratory (LANL) has developed a systematic qualitative project risk analysis technique called the Risk Factor Analysis (RFA) method as a useful tool for early, preconceptual risk analyses, an intermediate-level approach for medium-size projects, or as a prerequisite to a more detailed quantitative project risk analysis. This paper introduces the conceptual underpinnings of the RFA technique, describes the steps involved in performing the analysis, and presents some examples of RFA applications and results. project activity flow chart to help organize the RFA. The flow chart defines the tasks to be modeled and their interrelationships for the project schedule analysis. WBS and schedule tasks may be consolidated and/or expanded to explicitly highlight those tasks and influences that are expected to have a significant technical risk and/or significant uncertainty in schedule or cost performance. The flow chart is developed...

Words: 2257 - Pages: 10

Premium Essay

Aviation

...Name Course Institution Affiliated Difference between accountability and blame Human beings possess different ways of looking at things and therefore give different ideas non similar approaches due to their divergent points of view. People find it hard on the other hand to find their counterparts accountable since of difficulties in interpersonal communication. Another danger gets into the picture as people try hard avoiding situations where they blame other people and as a solution to this they tend to avoid communicating with the affected people. (Garrett, 1967).Problem causes should be pointed out therefore, without any adore and their root causes found out. This though will take time as serious conversations will need to be held in order to make them completely aware of their accountability roles and obligations. When accountability seeks to determine the objective of a given problem, blames ignores and do not undertake to find out the root cause of some problems. Accountability will therefore, undertake to align organizational objectives with some actions such as wanting some people out of the organization due to non accountability issues. Accountability will seek avoid countermeasure decisions that blames will encourage. (Garrett, 1967). Accountability will seek to find out the actual facts through understanding of the problem at hand. It also tends to disregard the reported or second hand information and data...

Words: 1451 - Pages: 6

Premium Essay

Cmgt 430 V4 Week2

...Applying Risk Management Table of Contents 1 Introduction 2 2 Aspect 1: Risk Analysis 2 3 Aspect 2: Risk Monitoring and Control Stage 3 4 Conclusion 5 5 Reference 6 1 Introduction In our attempt to cover all areas of the Risk Management process within such a small time frame, some areas of this Project Management principal were briefly covered or overlooked. In my opinion the following two key aspects could have been better managed by our group towards the contribution of the final presentation: • Risk Analysis Stage within the Risk Management Cycle (Refer to Figure 1 and 2) and, • Risk Monitoring and Control Stage (Refer to Figure 1 and 2). 2 Aspect 1: Risk Analysis In our final video submission we specifically focused on one of the two methods used to undertake Risk Analysis, which was qualitative. The qualitative approach is the most used method due to its usually rapid and cost effective means of establishing priorities for Risk Response Planning (PMBOK,2004), thus the reason for our focus. But there are two problems with this approach first their meaning can be widely interpreted and secondly you cannot do much with them except to have biased rules about combining them and taking this as an indicator of the overall significance of the risk.(Department of Commerce, 2004) The Quantitative method is the other technique used in Risk Analysis which was only briefly mentioned in the final presentation due to reasons discussed...

Words: 1364 - Pages: 6

Premium Essay

Project Management 410

...Sizing…………………………………………………………….…………..4 Stakeholder Analysis……………………………………………………….…….…5 RBS……………………………………………………………….………………….6 Probability-Impact Matrix……………………………………….…………………7 Risk Register…………………………………………………….….………………..8 Summary Risk Report……………………………………….…….………………..10 Conclusion…………………………………………………….…………………..…11 Reference Page………………………………………………….…………………...12 Appendices……………………………………………………………………..……13 Top Risk, Actions and Owners & Probability-Impact Matrix Prepared by: Adrian Martinez, George Ogaja, and Daniel Matos Approved by: Professor Festus Elleh Introduction This document is the Risk Management Plan for the Wi-Fi Service at DFW Terminals Project, defining the risk management process to be employed throughout the life of this project. The Dallas/Ft. Worth International Airport and AT&T have joined efforts to provide free Wi-Fi services across four DFW Terminals (Terminals A through D). Customers will be able to access the complimentary Wi-Fi service by the beginning of September 2015. Dallas/Ft. Worth International Airport has contracted out its infrastructure cable built out to Real Services Inc. DFW Airport, AT&T and Real Services Inc., will plan, execute and complete the backbone cabling within the allotted time. This document has been created to assist in ensuring that the project gets completed on time. The document also contains several methodologies that will be used and implemented by the team. Several risks will be identified and will be registered...

Words: 2029 - Pages: 9

Premium Essay

Nt1330 Unit 3 Assignment 1

...1.2 PROJECT PLANNING The software project management process begins with the set of activities that are collectively called project planning. The objective of software planning is to provide a framework that enables administrator to make reasonable estimates of resources, cost and schedule. • MILESTONES AND DELIVERABLES Management needs information as software is intangible, this information can only be provided as documents that describe the state of the software being developed without this information it is impossible to judge progress and schedules cannot be updated. Milestone is an end point of the software process activity Month Starting Date Ending Date Days Project Work Milestone 1 July 1/7/2015 10/7/2015 10 Search problems...

Words: 754 - Pages: 4

Premium Essay

Risk Management

... Risk Management Plan Version My signature indicates approval of this Risk Management Plan. Prepared by: Project Manager Approved by: Project Sponsor Approved by: Agency CIO Table of Contents 1 Purpose 3 2 Risk PLanning Process 3 2.1 Risk Management Planning 3 2.2 Risk Identification Process 3 2.3 Risk Analysis 3 2.4 Risk Response Planning 3 2.5 Risk Monitor and Control 3 3 Risk Planning Detail 4 3.1 Methodology 4 3.2 Risk Roles and Responsibilities 4 3.3 Budget 5 3.4 Risk Management Activities 5 3.5 Risk Categories 6 3.6 Definitions of Risk Probability and Impact 6 3.7 Reporting 7 4 Issue Management 8 Attachment A: Department of Information Technology (DoIT) Risk Categories 9 Attachment B: Sample Risk Register 10 Revision History |Date |Version |Description |Author | | | | | | | | | | |