View Single Post
  #342 (permalink)  
Old 01-14-2009, 01:14 PM
spartan spartan is offline
Junior Member
 
Join Date: Aug 2006
Posts: 5
spartan is on a distinguished road
Need a help fixing the indicator!

Hello,

I need a help from a kind coder who would be willing to fix a problem with the VQ.mq4 or direct me to the right direction.

When I set TimeFrame to 60 (and other MTF settings), CountBars seems to change to a lower number in certain cases.

When I set CountBars to 1485, it is fine but when set to higher numbers; the VQ indicator shows the data for shorter periods than it should.

For example, on M5 chart:

when CountBars=1485, it shows about 5 days worth of data which is fine

but when CountBars=14850, it shows about 10 days worth of data (about 3000 bars) which is not fine.

And even when CountBars=148500, it shows about only 10 day worth of data.

I get this problem only when I set TimeFrame to other than 0. Thus I concluded that this part of code is causing the problem:

Code:
if (TimeFrame>Period())
   {
     datetime TimeArray1[]; 
     ArrayCopySeries(TimeArray1,MODE_TIME,Symbol(),TimeFrame); 
     int limit=CountBars+TimeFrame/Period();
     for(i=0, int y=0;i<limit;i++) {if (Time[i]<TimeArray1[y]) y++;  SumVQ[i]=SumVQ_MTF[y];}
   }
Does this code change the set value of CountBars to a lower number somehow?

I just started learning MQL4 like yesterday so it's way too difficult for me.
I hope someone could take a good look at the code and fix it.

Best Regards,

spartan

P.S.

When I set TimeFrame setting to 240 (H4), I get like 3 more days worth of data on M5 chart compared to when TF=60 (13~14 days total, up to 4000 M5 bars).
On H1 chart, I get about 8~9 months worth of data (again about 4000 bars of H1 data). Hmmm...why is that?
Reply With Quote