Rank: Advanced Member
Groups: Registered, Registered Users Joined: 4/11/2012(UTC) Posts: 45
|
Below code are Weekly MACD on Daily CHart...... I want to set this code in Ribban on daily chart... I mean
if WEEKLY MACD> MACDMA,"color Green".... and WEEKLY MACD< MACDMA," color RAD".....
please do the needful... thank you in advance.... _________________________________________________________________
{ Weekly Close MACD/Signal/Histogram v3.0 } { For daily/intraday charts } { Requires "Week's true Start & End" indicator } { ©Copyright 2002~2005 Jose Silva The grant of this license is for personal use only - no resale or repackaging allowed. All code remains the property of Jose Silva. http://www.metastocktools.com } { User inputs } pds1:=Input("shorter weekly EMA periods", 1,520,12); pds2:=Input("longer weekly EMA periods", 2,5200,26); pds3:=Input("weekly MACD signal periods", 1,520,9); EOW:=Input("Final week's end: [1]True, [2]Current (dynamic)",1,2,2); plot:=Input("plot: [1]MACD, [2]Histogram", 1,2,1); { Choice of Static/Dynamic last EOW signal } EOW:=If(EOW=2,Cum(1)=LastValue(Cum(1)), Cum(1)=LastValue(Cum(1)) AND DayOfWeek()=5); { Reference EOW signals } WkEnd:=EOW OR FmlVar("Week's true Start & End","WEEKEND"); { Week's Close } WkCl:=ValueWhen(1,WkEnd,C); WkCl:=ValueWhen(1,WkCl>0,WkCl); { Reduce periodicity if insufficient periods } pds1:=If(pds1>Cum(WkEnd),Cum(WkEnd),pds1); { Weekly EMA1 } WkEma1:=ValueWhen(1,WkEnd,PREV) *(1-2/(pds1+1))+WkCl*2/(pds1+1); { Weekly EMA2 } pds2:=If(pds2>Cum(WkEnd),Cum(WkEnd),pds2); WkEma2:=ValueWhen(1,WkEnd,PREV) *(1-2/(pds2+1))+WkCl*2/(pds2+1); { MACD } Mac:=WkEma1-WkEma2; { Signal } pds3:=If(pds3>Cum(WkEnd),Cum(WkEnd),pds3); Signal:=ValueWhen(1,WkEnd,PREV) *(1-2/(pds3+1))+Mac*2/(pds3+1); { Histogram } Hist:=Mac-Signal; { Plot in own window } If(plot=1,Signal,Hist); If(plot=1,Mac,0)
|