bose
September 15, 2016, 7:25pm
1
Hi i need Buy Sell signals once Fisher Crosses the trigger line and vice versa. And sir, unfortunately this code shows syntax error in AFL. All i needs is a Buy sell Signal generation when the crossover takes place. Thank you
study(title="Fisher Transform Indicator by Ehlers Strategy", shorttitle="Fisher Transform Indicator by Ehlers")
Length = input(10, minval=1)
xHL2 = hl2
xMaxH = highest(xHL2, Length)
xMinL = lowest(xHL2,Length)
nValue1 = 0.33 * 2 * ((xHL2 - xMinL) / (xMaxH - xMinL) - 0.5) + 0.67 * nz(nValue1[1])
nValue2 = iff(nValue1 > .99, .999,
iff(nValue1 < -.99, -.999, nValue1))
nFish = 0.5 * log((1 + nValue2) / (1 - nValue2)) + 0.5 * nz(nFish[1])
pos = iff(nFish > nz(nFish[1]), 1,
iff(nFish < nz(nFish[1]), -1, nz(pos[1], 0)))
barcolor(pos == -1 ? red: pos == 1 ? green : blue )
plot(nFish, color=green, title="Fisher")
plot(nz(nFish[1]), color=red, title="Trigger")
As per the above condition check the elder fisher transform AFL code
//------------------------------------------------------------------------------
//
// Formula Name: Ehlers Fisher Transform
// Level: medium
// Flags: indicator
//
//------------------------------------------------------------------------------
//
// The Fisher Transform converts price data to a nearly Gaussian probability
// density function. The result is an indicator that reverses very sharply
// when a trend changes.
//
//------------------------------------------------------------------------------
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, 10));
Plot(FisherXform, "Fisher Transform", colorRed, styleLine);
Plot(Ref(FisherXform, -1), "", colorBlue, styleLine);
PlotGrid(2);
PlotGrid(-2);
Dear Mr. Sreenivasulu Malkari,
Thanks for the Algo code for Fisher Transform. I am not a coder to appreciate the nuance of it. But I am trying to plot over excel for EOD. But am reasonably good at excel. Would you kindly convert the same to excel with smoothening factor so for excel.
Regards,
Surya