about history data

 

example.

in expert 's init () function i use an array to store some bar's shift number and the value of ma 7.

 
 
int  ma7shift[1000];
 
double ma7price [1000];
 
init()
 
{
 int j;

for(int i=0;i<bars;i++)
 
    {
 
     
     if(askma(i)> x){ma7shift[j]=i;ma7price[j]=askma(i);j++;}
 
     if(j>1000) break;
 
     }
 
}
 
double askma(int shift){
 
//.... return ma's value. 
 
}

i want get 1000 bars that sutie the condition askma ( i ) > x

but always can't get if the number is bigger enough.

my question is how to make sure that ea or indicator can get this 1000 bars' data.


i use print some information find that if can't get as much as you want bars always loop there try to get that data.

 

你逻辑错误了,在变量j上。

 

no. logic is right.

varible j is the count for the array to store the bar's data which fit the conditions.

 
这搞不出1000个值阿 逻辑错了 哈哈
 
比如你数到1000根棒子 前900根都不满足条件 你有100根数据 但是再数一根满足条件你就要break啦。。。
 
实际我是举个例子,数量可以放到很大比如10000根,但是还是有问题的,取不到那么多数据,即使下载历史数据也不行.
Reason: