|
|||||||||||||||||||
| Special offer: buy AmiBroker and EOD+Real-Time Data |
|
I would like to plot a monthly stochastic on a weekly chart ? Here is the code of the stochastic I use : Mov(Stoch(14,1),5,E) Thanks in advance for your valuable help, Regards, Marco ====================================== Hi Marco Here's a monthly stochastic for daily charts. You can also use it for weekly charts, but remember that the end-of-month date is different for daily and monthly charts than it is for weekly charts. This is because the end of a month does not necessarily coincide with the end of a week. For example, on a weekly chart May 2005 finished on the 27th, but on daily and monthly charts it finished on the 31st. Kind regards Roy Larsen www.metastocktips.co.nz Stochastic Oscillator Monthly EMA {2005 Roy Larsen, www.metastocktips.co.nz} {for use on daily charts} N:=Input("Monthly Stochastic Oscillator Periods (%K)",1,99,14); K:=Input("%K Slowing Periods" ,1,99,1); D:=Input("%D EMA Periods",1,99,5); Q:=Input("Display Mode, 0=Static 1=Dynamic 2=Test",0,2,1); {0=Display, update at end-of-month} {1=Display, update on each new bar} {2=Backtest, update on first bar of new month} G:=LastValue(Sum(Month()<>ValueWhen(2,1,Month()),5)=5); M:=G OR Month()<>ValueWhen(2,1,Month()); F:=G OR PeakBars(1,Zig(If(G*(Cum(1)=1),1,DayOfMonth()),1,$),1)=0; A:=LastValue(Cum(1)-1)=Cum(1); B:=ValueWhen(2,1,A); J:=If(F,1,If(Alert(F,2)=0 AND M,2,0)); J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J); J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J)); Hm:=HighestSince(1,M,H); Hm:=ValueWhen(1,J,If(J=1,Hm,ValueWhen(2-G,1,Hm))); Lm:=LowestSince(1,M,L); Lm:=ValueWhen(1,J,If(J=1,Lm,ValueWhen(2-G,1,Lm))); Cm:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C))); Hm:=ValueWhen(1,Hm>0,Hm); Lm:=ValueWhen(1,Lm>0,Lm); Z:=Cum(LowestSince(N,M,Lm)*(J>0)); Z:=Cm-(Z-ValueWhen(K+1,J,Z)); I:=Cum((HighestSince(N,J,Hm)-LowestSince(N,J,Lm))*(J>0)); I:=I-ValueWhen(K+1,J,I); I:=ValueWhen(1,Cum(I>0)>0,I); X:=100*Z/I; A:=2/(1+D); X:=ValueWhen(1,Cum(J>0)>=K+N,X); Y:=ValueWhen(1,J,PREV)*(1-A)+X*A; Y:=ValueWhen(1,Cum(J>0)>=N+K+D,Y); X; {%K} Y; {%D} ====================================== Hi Roy, It works fine :) Thank you very much Regards, Marco Code:
all formulas for MetaStock all formulas
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| However we try to maintain hiqhest possible level of service - most formulas, oscillators, indicators and systems are submitted by anonymous users. Therefore S4T™ does not take any responsibility for it's quality. If you use any of this information, use it at your own risk. You are responsible for your own trading decisions. Be sure to verify that any information you see on these pages is correct, and is applicable to your particular trade. In no case will S4T™ be responsible for your trading gains or losses. |
|
|