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

[amibroker] Laguerre rsi exploration code



PureBytes Links

Trading Reference Links

Can anybody help me with the Laguerre rsi exploration code 


Buy = previous bar laguerre <0.2 & laguerre >0.2
sell= previous bar laguerre >0.8 & laguerrre<0.8

Thanks

Amikid

The laguerre afl is given below for ref

_SECTION_BEGIN("laguerre");
SetBarsRequired(200, 0);

// Ehlers formulas
// from Ehlers, John F. Cybernetic Analysis for Stocks and Futures.
Wiley. 2004. 
// Chapter 14, p. 213. Code on p. 221.

function LRSI(array, gamma)
// Figure 14.8 on p. 221.
{
  L0 = array;  // Initialize as array
  L1 = array;
  L2 = array;
  L3 = array;
  LRSIValue = array;

  for(i = 1; i < BarCount; i++)
  {
     L0[i] = (1 - gamma)*array[i] + gamma*L0[i-1];
     L1[i] = - gamma * L0[i] + L0[i-1] + gamma * L1[i-1];
     L2[i] = - gamma * L1[i] + L1[i-1] + gamma * L2[i-1];
     L3[i] = - gamma * L2[i] + L2[i-1] + gamma * L3[i-1];

     CU = 0;
     CD = 0;
     if (L0[i] >= L1[i]) CU = L0[i] - L1[i]; else (CD = L1[i] - L0[i]);
     if (L1[i] >= L2[i]) CU = CU + L1[i] - L2[i]; else CD = CD + L2[i]
- L1[i];
     if (L2[i] >= L3[i]) CU = CU + L2[i] - L3[i]; else CD = CD + L3[i]
- L2[i];

     if (CU + CD != 0) LRSIValue[i] = CU / (CU + CD);
  }
  return LRSIValue;
}

Plot(LRSI(C, 0.5), "Laguerre RSI", colorRed, styleThick);
PlotGrid(.80);
PlotGrid(.5);
PlotGrid(.20);
_SECTION_END();


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

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