Traderji.com - Discussion forum for Stocks Commodities & Forex

Experiments in Technical Analysis

Discuss Experiments in Technical Analysis at the Technical Analysis within the Traderji.com - Discussion forum for Stocks Commodities & Forex; Dear friends, Thanks for your views, comments and suggestions. I am sure some more will ...


Go Back   Traderji.com - Discussion forum for Stocks Commodities & Forex > METHODS & STRATEGIES > Technical Analysis

Notices

Technical Analysis Discussion of all the principles involved in technical analysis.


Advertise Here

Reply
 
Thread Tools
Sponsored Links
  #341  
Old 9th November 2006, 08:08 PM
Member
 
Join Date: Dec 2005
Location: Hyderabad
Posts: 326
Thanks: 0
Thanked 0 Times in 0 Posts
asnavale is on a distinguished road
Reputation: 29
Default Re: Experiments in Technical Analysis

Dear friends,

Thanks for your views, comments and suggestions. I am sure some more will come after you run the AFLs on different stocks and under different conditions. I am waiting for your valuable inputs.

I will try to explain some of the points already posted by different members.

First of all let me thank you, Karthik, for taking such keen interest inspite of your heavy schedule. From your post I could see that you have put your test results within an hour or two after I posted the codes. Really dedicated work by you. You appear to have run the codes very late in the night or may be early hours foregoing sleep and rest. Please take care of your health.

Quote:
Just thinking about the concept, the first impression was, it should give lots of wipsaws. But the data you have presented suggests otherwise, just shows to go how deceptive perceptions are.
Hi Sanjay, The Histogram does give lot of signals even inbetween actual crossover points. For example in Long Term_I, there are nearly 70-90 signals over a period of 440 trading days, several signals coming on consecutive days. Some of these may be even loss making. We must find a solution to eliminate them. But that can be done later after enough discussion in this forum, combining various ideas put forward by different members.

I have tried few methods to eliminate the small signals. But what happened was in many cases, an insignificant Buy signal just before a large upward movement got eliminated and there was no way of entering into the up trend. This is important especially at the end of a range bound movement. Therefore I just kept on trading with all the signals, however minute they were. This is also in line with my conditions posted earlier that all signals will be traded.

Quote:
Just a seed of a thought for the portfolio part of the experimentation, if we could incorporate stock selection based on relative strength the overall performance of the folio can be improved, we can come back to this later...
Yes we can consider this later. But I will carry out the intial portfolio test with the same stocks, but eliminate those which have insufficient data.

Quote:
Hello,

AB Code for plotting the Cross Over Histogram.

Regards
Sanjay
Thanks for the code. It appears from the code you posted that the values of p1 and p2 were changed to 13 and 9. I had posted p1=15 and p2=15. The values 15 for p1 and p2 gave slightly better results. You may try to use these values and and find out.

I had removed the histogram plotting code in order to highlight the exploration part alone. (I have a combined code which can plot and explore so that the same AFL can be used to either plot or to explore.)

Hello thetraderman, I am sorry. I have never used MS. So I cannot help you. But the members here would do that for you.

Regards and Happy trading.

-Anant
Reply With Quote
  #342  
Old 9th November 2006, 08:40 PM
Member
 
Join Date: Dec 2005
Location: Hyderabad
Posts: 326
Thanks: 0
Thanked 0 Times in 0 Posts
asnavale is on a distinguished road
Reputation: 29
Default Re: Experiments in Technical Analysis

Dear Murthy garu,

Thanks for your observations and suggestions. Let me attempt to put in my reactions.

Quote:
i fully agree with what you said that 'The delay can be upto half the period of Moving Average'. actually about a year back, i have read a very novel method to remove the delay. this is by adding (or is it by substracting?) the HALF period EMA from the normal period EMA. after reading your post, i tried to locate the reference by googling, but couldn't find. i will continue my search and post the link if i could find. by your scientific approach, this could be easily rebuilt.

the crossover method has another limitation that sometimes stocks crossover 'too often', as, inspite of the cross over, enough strength may not be there in the move and they reverse crossover in a very short period.

another way of putting the crossovers is:

buy= EMASHORT/EMALONG>1
sell= EMASHORT/EMALONG<1

if this is modified to:

buy= EMASHORT/EMALONG>1.02
sell= EMASHORT/EMALONG<0.98

this 2% (or another such small value) 'dead--band' could possibly exclude such weak crossovers. this dead-band can be optimised.

here again, sometimes, we may come across 'weak reversals'. to exclude such weak signals, we may go for the 3day EMA of that difference than the difference itself.

