int pos=Bars-ExtCountedBars-1;
int i = 1;
while(pos>=0)
{
ExtEmaBuffer[pos]=iMA(NULL,0,Ema_canshu,0,MODE_EMA,PRICE_CLOSE,pos);
i++;
maxEma[pos] = ExtEmaBuffer[pos];
int limit = pos+Max_canshu;
if(i>=(Ema_canshu+Max_canshu)){
for(int j = pos+1;j<limit;j++){
if(ExtEmaBuffer[j]>maxEma[pos]){
maxEma[pos] = ExtEmaBuffer[j];
}
}
}
if(Close[pos]>maxEma[pos]){
ExtMapBuffer1[pos] = Low[pos];
ExtMapBuffer2[pos] = High[pos];
ExtMapBuffer3[pos] = Open[pos];
ExtMapBuffer4[pos] = Close[pos];
}
pos--;
} |