Fisher Indicator

85

Hi all,
Maybe i am out of topic but i'm sure that this is the place where i can find an answer.
I try to test Indicator Fisher with EA.
The EA is: if fisher bar2 is red, the fisher bar1 is green and the fisher bar0 becomes grater than zero open buy (immediately when the bar0 becomes greater than zero). vice versa close buy. The opposite condition for open\close sell.
I'm testing with eurusd 4 hour.

The Ea works correctly but sometimes don't close the order (for example today at 16.00 gmt time the sell order was to be closed but the EA not closed the order).
Also the strategy tester sometimes close the order in a wrong time (for example today at 16.00).

Why? The indicator is not reliable?

Attached the indicator that I use.

Thanks

Files:
fisher.mq4 2 kb
16076

```for(int i=0; i<limit; i++)
{  //...
Value = 0.33*2*((price-MinL)/(MaxH-MinL)-0.5) + 0.67*Value1;
Value=MathMin(MathMax(Value,-0.999),0.999);
ExtBuffer0[i]=0.5*MathLog((1+Value)/(1-Value))+0.5*Fish1;
Value1=Value;```
Period=5, alpha=2/(period+1)=.33
1. This indicator recalculates previous values based on the ema(5) from the current value. It redraws. Always count DOWN. get rid of Value1, Fish1 variables, use the buffers[i+1] value.
2. v[0]=a*newValue+(1-a)v[1] is unstable in the presence of round off. always use v[i]=v[i+1]+a(newValue-v[i+1])
3. as for why the EA doesn't work correctly, POST THE EA code!
85

Hi,

The EA is correct, I have no doubt.

I don't have feeling with indicator code. Can you explain me better your indication and how to correct the indicator code?

Thankyou very mouch!

85

double Fisher0=iCustom(Symbol(),Period(),"ZeFisherIndicatore",10,0,0);
double Fisher1=iCustom(Symbol(),Period(),"ZeFisherIndicatore",10,0,1);
double Fisher2=iCustom(Symbol(),Period(),"ZeFisherIndicatore",10,0,2);

if (Fisher2<=0 && Fisher1>0 && Fisher0>0)
{
TipoOrdDaEseg=0;
}
if (Fisher2>=0 && Fisher1<0 && Fisher0<0)
{
TipoOrdDaEseg=1;
}

This is the analisys part of the EA.
If the first if is true the EA set the variable TipoOrdDaEseg=0 (Open Buy) and call BuySeel() function that open buy.
Instead If the second if is true the EA set the variable TipoOrdDaEseg=1 (Open Sell) and call BuySeel() function that open sell.

Can you help me?

Thankyou
bye

3

In the first time, sorry for my bad english. I made a simple EA with this indicator too and I saw one thing. When you make a Visual Backtest you can see in the end how the indicator draw and if you add the indicator new and compare you can see the diference.

16076

1. davidze:
The EA is correct, I have no doubt.
You may have no doubt but I do. You posted Fisher.mql4 but your code uses iCustom( "ZeFisherIndicatore" ) The two don't match.
415

WHRoeder:
Period=5, alpha=2/(period+1)=.33
1. This indicator recalculates previous values based on the ema(5) from the current value. It redraws. Always count DOWN. get rid of Value1, Fish1 variables, use the buffers[i+1] value.
2. v[0]=a*newValue+(1-a)v[1] is unstable in the presence of round off. always use v[i]=v[i+1]+a(newValue-v[i+1])
3. as for why the EA doesn't work correctly, POST THE EA code!

I was looking for fisher indicator and came across this.

But, WHRoeder, I cannot find what are you talking about.

1) you are telling us to create an array called buffers and assign,

```bufferValue[0] = Value0;
bufferValue[1] = Value1;
bufferValue[2] = Value2;

bufferFisher[0] = fisher0;
bufferFisher[1] = fisher1;
bufferFisher[2] = fisher2;
```

Can you be more specific which one to change in which way?

2) Where is V[0] = a*newValue +(1-a) V[1]??? ---> I cannot find this in the source code that was uploaded.

WHRoeder:
1. davidze:
The EA is correct, I have no doubt.
You may have no doubt but I do. You posted Fisher.mql4 but your code uses iCustom( "ZeFisherIndicatore" ) The two don't match.

3) I cannot find iCustom, either?

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

If all the above is too much hassle for you, then please kindly point out to me where I could download fisher indicators.

What I am looking for is that several fisher lines can overlap in one area. Thanks in advance ~ Always willing to learn, SIR ~

16076

paul.seldon:

1) you are telling us to create an array called buffers and assign,

Can you be more specific which one to change in which way?

2) Where is V[0] = a*newValue +(1-a) V[1]??? ---> I cannot find this in the source code that was uploaded.

 Original Code. Where does Value1 come from? The previous bar's Value. Where does Fish1 come from? The previous ExtBuffer0. But since it is counting up, previous means newer. Using newer bar's data for creating older ones is the definition of repainting. Can't be used for trading, just like you can't open a order at a previous bar's price. ```   for(int i=0; i=0; i--)     {  MaxH = High[Highest(NULL,0,MODE_HIGH,period,i)];        MinL = Low[Lowest(NULL,0,MODE_LOW,period,i)];       price = (High[i]+Low[i])/2;                     Value1 = Buffer[i+1];                   // Get from previous                     Fish1  = ExtBuffer0[i+1];       Value = 0.33*2*((price-MinL)/(MaxH-MinL)-0.5) + 0.67*Value1;           Value=MathMin(MathMax(Value,-0.999),0.999);       ExtBuffer0[i]=0.5*MathLog((1+Value)/(1-Value))+0.5*Fish1;       Value1=Value;                     Buffer[i] = Value1;                     // Save for next bar //    Fish1=ExtBuffer0[i];     }``` Don't magnify roundoff ```//   ExtBuffer0[i]=0.5*MathLog((1+Value)/(1-Value)) //                +0.5*ExtBuffer0[i+1];              // v[i]=alpha*newValue + (1-alpha)*v[i+1]      ExtBuffer0[i]=ExtBuffer0[i+1]                   // v[i]=v[i+1] + alpha* (newValue-V[i+1])                   + 0.5*( MathLog((1+Value)/(1-Value)) - ExtBuffer0[i+1]);```
415

WHRoeder:
Period=5, alpha=2/(period+1)=.33
1. This indicator recalculates previous values based on the ema(5) from the current value. It redraws. Always count DOWN. get rid of Value1, Fish1 variables, use the buffers[i+1] value.
2. v[0]=a*newValue+(1-a)v[1] is unstable in the presence of round off. always use v[i]=v[i+1]+a(newValue-v[i+1])
3. as for why the EA doesn't work correctly, POST THE EA code!

I was looking for fisher indicator and came across this.

But, WHRoeder, I cannot find what are you talking about.

1) you are telling us to create an array called buffers and assign,

```bufferValue[0] = Value0;
bufferValue[1] = Value1;
bufferValue[2] = Value2;

bufferFisher[0] = fisher0;
bufferFisher[1] = fisher1;
bufferFisher[2] = fisher2;
```

Can you be more specific which one to change in which way?

2) Where is V[0] = a*newValue +(1-a) V[1]??? ---> I cannot find this in the source code that was uploaded.

WHRoeder:
1. davidze:
The EA is correct, I have no doubt.
You may have no doubt but I do. You posted Fisher.mql4 but your code uses iCustom( "ZeFisherIndicatore" ) The two don't match.

3) I cannot find iCustom, either?

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

If all the above is too much hassle for you, then please kindly point out to me where I could download fisher indicators.

What I am looking for is that several fisher lines can overlap in one area. Thanks in advance ~ Always willing to learn, SIR ~

Below is the source code from the link

```#property  copyright "Copyright ?2005, Yura Prokofiev"

#property  indicator_separate_window
#property  indicator_buffers 3
#property  indicator_color1  Black
#property  indicator_color2  Lime
#property  indicator_color3  Red

extern int period=10;

double         ExtBuffer0[];
double         ExtBuffer1[];
double         ExtBuffer2[];

int init()
{

SetIndexStyle(0,DRAW_NONE);
SetIndexStyle(1,DRAW_HISTOGRAM);
SetIndexStyle(2,DRAW_HISTOGRAM);
IndicatorDigits(Digits+1);

SetIndexBuffer(0,ExtBuffer0);
SetIndexBuffer(1,ExtBuffer1);
SetIndexBuffer(2,ExtBuffer2);

IndicatorShortName("Fisher");
SetIndexLabel(1,NULL);
SetIndexLabel(2,NULL);

return(0);
}

int start()
{
//int     period=10;
int    limit;
int    counted_bars=IndicatorCounted();
double prev,current,old;
double Value=0,Value1=0,Value2=0,Fish=0,Fish1=0,Fish2=0;
double price;
double MinL=0;
double MaxH=0;

if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;

for(int i=0; i<limit; i++)
{
MaxH = High[Highest(NULL,0,MODE_HIGH,period,i)];
MinL = Low[Lowest(NULL,0,MODE_LOW,period,i)];
price = (High[i]+Low[i])/2;

Value = 0.33*2*((price-MinL)/(MaxH-MinL)-0.5) + 0.67*Value1;
Value=MathMin(MathMax(Value,-0.999),0.999);
ExtBuffer0[i]=0.5*MathLog((1+Value)/(1-Value))+0.5*Fish1;
Value1=Value;
Fish1=ExtBuffer0[i];

}

bool up=true;
for(i=limit-2; i>=0; i--)
{
current=ExtBuffer0[i];
prev=ExtBuffer0[i+1];

if (((current<0)&&(prev>0))||(current<0))   up= false;
if (((current>0)&&(prev<0))||(current>0))   up= true;

if(!up)
{
ExtBuffer2[i]=current;
ExtBuffer1[i]=0.0;
}

else
{
ExtBuffer1[i]=current;
ExtBuffer2[i]=0.0;
}
}

return(0);
}```

above -

415

WHRoeder:
 Original Code. Where does Value1 come from? The previous bar's Value. Where does Fish1 come from? The previous ExtBuffer0. But since it is counting up, previous means newer. Using newer bar's data for creating older ones is the definition of repainting. Can't be used for trading, just like you can't open a order at a previous bar's price. Count down, create an Buffer and remember Value1 for next bar Don't magnify roundoff

Oh, the posting was prematurely done without my notice ~ >_<
415

WHRoeder:
 Original Code. Where does Value1 come from? The previous bar's Value. Where does Fish1 come from? The previous ExtBuffer0. But since it is counting up, previous means newer. Using newer bar's data for creating older ones is the definition of repainting. Can't be used for trading, just like you can't open a order at a previous bar's price. Count down, create an Buffer and remember Value1 for next bar Don't magnify roundoff

If you introduce new array Buffer then who assign the value for Buffer initially. Nothing so it will have all zeros, right?

Then,

`Value1 = Buffer[i+1];`

is not necessary because all the value of Buffer[i+1] is zero when i = 0, 1, 2, 3, 4 ...

I don't understand what you are trying to do. If you want to do previous one, then it should be i-1, isn't it?

Please DO correct me if I am wrong. This "FOR-LOOP" is incrementing not decrementing.

enclosed modified Fisher.mq4

Files:
fisher.mq4 3 kb