i am aware that my comments 2 & 3 will incorporate delays and possibly may reduce the RETURNS. but they may reduce the RISK too. these may eat away part of the benefits of the removed delay by the method hinted in my first comment.

these comments of mine are more hypothetical in nature and request your comments on these. if your time permits, you may substanciate / negate by back testing.
I would be glad to go through the article about removing lag from moving averages. We can indeed rebuild it, may be with improvements. Post the link as soon as you locate it.

There will be many cross overs especially in range bound region which are not of much use. We must try to find out ways to eliminate them. Your suggestion of using a 3-period EMA can definitely be tested and compare the returns. I would try that after I complete the present work. Meanwhile some other members also can give it a try.

It may not be out of place to refer to my answers to Sanjay, wherein I have explained the danger of eliminating small cross-overs. We have to keep this also in mind before eliminating them. Because, when a cross-over occurs we do not know whether it is a beginning of a really big move. And surely we don't want to miss it.
Quote:
Originally Posted by murthymsr View Post

not a big issue, but, if you add a column to show the date of crossover in the exploration window, it may help to know from the window itself how old is the cross-over and the most recent cross-overs.

murthymsr
The Date column in the Exploration results gives the date on which the trade is being executed. The cross-over date is the previous trading day. I think I had explained this in my earlier post under the heading 'When to Trade'.

Please keep on giving your comments and suggestions. I need them very much.

Thank you once again for your keen interest and encouragement.

Regards

-Anant
Reply With Quote
  #343  
Old 9th November 2006, 08:41 PM
Member
 
Join Date: Sep 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
thetraderman is on a distinguished road
Reputation: 20
Default Re: Experiments in Technical Analysis

Quote:
Originally Posted by asnavale View Post
Dear friends,

Thanks for your views, comments and suggestions. I am sure some more will come after you run the AFLs on different stocks and under different conditions. I am waiting for your valuable inputs.

I will try to explain some of the points already posted by different members.

First of all let me thank you, Karthik, for taking such keen interest inspite of your heavy schedule. From your post I could see that you have put your test results within an hour or two after I posted the codes. Really dedicated work by you. You appear to have run the codes very late in the night or may be early hours foregoing sleep and rest. Please take care of your health.



Hi Sanjay, The Histogram does give lot of signals even inbetween actual crossover points. For example in Long Term_I, there are nearly 70-90 signals over a period of 440 trading days, several signals coming on consecutive days. Some of these may be even loss making. We must find a solution to eliminate them. But that can be done later after enough discussion in this forum, combining various ideas put forward by different members.

I have tried few methods to eliminate the small signals. But what happened was in many cases, an insignificant Buy signal just before a large upward movement got eliminated and there was no way of entering into the up trend. This is important especially at the end of a range bound movement. Therefore I just kept on trading with all the signals, however minute they were. This is also in line with my conditions posted earlier that all signals will be traded.



Yes we can consider this later. But I will carry out the intial portfolio test with the same stocks, but eliminate those which have insufficient data.



Thanks for the code. It appears from the code you posted that the values of p1 and p2 were changed to 13 and 9. I had posted p1=15 and p2=15. The values 15 for p1 and p2 gave slightly better results. You may try to use these values and and find out.

I had removed the histogram plotting code in order to highlight the exploration part alone. (I have a combined code which can plot and explore so that the same AFL can be used to either plot or to explore.)

Hello thetraderman, I am sorry. I have never used MS. So I cannot help you. But the members here would do that for you.

Regards and Happy trading.

-Anant
Thank You Anant, but I think I figured it out. Here it is. If anyone can take a look that would be great. Also I did see amny ripshaws with this indicator especially wilh laterally moving markets. That needs to be improved before it can be used effectively.

p1:=13; {13}
p2:=9; {9}
X := Mov(C,p1,E);
Y := Mov(X,p2,E); {Signal}
D := X-Y;

Buy := Ref(D,-2)>Ref(D,-1) AND D>Ref(D,-1);
Sell:= Ref(D,-2)<Ref(D,-1) AND D<Ref(D,-1);
Bprice := If(Buy,Ref(O,1),0); {Buying Price}
Sprice := If(Sell,-Ref(O,1),0); {Selling Price}

Bprice;
Sprice;

Thanks,
TheTraderMan
Reply With Quote
  #344  
Old 9th November 2006, 08:55 PM
SGM SGM is offline
Member
 
Join Date: Aug 2005
Location: PUNE
Posts: 468
Blog Entries: 14
Thanks: 11
Thanked 32 Times in 10 Posts
SGM will become famous soon enough
Reputation: 72
Default Re: Experiments in Technical Analysis

Dear Anant

I will use the value 15 for P1 and P2 and try to chk out the diff. There is lots to assimilate and respond about your work, will take quite a bit of time.

From my limited investigations so far I am of the opinion that the original system proposed by Karthik suits me better (buying above the previous peak reduces most of the wipsaws).

But as the seniors say the most important aspect about suitability of a system has to be the temperament of the trader/investor.


Quote:
Originally Posted by murthymsr View Post
Another way of putting the crossovers is:

buy= EMASHORT/EMALONG>1
sell= EMASHORT/EMALONG<1

if this is modified to:

buy= EMASHORT/EMALONG>1.02
sell= EMASHORT/EMALONG<0.98

this 2% (or another such small value) 'dead--band' could possibly exclude such weak crossovers. this dead-band can be optimised.

here again, sometimes, we may come across 'weak reversals'. to exclude such weak signals, we may go for the 3day EMA of that difference than the difference itself.

i am aware that my comments 2 & 3 will incorporate delays and possibly may reduce the RETURNS. but they may reduce the RISK too. these may eat away part of the benefits of the removed delay by the method hinted in my first comment.
Hello Murthygaru

I have tried to incorporate the above inputs from you in an Indicator. After introducing the dead band the system gives more whipsaws, and averaging the difference (EMA of D) just delays the signal further adding to the risk rather than reducing it.

I am uploading the Indicator, plz insert it below the price chart. Just play around with the various parameter values to see the different effects.

I have also plotted the ATR value on the indicator which will be useful to try to judge the outside limits of deviations of the signal line(EMA) from the averages(EMA of EMA). This could be used as an anti-trend signal, perhaps to book partial profits

Warm Regards
Sanjay

PS: Rename the file extention from txt to afl
Attached Files
File Type: txt Murthy.txt (1.4 KB, 71 views)
Reply With Quote
  #345  
Old 11th November 2006, 09:13 AM
Member
 
Join Date: Sep 2005
Location: hyderaabd
Posts: 744
Thanks: 0
Thanked 0 Times in 0 Posts
murthymsr is on a distinguished road
Reputation: 27
Default Re: Experiments in Technical Analysis

dear sgm,

thanks for the indicator.
i will 'play' with it and post by observations; but it needs good lot of time.

murthymsr
Reply With Quote
  #346  
Old 11th November 2006, 03:11 PM
SGM SGM is offline
Member
 
Join Date: Aug 2005
Location: PUNE
Posts: 468
Blog Entries: 14
Thanks: 11
Thanked 32 Times in 10 Posts
SGM will become famous soon enough
Reputation: 72
Default Re: Experiments in Technical Analysis

Dear Anant

As suggested by you, I tried out the combination of 15 & 15 as values for p1 and p2 . It definately improves the performance.
Quote:
It appears from the code you posted that the values of p1 and p2 were changed to 13 and 9. I had posted p1=15 and p2=15. The values 15 for p1 and p2 gave slightly better results. You may try to use these values and and find out.
I tried to use the optimize feature in AB to find the performance of various pairs for P1 & P2. For every data set AB tested for about 324 combinations of P1 & P2. The following pairs gave the best performance with diff data sets.

12,20 ; 13,19 ; 14,16 ; 15,17 ; 16,16 & yes also 15,15.

It would be amazing if you have arrived at the 15,15 pair just by intuition.

There was another interesting aspect that i noticed. The values of P1, P2 can be interchanged without having much difference in the performance. For e.g. Instead of P1 = 12 and P2 = 20, we can also use P1=20 and P2 = 12.

Personally, I have chosen the values of 13, 19 for use with the Mabitus system.

Finally, I would like to thank Karthik, Murthy and Anant, for all the help I have got from your posts in this thread. It enabled me to get some insight into back testing for a trading system.

Thanks and Regards
Sanjay

Last edited by SGM; 11th November 2006 at 03:22 PM.
Reply With Quote
  #347  
Old 11th November 2006, 03:27 PM
Member
 
Join Date: Nov 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
ARUL ANTONY.J is on a distinguished road
Reputation: 20
Default Re: Experiments in Technical Analysis

hai Mr. Kumar ,
You all seem to speak Latin & Greek , for me , as I am very new to this world of trading. Please let me know what are these. Please mail me
luraselrach@*****.com.

