Please HELP with EA - page 2

 
Stingo,

How would I know? You guys are experts in MQL4... That is why I attached indicator code, and if there is anything I should change in it, please let me know!!! How hard it could be to advise me on 5 lines indicator?

And again, I am testing on Open prices only (not every tick) and do not see anything close to your printout. One line and one value per every 1H bar.
 
I don't know exactly your algorithm but I have 2 remarks.

1. Counting from 0 to Bars is way from current (last) bar to oldest (first) bar i.e. reverse direction

   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];
   }

For example
ExtBuffer0[i]=0.5*MathLog((1+Value)/(1-Value))+0.5*Fish1;

Current ExtBuffer0 value calculated on base of next (not previous!) ExtBuffer0 value (Fish1)

IMHO You've used as example our custom indicator like MACD.mq4. But in this case direction of calculation does not matter because used right calculated values of standard indicator MA
See for example our Bands.mq4

2. Value1 and Fish1 are not initialized. All right if You calculates whole cycle from Bars-1 to 0. But there may be problem if calculate from limit to 0. You need for 2 additional (not plotted) buffers to store values between calculations.

 
Stingo,

thank you very much for your suggestions. I took a look into Bands.mq4, but not sure how it helps (I don't see anything helpful there).

Ok, I think I finally can show you what is going on. Below is a picture taken from the terminal and strategy tester as well. Now, I am printing values starting from index 1, not 0! So, in Terminal window Curr is index 1, Prev is index 2 (circled with red), Curr_1 is index 3 and Prev_1 is index 4 (circled with blue) on MyInd. In the terminal printout, values are EXACTLY as they are on the chart when I do mouse hoover.

I am using exactly the same indicator in Strategy Tester and last values in tester printout are correct (circled with red). However, next set of values (in blue) are wrong!!! Somehow, Tester does not calculate indicator values in the same way Terminal does.

Modified MyInd.mq4 is attached for your reference. Any ideas? Thanks.



sfgsf
 
sorry, forgot to attached MyInd.mq4, here it is.
Files:
myind.mq4  2 kb
 
I have seen the same problem firelake is having and would be very interested in any answers. Thank you
 
firelake, see updated indicator
//+------------------------------------------------------------------+
//|                                                        MyInd.mq4 |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright ""
#property link      "szm@pictaa.com"
 
#property  indicator_separate_window
#property  indicator_buffers 1
#property  indicator_color1  Blue
 
extern int period=10;
 
double ExtBuffer0[];
 
double Value1;
double Fish1;
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int init()
  {
   SetIndexStyle(0,DRAW_LINE);
   IndicatorDigits(Digits+1);
   SetIndexBuffer(0,ExtBuffer0);
   IndicatorShortName("MyInd");
 
   Value1=0;
   
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
   int    i,limit;
   int    counted_bars=IndicatorCounted();
   double prev,prev1,current,old;
   double Value=0,Value2=0,Fish=0,Fish2=0;
   double price;
   double MinL=0;
   double MaxH=0;  
   
   i=Bars-period+1;
   if(counted_bars>period-1) i=Bars-counted_bars-1;
 
   while(i>=0)
   {
      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];
      i--;
   }
   
   Print("IND: [1]=",ExtBuffer0[1],"; [2]=",ExtBuffer0[2],"; [3]=",ExtBuffer0[3],"; [4]=",ExtBuffer0[4]);
 
   return(0);
  }
//+------------------------------------------------------------------+


1. check for prevtime removed
2. Value1 and Fish1 are used for next calculations therefore they should be in the global scope
3. direction of calculation inverted like in the Bands.mq4

Reason: