[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Metastockusers] Re: signal-frequency self-adjusting EMA



PureBytes Links

Trading Reference Links


Kurekci, try this:


MetaStock -> Tools -> Expert Advisor -> New -> Trends ->

Bullish (Green ribbon):
---8<-------------------------------
x:=Fml("MACD oscillator - Schaff Trend Cycle");
x>50
---8<-------------------------------


Bearish (Red ribbon):
---8<-------------------------------
x:=Fml("MACD oscillator - Schaff Trend Cycle");
x<50
---8<-------------------------------


Original indicator:

====================================
MACD oscillator - Schaff Trend Cycle
====================================
---8<---------------------------

{ Stochastic-normalized MACD v1.0, -100~+100% }
{ ©Copyright 2003 Jose Silva }
{ http://www.metastocktools.com }

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 Volume=5 P=6",1,6,4);
plot:=Input("MACD osc=1, Hist=2, trigger crossover Signals=3",1,3,1);

z:=If(z=1,O,If(z=2,H,If(z=3,L,If(z=5,V,If(z=6,P,C)))));
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;

StochMac:=(Mac-LLV(Mac,pds))
 /(HHV(Mac,pds)-LLV(Mac,pds)+.000001)*100;
trigger:=Mov(StochMac,pds3,E);
hist:=StochMac-trigger;
signals:=Cross(StochMac,trigger)
 -Cross(trigger,StochMac);

If(plot=1,50,0);
If(plot=1,trigger,0);
If(plot=1,StochMac,If(plot=2,hist,signals))

---8<---------------------------


jose '-)
http://www.metastocktools.com



--- In Metastockusers@xxxxxxxxxxxxxxx, "KUREKCI" <kurekci@xxxx> wrote:
> dear jose,
> i am using the below code of yours.
> i plot macd ocs=1.
>  
> but i want to put bearish if this greater than zero and else if
> bullish in the trends section of advisor.
> how should the code be rearranged?
>  
> thanks







------------------------ Yahoo! Groups Sponsor --------------------~--> 
Has someone you know been affected by illness or disease?
Network for Good is THE place to support health awareness efforts!
http://us.click.yahoo.com/Rcy2bD/UOnJAA/cosFAA/zMEolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/Metastockusers/

<*> To unsubscribe from this group, send an email to:
    Metastockusers-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/