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

[amibroker] problem using 2nd order smoother


  • Date: Wed, 25 Nov 2009 12:37:19 -0000
  • From: "de_techneut" <twistedcharts@xxxxxxxxx>
  • Subject: [amibroker] problem using 2nd order smoother

PureBytes Links

Trading Reference Links

Hi,

I'm having problems using the 2nd order smoother from the Library.

as long as i use O,H,L,C I can plot the IIR2.

However when I make a calculation and want to smooth the result, I get 'EMPTY' as a result.

If I use IIR2(C,0.2,1.4,-0.6); --> output
If I use [ a=(H+L+C)/3 ] IIR2(a,0.2,1.4,-0.6); --> output
If I use [ a=MA(c,20) ]  IIR2(a,0.2,1.4,-0.6); --> no output

The code says it uses the data array as input... Is that why i can not use it on a random array? And if so, how do i accomplish being able to use it on any array.

Here is the code as published in the Library.

// the following function is 2nd order smoother
// Input is the data array
// f0, f1, f2 are filter coefficients
// you can try 0.2, 1.4, -0.6 

function IIR2( input, f0, f1, f2 )
{
  result[ 0 ] = input[ 0 ];
  result[ 1 ] = input[ 1 ]; 

  for( i = 2; i < BarCount; i++ )
  {
    result[ i ] = f0 * input[ i ] + 
    f1 * result[ i - 1 ] + 
    f2 * result[ i - 2 ]; 
  }

  return result;
}

Plot( Close, "Price", colorBlack, styleCandle );
Plot( IIR2( Close, 0.2, 1.4, -0.6 ), "function example", colorRed ); 

Thanks

Marc



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

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

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

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

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

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:
    amibroker-digest@xxxxxxxxxxxxxxx 
    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/