Pl. give feedback , so that I can try to understand what are these points. Thanks in advance.
Reply With Quote
  #348  
Old 11th November 2006, 05:04 PM
Member
 
Join Date: Aug 2006
Posts: 73
Thanks: 1
Thanked 1 Time in 1 Post
anjanr is on a distinguished road
Reputation: 21
Default Re: Modified Mabitus

I think its ok if it gives whipsaws in sideways. You cann't have a single system for every mode. This indicator works well in trending mkt and you may be well off, with osc in sideways.
Anjan
Reply With Quote
  #349  
Old 11th November 2006, 07:57 PM
Member
 
Join Date: Dec 2005
Location: Hyderabad
Posts: 326
Thanks: 0
Thanked 0 Times in 0 Posts
asnavale is on a distinguished road
Reputation: 29
Default Re: Experiments in Technical Analysis

Quote:
Originally Posted by uma_k View Post
Hi,

MABIUTS-H is a very innovative and novel approach. Very scientific explanation too. Please explain the proof of Moving average delay.

***Uma***
Dear Uma,

Thank you for your appreciative words and I am glad to see your interest in learning.

I am giving the proof of moving average delay below:

For the sake of easy explanation I am oversimplifying the example. However, the steps explained here are equally applicable to real situation also.

Let us assume a share being traded at Rs. 100 and the price goes on increasing by Re. 1 every day (You can take any value you like, eg price = 300 and increase = 1.7 etc. But the values I have taken make the calculation easy). Also assume that the price increases from 100 to 110 and then starts falling by Re. 1 each day till it reaches Rs 95. Thereafter it again increases Re. 1 everyday to again reach Rs 110. This up and down continues. Let us take the first 50 days' data for our example. Let us say we want to calculate 5-day and 15-day simple moving averages and their cross over. The price data, the moving averages and their difference along with the chart are attached as a PDF file with this post. You can download the file, take a print out and follow along with the explanation here.

The 5-day moving average is simply the average of previous 5 day prices starting today. So, in our example the first four days have no moving average, 5th day onwards the values are calculated and entered against the day number. So, the first MA value is against 5th day, second value against 6th day etc. Similar is the case with 15-day moving average, the first value is against 15th day and so on. The moving average difference column starts with 15th day.

You can see from the table of values in the attached file that the price has reached the maximum value of 110 on 11th day and thereafter it is falling. But the 5-day moving average reached maximum value of 108.80 on 13th day and the 15-day MA reached its maximum value of 106.27 on 18th day. This extra time is the moving average lag. Why it happens?

When you take 5-day MA the first time you add values of day 1 to day 5. On the second occasion you add values of day 2 to day 6. In effect, you are removing the first day value and adding 6th day value. As the 6th day value is higher than 5th day value the MA increases. On 11th day you add the maximum price for the first time. On 12th day you add a value which is smaller than the maximum, but the value being removed is still smaller than this 12 th day value. So, MA continues to increase even after the Peak in price is reached. This continues till the latest value added is smaller than the value removed. This happens when the Maximum Price is in the center. As we are taking 5-days prices, the Maximum price is in the centre after half of this period i.e. 2.5 days. This makes it 11+2.5=13.5. So we see the peak in MA on 13th day. Similarly, the peak of 15-day MA appears on 11+(15/2)=11+7.5=18.5 days which is rounded to 18th day. Therefore, the MA peak lags the price peak by half of the averaging period. Similarly, the lowest value of MA lags the lowest price by the same number of days.

We have taken regularly increasing/decreasing prices in this example. In real situation this is not true. So, the actual lag will be a little different from the 'half of the averaging period'. Depending on which side of the price peak (or valley) is changing faster, the MA peak is displaced a little to the left or right. But on an average we can take this lag to be half of averaging period.

Coming to the cross-over of the two MAs we can explain it as follows. Now I have to introduce a little maths here. But it is very simple.

Let us say p1 is short term, p2 is long term. As we have seen above, the short term MA reaches peak (p1)/2 days after the price peak and the long MA reaches its peak (p2)/2 days after price peak. So the time difference between the two MA peaks is (p2)/2 - (p1)/2 which is same as (p2-p1)/2. That means Half of the difference between the two averaging periods. The cross over will occur midway between this difference. So it will be hallf of (p2-p1)/2 or equal to (p2-p1)/4. That is one-fourth of the difference between the averaging periods. In our case the MA period difference is 15-5=10 and 10/4=2.5. So the cross over is 2.5 days (or 2 to 3 days) after short MA peak. We can see from the data and graphs that this is indeed the case.

