Traderji.com - Discussion forum for Stocks Commodities & Forex

Need Help for Composite MACD

Discuss Need Help for Composite MACD at the AmiBroker within the Traderji.com - Discussion forum for Stocks Commodities & Forex; Hi Friends, Help required for AFL of MACD Composite, originally written by Mr. Jose Silva ...


Go Back   Traderji.com - Discussion forum for Stocks Commodities & Forex > TOOLS & RESOURCES > Software > AmiBroker

Notices


Advertise Here

Reply
 
Thread Tools
Sponsored Links
  #1  
Old 2nd February 2007, 06:38 PM
Member
 
Join Date: Dec 2006
Posts: 34
Thanks: 40
Thanked 14 Times in 2 Posts
hitesh is on a distinguished road
Reputation: 34
Default Need Help for Composite MACD

Hi Friends,
Help required for AFL of MACD Composite, originally written by Mr. Jose Silva for Meta Stock.I have taken permission of Mr.Jose Silva regarding the same.


Metastock formula is as under:-
====================
MACD - composite EMA
====================
-----------------------------------------------

{ MACD or Histogram based on multiple EMA's }
{ Incorporating automatic overbought/oversold
levels }
{ ©Copyright 2005 Jose Silva }
{ http://www.metastocktools.com }

{ User inputs }
plot1:=Input("[1]MACD, [2]Histogram",1,2,1);
plot2:=Input("[1]MACD/Hist, [2]Normalized",
1,2,1);
pds:=Input("Signal/Histogram EMA periods",
2,260,21);

{ Composite-EMA MACD/Histogram }
ema1:=
Mov(C,3,E)
+Mov(C,5,E)
+Mov(C,8,E)
+Mov(C,11,E)
+Mov(C,14,E)
+Mov(C,17,E);
ema2:=
Mov(C,30,E)
+Mov(C,35,E)
+Mov(C,40,E)
+Mov(C,45,E)
+Mov(C,50,E)
+Mov(C,56,E);
emaComp:=ema1-ema2;
signal:=Mov(emaComp,pds,E);
hist:=emaComp-signal;

{ Choose MACD or Histogram }
MacdH:=If(plot1=1,emaComp,hist);

{ Normalized MACD/Histogram }
normMod:=Highest(MacdH)-Lowest(MacdH);
normMod:=If(normMod=0,.000001,normMod);
MacdHnorm:=
((MacdH-Lowest(MacdH))/normMod-.5)*200;

{ Choose standard/normalized }
MacdComp:=If(plot2=1,MacdH,MacdHnorm);
signal:=Mov(MacdComp,pds,E);

{ MACD/Hist average }
avg:=Cum(MacdComp)/Cum(IsDefined(MacdComp));

{ MACD/Hist auto boundaries }
pk:=Ref(MacdComp,-1)>MacdComp
AND Ref(MacdComp,-1)>Ref(MacdComp,-2)
AND Ref(MacdComp,-1)>avg;
pkVal:=ValueWhen(1,pk,Ref(MacdComp,-1));
tr:=Ref(MacdComp,-1)<MacdComp
AND Ref(MacdComp,-1)<Ref(MacdComp,-2)
AND Ref(MacdComp,-1)<avg;
trVal:=ValueWhen(1,tr,Ref(MacdComp,-1));
Obought:=Cum(pkVal)/Cum(IsDefined(pkVal));
Osold:=Cum(trVal)/Cum(IsDefined(trVal));

{ Plot in own window }
Obought; { Red }
avg; { Grey }
Osold; { Blue }
If(plot1=1,signal,avg); { Green }
MacdComp { Black }

Formula of Metastock available at
http://www.metastocktools.com/MetaStock/MACDHcomp.txt also.

I have written part codes covering MACD and Signal in AFL as under:-

// Composite MACD
// Incorporating automatic overbought/oversold levels
// ©Copyright 2005 Jose Silva

ema1=
EMA(C,3)
+EMA(C,5)
+EMA(C,8)
+EMA(C,11)
+EMA(C,14)
+EMA(C,17);
ema2=
EMA(C,30)
+EMA(C,35)
+EMA(C,40)
+EMA(C,45)
+EMA(C,50)
+EMA(C,56);
emaComp=ema1-ema2;
s=EMA(emaComp,21);

Plot(S , "SIGNAL", colorRed);
Plot(emaComp , "emaComp", colorBlue);
Plot(0,"",colorBlack,styleLine);
---------------------------------------------------

Unable to code for overbought/oversold.

Help requested for the complete code with Overbought/sold levels.

Thanks in advance.
Hitash Pandya
Reply With Quote
  #2  
Old 3rd February 2007, 10:39 AM
Member
 
Join Date: Sep 2005
Posts: 1,100
Blog Entries: 1
Thanks: 9
Thanked 28 Times in 17 Posts
beginner_av will become famous soon enoughbeginner_av will become famous soon enough
Reputation: 110
Default Re: Need Help for Composite MACD

the best place for this is amibroker forum or purebytes....i'll definitely try it when i have time...
Reply With Quote
  #3  
Old 3rd February 2007, 12:40 PM
Member
 
Join Date: Dec 2006
Posts: 34
Thanks: 40
Thanked 14 Times in 2 Posts
hitesh is on a distinguished road
Reputation: 34
Default Re: Need Help for Composite MACD

Thank you very much Sir,

I have posted to Amibroker forum but yet not received any response. I have tried Purebyte also.

I am used to this single indicator in Metastock that feeling uncomfortable and unable to work when I don't have the same in Amibroker.

I will be greatful if you help me out.

Thank you very much once again.
Reply With Quote
  #4  
Old 4th February 2007, 06:19 PM
Member
 
Join Date: Sep 2005
Posts: 1,100
Blog Entries: 1
Thanks: 9
Thanked 28 Times in 17 Posts
beginner_av will become famous soon enoughbeginner_av will become famous soon enough
Reputation: 110
Default Re: Need Help for Composite MACD

hey can u add comments in every line explining what it does in metastock?
Reply With Quote
  #5  
Old 5th February 2007, 04:40 PM
Member
 
Join Date: Dec 2006
Posts: 34
Thanks: 40
Thanked 14 Times in 2 Posts
hitesh is on a distinguished road
Reputation: 34
Default Re: Need Help for Composite MACD

I have attached herewith file in Doc, step by step explaination.

I have tried to write afl code. I have also attahced that file in txt form.

Thanks and Regards
Attached Files
File Type: doc Composite MACD Steps.doc (37.5 KB, 90 views)
File Type: txt Compo MACD.txt (4.0 KB, 83 views)
Reply With Quote
  #6  
Old 5th February 2007, 08:10 PM
Member
 
Join Date: Jun 2004
Posts: 179
Thanks: 0
Thanked 1 Time in 1 Post
kgsirasangi is on a distinguished road
Reputation: 21
Default Re: Need Help for Composite MACD

I am also curious to know about this indicator.Can you please post chart using this indicator? Normally in
http://trader.online.pl/MSZ/!-MSZ-index-en.html
examples of indicators are given but for this indicator, example is not available.
Presuming normalisation same as stochastic, I have plotted stochastic and stochastic of macd in one pane. please check whether your indicator is similar to this. chart is enclosed
Attached Images
File Type: png Chart.png (14.7 KB, 110 views)
Reply With Quote
  #7  
Old 6th February 2007, 09:38 AM
Member
 
Join Date: Dec 2006
Posts: 34
Thanks: 40
Thanked 14 Times in 2 Posts
hitesh is on a distinguished road
Reputation: 34
Default Re: Need Help for Composite MACD

Thanks for your posting, but MACD Composite is different than the example you have send.
Pl find here attached chart showing indicator. - Thanks & Regards
Attached Images
File Type: png NTPC.png (13.8 KB, 130 views)
Reply With Quote
  #8  
Old 6th February 2007, 09:27 PM
Member
 
Join Date: Jun 2004
Posts: 179
Thanks: 0
Thanked 1 Time in 1 Post
kgsirasangi is on a distinguished road
Reputation: 21
Default Re: Need Help for Composite MACD

Quote:
Originally Posted by hitesh View Post
Thanks for your posting, but MACD Composite is different than the example you have send.
Pl find here attached chart showing indicator. - Thanks & Regards
Thanks for enclosing chart which is quite interesting.
I enclose a text file. In this I have added to your formula ---peak and trough value calculations and buy and sell arrows in the chart.
Further to this, Jose has done cumulative average of peak and trough values at any time and plotting this as historic cumulative overbought and oversold lines. I do not know how to do this.
Hope biginner_av will help us further
Regards
Attached Files
File Type: txt Compo MACD test.txt (843 Bytes, 52 views)
Reply With Quote
  #9  
Old 8th February 2007, 11:04 PM
Member
 
Join Date: Jun 2004
Posts: 179
Thanks: 0
Thanked 1 Time in 1 Post
kgsirasangi is on a distinguished road
Reputation: 21
Default Re: Need Help for Composite MACD

Quote:
Originally Posted by kgsirasangi View Post
Thanks for enclosing chart which is quite interesting.
I enclose a text file. In this I have added to your formula ---peak and trough value calculations and buy and sell arrows in the chart.
Further to this, Jose has done cumulative average of peak and trough values at any time and plotting this as historic cumulative overbought and oversold lines. I do not know how to do this.
Hope biginner_av will help us further
Regards
I enclose following :
a)compo macd test rev1.txt
b) sample chart with above formula.

