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

[amibroker] Re: Rsi Fisher Transform



PureBytes Links

Trading Reference Links

Here is a code I have for the Fisher Transform. Hope it helps.

Tim








_SECTION_BEGIN("Inverse Fisher Transform");
SetBarsRequired(200, 0);

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

function InverseFisher(array)
{
  e2y = exp(2 * array);
  return (e2y - 1)/(e2y + 1);
}

function Normalize(array, arraylen)
// Figure 1.7 on p. 7
{
  MaxH = HHV(array, arraylen);
  MinL = LLV(array, arraylen);
  Value1[0] = array[0];  // Initialize as array

  for(i = 1; i < BarCount; i++)
  {
     Value1[i] = .5 * 2 * ((array[i] - MinL[i]) / (MaxH[i] - MinL[i])
- .5) + .5 * Value1[i-1];
     if (Value1[i] > .9999) Value1[i] = .9999;
     if (Value1[i] < -.9999) Value1[i] = -.9999;
  }
  return Value1;
}

function Fisher(array)
// Figure 1.7 on p. 7
{
  F = array;
  F = .25 * log((1+ array)/(1 - array)) + .5 * Ref(F, -1);
  return F;
}

Med = (H+L)/2;

// Fisher Transform
FisherXform = Fisher(Normalize(Med, 49));
Plot(FisherXform, "Fisher Transform", colorRed, styleLine);
Plot(Ref(FisherXform, -1), "", colorBlue, styleLine);
PlotGrid(2);
PlotGrid(-2);
Buy = Cross(FisherXform,Ref(FisherXform,-1));
Sell = Cross(Ref(FisherXform,-1),FisherXform);

PlotShapes(shapeUpArrow*Buy,colorBrightGreen);
PlotShapes(shapeDownArrow*Sell,colorRed);
_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/