If you have understood this, then you can try to prove why the histogram peaks appear much before the cross over. I will leave it as an excercise. As the Histogram peak appears much before the cross over, I tried to use it in my MABIUTS-H strategy.

Regards

-Anant
Attached Files
File Type: pdf Moving_Avg_Delay.pdf (8.5 KB, 104 views)

Last edited by asnavale; 28th December 2007 at 09:22 PM. Reason: Forgot attachment
Reply With Quote
  #350  
Old 11th November 2006, 08:23 PM
Member
 
Join Date: Dec 2005
Location: Hyderabad
Posts: 326
Thanks: 0
Thanked 0 Times in 0 Posts
asnavale is on a distinguished road
Reputation: 29
Default Re: Experiments in Technical Analysis

Dear Sanjay,

Thanks for your test results and optimisation results. Thanks also for the words of appreciation and encouragement.

Quote:
I tried to use the optimize feature in AB to find the performance of various pairs for P1 & P2. For every data set AB tested for about 324 combinations of P1 & P2. The following pairs gave the best performance with diff data sets.

12,20 ; 13,19 ; 14,16 ; 15,17 ; 16,16 & yes also 15,15.

It would be amazing if you have arrived at the 15,15 pair just by intuition.
I did not try optimisation but it was only intuition to try 15,15 in the tests. Happy to see that it is one of the optimum values. It is also intersting to see that the sum of P1 and P2 is 30 or 32. Interesting to investigate it.

This is the reason why this forum is the place to learn. Sharing the test results will thus be put to test and better suggestions will come out to improve the strategies. I hope some more people will come out with their test results and we may finally get a solution to reducing the number of signals generated in MABIUTS-H without sacrificing much of the profits.

Quote:
There was another interesting aspect that i noticed. The values of P1, P2 can be interchanged without having much difference in the performance. For e.g. Instead of P1 = 12 and P2 = 20, we can also use P1=20 and P2 = 12.
Yes, You are right again. Interchanging P1 and P2 makes no substantial difference. It can be proved. But I will not go into those details now. Let us concentrate on improving the strategy.

Thank you once again.

Hope to get more intersting test results from you and others too.

Regards.

-Anant
Reply With Quote
Sponsored Links

Reply

Bookmarks


Advertise Here


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads for: Experiments in Technical Analysis
Thread Thread Starter Forum Replies Last Post
Technical Analysis Course snowy Technical Analysis 25 29th December 2007 10:19 PM
Technical analysis course sh50 Seminars & Tutors 18 10th June 2007 03:46 PM
Hello everybody.Technical Analysis vijay chauhan Introductions 2 30th May 2007 03:09 PM
Technical Analysis crosscurrency Forex 0 30th October 2005 11:00 PM


All times are GMT +5.5. The time now is 06:32 PM.

Indemnity, Disclaimer & Disclosure Notice:
• By visiting Traderji.com you indicate your acceptance of our Forum Rules Disclaimer & Disclosure and indemnify Traderji.com, its associates and related parties of all claims howsoever resulting from the usage of the forum.
Disclaimer: Trading or investing in stocks & commodities is a high risk activity. Any action you choose to take in the markets is totally your own responsibility. Traderji.com will not be liable for any, direct or indirect, consequential or incidental damages or loss arising out of the use of this information.
Disclosure: The information in this forum is neither an offer to sell nor solicitation to buy any of the securities mentioned herein. The writers may or may not be trading in the securities mentioned.
• All names or products mentioned are trademarks or registered trademarks of their respective owners.
General Content Disclaimer Notice:
In light of our policy of encouraging candid, open exchanges of views and the rapid distribution of information originating from many sources, Traderji.com cannot determine the accuracy of information that may be uploaded to the forum. Opinions, advice and all other information expressed by participants in discussions are those of the author. You rely on such information at your own risk. You are urged to seek professional advice for specific, individual situations and not rely solely on advice or opinions given in the discussions. Since Traderji.com is an open and free discussion forum, any comments made by members of this forum in their posts reflect their own views and not of the owner or administrator of Traderji.com. Thus the owner/administrator indemnify themselves of all claims whatsoever and will not be liable or responsible for any members comments/views in this forum Traderji.com. If you find any objectionable or offensive posts made by members of this forum which you would like to bring to our notice for removal then please Contact Us.
 


Copyright © 2001 - 2008, Traderji.com All Rights Reserved.

Recommended Websites - www.TradersEdgeIndia.com - www.TradingPicks.com - www.MasterOfTrading.com