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

Re: [amibroker] Plotting Sine Waves using Time Axis



PureBytes Links

Trading Reference Links

Hi - Here is a pretty flexible tool for plotting cycles / sine waves, hope 
it helps

Steve

***************************************8

// Cycles

// set chart options

SetBarsRequired( 10000, 10000 );

SetChartOptions( 0, chartShowDates );

Periods = Param( "Cycle Pds", 13, 1, 252, 1 );

XShift = Param( "Shift L/R", 0, -252, 252, 1 ) / 3.14159^2;

XFactor = Param( "FT Freq", 1, 0, 2, 0.001 );

YFactor = Param( "FT Amp", 1, 0, 1, 0.01 );

Color = ParamColor( "Color", colorYellow );

// calc and plot wave

X = 2 * 3.14159 / Periods / XFactor;

Y = sin( Cum( X ) - XShift ) * YFactor;

FineTunedPds = Periods * XFactor;

Plot( Y, NumToStr( FineTunedPds, 0.2 ) + " Bar Cycle", Color, 
styleLine|styleLeftAxisScale|styleNoLabel );

Plot( 0, "", Color, styleLine|styleDashed|styleLeftAxisScale|styleNoLabel );

Plot( 1, "", Color, styleNoLine|styleLeftAxisScale|styleNoLabel );

Plot( -1, "", Color, styleNoLine|styleLeftAxisScale|styleNoLabel );

// calc and plot vertical lines for pivots

Ym1 = Ref( Y, -1 );

Yp1 = Ref( Y, 1 );

Peaks = Y > Ym1 AND Y > Yp1;

Troughs = Y < Ym1 AND Y < Yp1;

Pivots = IIf( Peaks, YFactor, IIf( Troughs, -YFactor, Null ) );

Plot( Pivots, "", Color, 
styleHistogram|styleDashed|styleLeftAxisScale|styleNoLabel );

Plot( -Pivots, "", Color, 
styleHistogram|styleDashed|styleLeftAxisScale|styleNoLabel );



----- Original Message ----- 
From: "jeff.feder" <jeff@xxxxxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Wednesday, October 01, 2008 8:11 AM
Subject: [amibroker] Plotting Sine Waves using Time Axis


> Hello,
>
> I have been studying the works of Hurst and Millard and have been
> basing my trading system around the principle of Cycles.
>
> I have come accross several Sine Wave Formulas, which plot the waves
> in relation to price.
>
> Has anyone constructed Sine Waves that plot based on time, ie. perfect
> sine wave curve, and if so, how is this written in AB code?
>
> My theory was just to use these as guides as to what stage the
> different cycles are, at a certain point in time.
>
> Thansk for your help,
>
> Jeff
>
>
> ------------------------------------
>
> **** IMPORTANT ****
> This group is for the discussion between users only.
> This is *NOT* technical support channel.
>
> *********************
> TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to
> SUPPORT {at} amibroker.com
> *********************
>
> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
>
> For other support material please check also:
> http://www.amibroker.com/support.html
>
> *********************************
> Yahoo! Groups Links
>
>
>
> 



------------------------------------

**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

*********************
TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com
*********************

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html

*********************************
Yahoo! Groups Links

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

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> 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/