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; Originally Posted by hitesh Thanks for the afl. I don't know why but visual effect ...


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

Notices


Advertise Here

Reply
 
Thread Tools
Sponsored Links
  #11  
Old 9th February 2007, 11:07 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 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.
I enclose following
1) sample chart.
2) compo macd test rev2
In my chart I have used this formula. Instead of ema's, I have used ma's. Jose also has used ma's.
Also, instead of 200ma of emacomp, I have used 200ma of pkvaltrvalavg field. This gives middle line better. In the charts enclosed by you, look is different ---may be due to lot of price variation?. Please check on ntpc chart. Look may be similar to as posted by you earlier.
Regards
Attached Images
File Type: png Chart.png (14.5 KB, 79 views)
Attached Files
File Type: txt Compo MACD test rev2.txt (1.1 KB, 53 views)

Last edited by kgsirasangi; 10th February 2007 at 06:37 AM.
Reply With Quote
  #12  
Old 11th February 2007, 02:57 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 a lot.

In the chart forwarded by you, it gives perfect reading. But when I copy formula and plot into chart it gives different effect.

I am attaching chart of VSNL (3 minutes), the chart of same scrip attahced by you.

In the chart forwarded by you, these three lines never meets each other, whereas in this case, there is a overlapping.

May I request you to forward me the formula you are using as it is?

Regards.
Attached Images
File Type: png vsnl.png (16.5 KB, 55 views)

Last edited by hitesh; 11th February 2007 at 03:08 PM.
Reply With Quote
  #13  
Old 11th February 2007, 06:01 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

hitesh,
1) your present afl is ok, but it needs to be modified as follows.
2) In my afl formula, I have given colorwhite for following (to make them invisible)
Plot(pkval ,"pkval",colorWhite) ;
Plot(trval ,"trval",colorWhite) ;
Plot(pkvaltrvalavg ,"pkvaltrvalavg",colorWhite) ;

You have modified them as colorblack. Modify them back as colorwhite. Do
not delete them as they are required to calculate ma's as mentioned below.
With this, these fields will remain in chart but as invisible.
3) Now drag and drop three 200ma's (not ema's) in this indicator pane, one each for pkval,trval
and pkvaltrvalavg and modify their color( other than white), field, period from parameters.
as done earlier.
Now your chart will be similar to mine.

Regards

Last edited by kgsirasangi; 11th February 2007 at 06:13 PM.
Reply With Quote
  #14  
Old 12th February 2007, 09:30 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 a lot Sir,

It is coming perfectly. And visual effect is also as metastock.

I am relived. Thank you very much once again.
Regards
Reply With Quote
  #15  
Old 12th February 2007, 09:50 AM
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 a lot Sir,

It is coming perfectly. And visual effect is also as metastock.

I am relived. Thank you very much once again.
Regards
OK. Glad to know you are getting chart as desired.
Reply With Quote
  #16  
Old 12th February 2007, 02:33 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

No friends,
I cant help much. I got the following already with parameters. But I just cant understand what the hell is Cum(pkVal)/Cum(pkVal), cos it alwats gives 1...
************************
// Composite MACD
// Incorporating automatic overbought/oversold levels
// ©Copyright 2005 Jose Silva
//Modified to adapt for amibroker

Plot1 = Param("1M 2Hist", 1, 1, 2, 0.5);
Plot2 = Param("1M Hist, 2Norm", 1, 1, 2, 0.5);
pds = Param("Sig Hist EMApds", 2, 2, 260, 21);

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,pds);
hist = emaComp - s;

//MacdH = IIf(Plot1 = 1, emaComp, hist);

if (Plot1 = 1)
{
MacdH = emaComp;
}
else
if (Plot1 = 2)
{
MacdH = hist;
}
//{ Normalized MACD/Histogram }
normMod = Highest(MacdH)- Lowest(MacdH);
normMod = IIf(normMod = 0, .000001, normMod);
MacdHnorm = ((MacdH- Lowest(MacdH))/normMod-.5)*200;

//{ Choose standard/normalized }
//MacdComp = IIf(Plot2 = 1, MacdH, MacdHnorm);

