logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Jose  
#1 Posted : Friday, May 26, 2006 1:40:38 PM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
Posted recently in the metastocktips usergroup:
Quote:
--- In metastocktips@yahoogroups.com, "Kevin" <kjhoward@...> wrote: Hi, Jose has this brilliant Indicator on his web site and I wonder if others have tried it. I appreciate that it is an oscillator but I am interested in the cross over points of the two lines it plots. Is it possible to rework the code so that it can be used within an exploration to find stocks where a cross over has taken place? Jose's site as most would know is at: http://www.metastocktools.com/index.html Any help would be greatly appreciated. Best wishes, Kevin
Contrary to popular belief, signals based on oscillator trigger crossovers are seldom profitable. By the time the oscillator crosses its signal line, most of the security's profit has passed. This is specially true in market sideways periods. A more profitable signal can be obtained by using overBought/Sold levels of the oscillator to trigger entries. This is only possible when using automatic overBought/Sold levels which adjust for each individual security's price volatility, as in the indicator below. [code:1:02d7b2c081] ========================= MACD oscillator - Signals ========================= ---8<--------------------------------------- { Stochastic-normalized MACD signals v3.0 Incorporating auto overbought/sold signals. Warning: Trade these signals at your own risk! ©Copyright 2004~2006 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 } pds:=Input("Stochastic (cycle) lookback periods",2,252,63); pds1:=Input("short EMA periods",1,252,12); pds2:=Input("long EMA periods",2,2520,26); pds3:=Input("MACD oscillator trigger periods", 1,252,21); z:=Input("use Open=1 High=2 Low=3 Close=4 WhgtCl=5 Vol=6",1,6,4); { Chosen data array } z:=If(z=1,O,If(z=2,H,If(z=3,L,If(z=5,WC(),If(z=6,V,C))))); { MACD normalized } x:=Mov(z,pds1,E); y:=Mov(z,pds2,E); ratio:=Min(x,y)/Max(x,y); Mac:=(If(x>y,2-ratio,ratio)-1)*100; { Stochastic MACD } osc:=(Mac-LLV(Mac,pds)) /Max(HHV(Mac,pds)-LLV(Mac,pds),.000001)*100; avg:=Cum(osc)/Cum(IsDefined(osc)); { Auto overbought/sold levels } pk:=Ref(osc,-1)=HHV(osc,3) AND osc>avg; oBought:=ValueWhen(1,pk,Ref(osc,-1))*pk; oBought:=Cum(oBought)/Cum(pk); tr:=Ref(osc,-1)=LLV(osc,3) AND osc<avg; oSold:=ValueWhen(1,tr,Ref(osc,-1))*tr; oSold:=Cum(oSold)/Cum(tr); { Overbought/sold crossover signals } signals:=Cross(osc,oSold)-Cross(osc,oBought); { Plot in own window } signals ---8<--------------------------------------- [/code:1:02d7b2c081] Exploration code for above signals: Fml("MACD oscillator - Signals") The original indicator: [code:1:02d7b2c081] ==================================== MACD oscillator - Schaff Trend Cycle ==================================== ---8<--------------------------------------- { Stochastic-normalized MACD v2.0 Incorporating auto overbought/sold levels. ©Copyright 2005-2006 Jose Silva. For personal use only. http://www.metastocktools.com } { User inputs } pds:=Input("Stochastic (cycle) lookback periods",2,252,63); pds1:=Input("short EMA periods",1,252,12); pds2:=Input("long EMA periods",2,2520,26); pds3:=Input("MACD oscillator trigger signal periods",1,252,21); z:=Input("use Open=1 High=2 Low=3 Close=4 WhgtCl=5 Vol=6",1,6,4); plot:=Input("[1]MACD osc, [2]Histogram, [3]trigger Signals",1,3,1); { Chosen data array } z:=If(z=1,O,If(z=2,H,If(z=3,L,If(z=5,WC(),If(z=6,V,C))))); { MACD normalized } x:=Mov(z,pds1,E); y:=Mov(z,pds2,E); ratio:=Min(x,y)/Max(x,y); Mac:=(If(x>y,2-ratio,ratio)-1)*100; { Stochastic MACD } StochMac:=(Mac-LLV(Mac,pds)) /Max(HHV(Mac,pds)-LLV(Mac,pds),.000001)*100; trigger:=Mov(StochMac,pds3,E); hist:=StochMac-trigger; osc:=If(plot=1,StochMac,hist); avg:=Cum(osc)/Cum(IsDefined(osc)); { Auto overbought/sold levels } pk:=Ref(osc,-1)=HHV(osc,3) AND osc>avg; oBought:=ValueWhen(1,pk,Ref(osc,-1))*pk; oBought:=Cum(oBought)/Cum(pk); tr:=Ref(osc,-1)=LLV(osc,3) AND osc<avg; oSold:=ValueWhen(1,tr,Ref(osc,-1))*tr; oSold:=Cum(oSold)/Cum(tr); { Trigger crossover signals } signals:=Cross(StochMac,trigger) -Cross(trigger,StochMac); { Plot in own window. Plot color:} If(plot=3,0,oBought); { <- Grey } If(plot=3,0,avg); { <- Grey } If(plot=3,0,oSold); { <- Grey } If(plot=1,trigger,If(plot=2,osc,0));{ <- Green } If(plot=3,signals,osc) { <- Red } ---8<--------------------------------------- [/code:1:02d7b2c081] Exploration code for trigger crossover signals (not recommended): FmlVar("MACD oscillator - Schaff Trend Cycle","SIGNALS") jose '-)
Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.