Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
Hi Uday
It's not quite as simple as me handing over my code because I use a proprietary DLL in a number of my Multi-Frame formulas. Here's a version that has the Forum DLL as a substitute for the MSTT DLL. The difference is that the Forum DLL cannot use partial periods in the EMAs needed to create MACD. Therefore you're stuck with an approximation using periods of 12 and 26 instead of 12.3333 and 25.6667 (which give new to old data ratios of 0.15 and 0.075 for the EMAs). If the formula below is not accurate enough then you'll need to purchase the MSTT DLL from me.
Assuming this does the trick it will initially plot MACD and Signal as lines - you'll need to convert one to a histogram by changing the the line style. To avoid having to repeat that process on every chart you should create a new default template once you've set up a chart just the way you want it. Hope this helps.
Roy
{Multi-Frame X MACD special} {Requires Equis Forum DLL} {Roy Larsen, 2009-2010, 27/7/10}
{User settings} N:=Input("Multi-Frame X MACD, Signal Periods",1,19,9); J:=Input("Hours per Frame, (1-24)",1,24,24); J:=If((J<5)+(J=8)+(Mod(J,6)=0 AND J<>18),Int(J),2)*60; Q:=Input("Mode, 0=Static 1=Dynamic 2=Delayed",0,2,1); {Update on last bar, new bar or new frame}
{Timing signals} {Day counter by metastocktools.com} D:=DayOfMonth();F:=Rnd(Life(291231)); Z:=Cum(1);D:=ValueWhen(1,Z=1,F+D)-F; D:=D*1440+Minute()+Hour()*60; I:=Int(If(J=1440,D,D-1)/J); I:=I>ValueWhen(2,1,I); G:=LastValue(Lowest(Sum(I>0,9))>7); I:=ExtFml("Forum.Sum",I,1);M:=G+I; F:=ExtFml("Forum.Sum",Ref(I,1),1)*(M=0)+G; B:=LastValue(Z);A:=B-1=Z;B:=B=Z; F:=F+B*(Q=0)*(D/J=Int(D/J))*(Mod(D,1440)>0); J:=If(F,1,(Alert(F,2)=0)*M*2*(Z>1)); J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J); J:=If(G,1,If(Q=2,M*2,J));
{Frame CLOSE} K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
{Calculate/plot MACD and signal} X:=ExtFml("Forum.Mov",K,If(J,12,Pwr(10,10)),E); Y:=ExtFml("Forum.Mov",K,If(J,26,Pwr(10,10)),E); R:=X-Y; Z:=ExtFml("Forum.Mov",R,If(J,N,Pwr(10,10)),E); R; {MACD} Z; {Signal}
|