/  Forum 

MQL4 Language for Newbies. Difficult Questions in Simple Phrases. This is the second article from the series "MQL4 Language for Newbies". Now we will examine more complex and advanced constructions of the language, learn new options and see, how they can be applied in everyday practice. You will get acquainted with a new cycle type 'while', new condition type 'switch', operators 'break' and 'continue'. Besides you will learn to write your own functions and work with multidimensional arrays. And for a dessert I have prepared an explanation about a preprocessor. 

for(int i=0; i<limit; i++) { //... Value = 0.33*2*((priceMinL)/(MaxHMinL)0.5) + 0.67*Value1; Value=MathMin(MathMax(Value,0.999),0.999); ExtBuffer0[i]=0.5*MathLog((1+Value)/(1Value))+0.5*Fish1; Value1=Value;Period=5, alpha=2/(period+1)=.33


Hi, 





WHRoeder: Period=5, alpha=2/(period+1)=.33
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 +(1a) V[1]??? > I cannot find this in the source code that was uploaded. WHRoeder:
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 ~ 

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 +(1a) V[1]??? > I cannot find this in the source code that was uploaded.


WHRoeder: Period=5, alpha=2/(period+1)=.33
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 +(1a) V[1]??? > I cannot find this in the source code that was uploaded. WHRoeder:
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 link "Yura.prokofiev@gmail.com" #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=Barscounted_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*((priceMinL)/(MaxHMinL)0.5) + 0.67*Value1; Value=MathMin(MathMax(Value,0.999),0.999); ExtBuffer0[i]=0.5*MathLog((1+Value)/(1Value))+0.5*Fish1; Value1=Value; Fish1=ExtBuffer0[i]; } bool up=true; for(i=limit2; 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  

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

WHRoeder:
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 i1, isn't it? Please DO correct me if I am wrong. This "FORLOOP" is incrementing not decrementing. enclosed modified Fisher.mq4 
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
Fisher.mq4 (1.92 KB)