MetaStock -> Tools -> Indicator Builder -> New -> Copy and paste complete formulae between "---8<---" lines. ========================= 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. Copyright ©2005-2007 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<---------------------------------- ========================= Synthetic cycle generator(2) ========================= ---8<---------------------------------- { 5-wave synthetic cycle generator v4.0 Refresh chart for new simulations. Download TMMath1.dll (Copyright © 2007 TonyM) from http://tradersconsortium.com and place in MetaStock External Function DLLs folder. Copyright ©2005-2007 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("TMMath1.MyRand",C)/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 wave } 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<---------------------------------- http://www.metastocktools.com