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

[amibroker] (afl 4 your arma): EasyLanguage question



PureBytes Links

Trading Reference Links

//-----8<--------------------------------------------
function twitch(price,initLength) 
// alex--  ARMA(2) "twitch" jan31,2006
{
	length = x = u = u1 = u1_2 = u_2 =0;
	y=y1=y2=Cum(0);
	if ( initLength < 2 ) length = 2; else length = initlength;


  x	=(1- cos(360/Length))/0.414213562;
  u	=-x + sqrt(x*x+2*x);
  u1	= 1.0-u;
  u1_2	=u1*u1;
  u_2	=u*u;
  y1	=price;
  y2	=y1;
	for ( i = 1; i < BarCount; i++ )
	{
		y[i] = u_2* price[i]+2*u1*y1[i]-u1_2*y2[i];
    	y2[i]=y1[i];
    	y1[i]=y[i];
   } 
	return y;
}

tw = twitch(C,3);
Plot(tw,"twitch",1,1);
Plot(C,"c",1,64);
//---------8<--------------------------------------------------

--- In amibroker@xxxxxxxxxxxxxxx, "Terry" <MagicTH@xxxx> wrote:
>
> I am trying to convert a function called Twitcher from TradeStation
> EasyLanguage. Twitcher concept was published in last month's 
FUTURES
> Magazine. Code is from a user's group.
> 
> QUESTION: Does the following code for y refer to the next bar and 
next 2
> bars or previous bars?
> 
> Y = u_2* price+2*u1*y1-u1_2*y2;
> y2 = y1;
> y1 = y;
> 
> Here's the entire EasyLanguage code (for the twitcher function)
> 
> EASYLANGUAGE FUNCTION:
> Inputs: price(NumericSeries), initLength(NumericSimple);
> variables: length(0), x(0), y(0), y1(0), y2(0), u(0), u1(0), u1_2
(0),
> u_2(0);
> 
> If initLength <2 then length = 2 else length = initlength;
> if CurrentBar = 1 then begin
>     x=(1- cosine(360/Length))/0.414213562;
>     u=-x + squareroot(x*x+2*x);
>     u1= 1.0-u;
>     u1_2=u1*u1;
>     u_2=u*u;
>     y1=price;
>     y2=y1;
> end;
> y=u_2* price+2*u1*y1-u1_2*y2;
> y2=y1;
> y1=y;
> 
> TWITCH=Y
> --
> Terry
>






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

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/

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