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)
|
This update to the synthetic cycle generator generates smooth sine waves, and plots a true synthetic pattern based on the composite of these five pure sine waves.
[code:1:cc0e193355]=========================
Synthetic cycle generator
=========================
---8<----------------------------------
{ 5-wave synthetic cycle generator v3.0}
{ Refresh chart for new simulations }
{ Download Random.dll from
http://www.traderhelp.net and place in
MetaStock External Function DLLs folder }
{ Idea seed from Andy Davidson at:
http://finance.groups.yahoo.com/group/equismetastock , and:
http://www.stockmarketcycles.com/technica.htm }
{ ©Copyright 2005 Jose Silva
For personal use only.
http://www.metastocktools.com }
{ User inputs }
plot:=Input("Sine-wave cycles: [1]Composite, [2]Individual",1,2,1);
Sval1:=Input("Sine 1 value",-720,720,1);
Sval2:=Input("Sine 2 value",-720,720,3.5);
Sval3:=Input("Sine 3 value",-720,720,12);
Sval4:=Input("Sine 4 value",-720,720,42);
Sval5:=Input("Sine 5 value",-720,720,150);
{ Random generator engine }
x:=LastValue(
ExtFml("Random.Number",-1)/66.66667+.5);
{ Sine components }
sine1:=Sin(Cum(Sval1*x));
x:=LastValue(
ExtFml("Random.Number",-1)/66.66667+.5);
sine2:=Sin(Cum(Sval2*x))*.5;
x:=LastValue(
ExtFml("Random.Number",-1)/66.66667+.5);
sine3:=Sin(Cum(Sval3*x))*.25;
x:=LastValue(
ExtFml("Random.Number",-1)/66.66667+.5);
sine4:=Sin(Cum(Sval4*x))*.125;
x:=LastValue(
ExtFml("Random.Number",-1)/66.66667+.5);
sine5:=Sin(Cum(Sval5*x))*.0625;
{ Composite Sine }
composite:=sine1+sine2+sine3+sine4+sine5;
{ Plot in own window }
If(plot=1,composite,sine1);
If(plot=1,composite,sine2);
If(plot=1,composite,sine3);
If(plot=1,composite,sine4);
If(plot=1,composite,sine5)
---8<----------------------------------
[/code:1:cc0e193355]
jose '-)
http://www.metastocktools.com
|