if (Plot2 = 1)
{
MACDComp = MacdH;
}
else
if (Plot2 = 2)
{
MACDComp = MacdHnorm;
}

s = EMA(MacdComp,pds);
//{ MACD/Hist average }
//MACDComp0check = IsTrue(MACDComp);
//if (MACDComp0check = 1)
//{
Avg1 = Cum(MacdComp)/Cum(MacdComp);
//}
//else
//{}
//;


//{ MACD/Hist auto boundaries }
pk = Ref(MacdComp,-1)> MacdComp AND Ref(MacdComp,-1) > Ref(MacdComp,-2)
AND Ref(MacdComp,-1)> Avg1;

pkVal = ValueWhen(pk, Ref(MacdComp,-1), 1);

tr = Ref(MacdComp,-1)<MacdComp AND Ref(MacdComp,-1)<Ref(MacdComp,-2)
AND Ref(MacdComp,-1) < Avg1;

trVal = ValueWhen(tr,Ref(MacdComp,-1), 1);


pkVal0check = IsTrue(pkVal);
//if (pkVal0check = 1)
//{
Obought = Cum(pkVal)/Cum(pkVal);
//}
//else
//{};
Osold = Cum(trVal)/Cum(trVal);



//{ Plot in own window }
Plot(Obought, "overbought", colorRed);
Plot(Avg1, "Average", colorLightGrey);
Plot(Osold, "oversold", colorBlue);
p1 = IIf(Plot1 = 1, s, Avg1);
Plot(p1, "Chosen signal/average", colorGreen );
Plot(MacdComp, "MACD Composite", colorBlack);
Reply With Quote
  #17  
Old 12th February 2007, 10:07 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

biginner_av,
Thank you for your help. Presently, hitesh"s problem is solved with my afl.
Formula Obought = Cum(pkVal)/Cum(pkVal);
should be Obought = Cum(pkVal)/Cum(pk);

But cum(pkval) does not give correct value ---which I too did not understand.
Regards.
Reply With Quote
  #18  
Old 13th February 2007, 09:14 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

Dear beginner_av,,

Thank you for your help. Presently kgsirasangi has help me out to solve the problem.

In metastock, there is a term called IsDefined. The meaning of which is as follows:- Returns 1 if all data necessary to calculate the formula is available, 0 if not.

I was stucked there only.In the formula, IsDefined is used three times. For calculating MACD/Hist average, Obought and Osold. The original formula is as follows:-
Obought:=Cum(pkVal)/Cum(IsDefined(pkVal));
Osold:=Cum(trVal)/Cum(IsDefined(trVal));


In denominator, the value should be 1 or 0 depending on value available.(so far I understand)
Regards and Thanks
Hitesh
Reply With Quote
  #19  
Old 17th February 2007, 03:08 PM
Member
 
Join Date: Feb 2006
Location: jamj
Posts: 84
Thanks: 39
Thanked 9 Times in 6 Posts
casoni is on a distinguished road
Reputation: 29
Default Re: Need Help for Composite MACD

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.
.................................................. ...................
add this it will plot signals as above mentioned condition....
Buy= Cross (x ,s) AND x> MA(pkval,periods);
Sell= Cross (x ,s) AND x<MA(trval,periods);
Cover = Cross (x , MA(pkval,periods)) AND x> s ;
Short = Cross( MA(trval,periods),x) AND x<s ;

PlotShapes( shapeSmallCircle*Buy, colorBrightGreen);
PlotShapes( shapeSmallCircle*Sell, colorYellow);
PlotShapes( shapeUpArrow*Cover, colorBlue, -10 );
PlotShapes( shapeDownArrow*Short, colorRed, -10 );
Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
Cover=ExRem(Cover,Short);
Short=ExRem(Short,Cover);
..................lets hope i have done it right.....waiting for your responce...............thanks
Reply With Quote
  #20  
Old 20th February 2007, 06:03 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 a lot Mr casoni , its working fine and well.
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
Macd rahulg77 MetaStock 7 Yesterday 01:04 AM
MA vs MACD sgkalai Technical Analysis 9 7th December 2007 12:01 AM
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:29 AM.

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