In the previous formula, some errors were there. I have corrected them.
Pl note following
1)Prepare new afl file with above formula. It gives comp macd indicator.In this indicator panel, drag and drop three 200ema's ---one each for fields emacomp, pkval and trval.You have to select these with suitable colour in the parameters.
With this, you will get similar chart as in the sample.
I could not get historical averages, by formula. Hence instead of that I am using 200ema for above fields.
After using above, please enclose a chart for information. Also, pl inform how you use this indicator, for decision making for buy or sell, for information.
Regards
Attached Images
File Type: png Chart.png (13.4 KB, 93 views)
Attached Files
File Type: txt Compo MACD test rev1.txt (1,007 Bytes, 50 views)

Last edited by kgsirasangi; 8th February 2007 at 11:09 PM.
Reply With Quote
  #10  
Old 9th February 2007, 04:34 PM
Member
 
Join Date: Dec 2006
Posts: 34
Thanks: 40
Thanked 14 Times in 2 Posts
hitesh is on a distinguished road
Reputation: 34
Default Re: Need Help for Composite MACD

Thanks for the afl.
I don't know why but visual effect is not same as in Metastock.

Here is how I use the formula:-
1. Buy when MACD crosses upper most line.
2. To add to investment when:-
a. MACD violates signal line and crosses back/again and still both the lines remains above the uppermost line.
3. To sell when MACD comes below 2nd line.
4. To short when MACD comes below lower most line.
5. To add to short when:-
a. MACD crosses signal line in upwards direction and crosses back and still both the line remains below lower most lines.

Example chart attached.
Attached Images
File Type: png Bajaj Hindu_Full.png (14.9 KB, 107 views)
File Type: png Bajaj_Hindustan.png (14.6 KB, 57 views)
File Type: png Himadri.png (14.3 KB, 55 views)
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: Need Help for Composite MACD
Thread Thread Starter Forum Replies Last Post
MA vs MACD sgkalai Technical Analysis 9 7th December 2007 12:01 AM
Macd rahulg77 MetaStock 6 4th January 2007 03:16 PM
Session on MACD rajesh.sadhanala Technical Analysis 5 22nd February 2006 04:33 PM
Macd Masterchief Technical Analysis 5 31st May 2005 12:19 PM
Composite Leverage Index-beginners Must Know sh50 Risk & Money Management 0 1st October 2004 10:08 AM


All times are GMT +5.5. The time now is 03:48 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