PureBytes Links
Trading Reference Links
|
OPPS!
Here ids the MS version:
====================================
MACD oscillator - Schaff Trend Cycle
====================================
---8<---------------------------
{Stochastic-normalized MACD v1.0, -100~+100%}
{©Copyright 2003 Jose Silva}
{josesilva22@xxxxxxxxx}
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)*-1;
If(plot=1,50,0);
If(plot=1,trigger,0);
If(plot=1,StochMac,If(plot=2,hist,signals))
---8<---------------------------
http://users.bigpond.com/prominex/pegasus.htm
--- In amibroker@xxxxxxxxxxxxxxx, "John" <jea55129@xxxx> wrote:
> Group,
>
> Some time ago someone asked for the Scaff Trend Cycle in afl. After
> some searching I found this
> MS version:
>
> //MACD oscillator - Schaff Trend Cycle
> //{Stochastic-normalized MACD v1.0, -100~+100%}
> //{©Copyright 2003 Jose Silva}
> //{josesilva22@xxxx}
> pds=Param("Stochastic (cycle) lookback periods",62,2,252,2);
> pds1=Param("short EMA periods",12,2,252,2);
> pds2=Param("long EMA periods",26,2,2520,2);
> pds3=Param("MACD oscillator trigger signal periods",21,1,252,2);
> z=(H+L)/2;
> x=EMA(z,pds1);
> y=EMA(z,pds2);
> ratio=Min(x,y)/Max(x,y);
> Mac=(IIf(x>y,2-ratio,ratio)-1)*100;
> StochMac=(Mac-LLV(Mac,pds))/(HHV(Mac,pds)-LLV(Mac,pds)+.000001)
*100;
> trigger=EMA(StochMac,pds3);
> Hist=StochMac-trigger;
> signals=Cross(StochMac,trigger)+Cross(trigger,StochMac)*-1;
> Plot(Hist,"Scaff Trend Cycle EMA",IIf(Hist <(Ref(Hist,-
> 1)),colorRed,IIf(Hist >
> (Ref(Hist,-1)),colorGreen,16)),2);
> Plot (EMA(Hist,9)," EMA9",colorPaleBlue,1);
>
>
>
>
> //http://users.bigpond.com/prominex/pegasus.htm
> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>
> Here is my afl try:
>
> //MACD oscillator - Schaff Trend Cycle
> //{Stochastic-normalized MACD v1.0, -100~+100%}
> //{©Copyright 2003 Jose Silva}
> //{josesilva22@xxxx}
> pds=Param("Stochastic (cycle) lookback periods",62,2,252,2);
> pds1=Param("short EMA periods",12,2,252,2);
> pds2=Param("long EMA periods",26,2,2520,2);
> pds3=Param("MACD oscillator trigger signal periods",21,1,252,2);
> z=(H+L)/2;
> x=EMA(z,pds1);
> y=EMA(z,pds2);
> ratio=Min(x,y)/Max(x,y);
> Mac=(IIf(x>y,2-ratio,ratio)-1)*100;
> StochMac=(Mac-LLV(Mac,pds))/(HHV(Mac,pds)-LLV(Mac,pds)+.000001)
*100;
> trigger=EMA(StochMac,pds3);
> Hist=StochMac-trigger;
> Signals=Cross(StochMac,trigger)+Cross(trigger,StochMac)*-1;
> Plot(Hist,"Schaff Trend Cycle EMA",IIf(Hist <(Ref(Hist,-
> 1)),colorRed,IIf(Hist >
> (Ref(Hist,-1)),colorGreen,16)),2);
> Plot (EMA(Hist,9)," EMA9",colorPaleBlue,1);
>
>
>
>
> //http://users.bigpond.com/prominex/pegasus.htm
> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>
> 1)Is this correct?
>
> 2)How would one code this using ama or ama2?
>
> TIA,
>
> John
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|