[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 53

 
for (i=4; i<19; i++)
{
   sum+=GetPrcD1(symb[i]);
   Content[5 + (i-4)/3][1]=DoubleToStr(sum/3,3);
}
Something like that. Didn't check.
 
TheXpert:
Something like that. Didn't check.

Thank you! It's working! Why am I so stupid? I think I did well in school(!)
 

One more question has come up. Problem with sum of values. type sum+=a[i] (read in tutorial)

Incorrectly returns sum of values, please point out the error.

for (i=4; i<19; i++){
   sum+=GetPrcH12(symb[i]);//сумма значений по номеру i пары   
   }
//+------------------------------------------------------------------+
double GetPrcH12(string symb){
int i=iBarShift(NULL, 0, StrToTime(TimeToStr(Time[0], TIME_DATE)+" 12:00"));//ищем бар по времени на сегодня
double pc=iClose(symb,PERIOD_M30,i);//цена закрытия на начало времени  
double a=0;
if (pc!=0) 
a=(iClose(symb,PERIOD_M30,0)*100)/pc-100;//расчет процента изменения от начала времени
return (a);
}
 
Kondratiev_A_A: Problem with sum of values. type sum+=a[i]

I suspect that the problem is the lack of initialization of the variable sum with zero, and probably in a correct loop, like this, it should work:

sum = 0;
for (i=4; i<19; i++)
   sum+=GetPrcH12(symb[i]);

After the loop, the variable sum will contain the sum of values of the function.

 
IgorM:

I suspect that the problem is the lack of initialization of the variable sum with zero, and probably in a proper loop, like this, it should work:

After the loop, the sum of the function's values will be in the sum variable.


Thanks, tried it, sum=0, no change.

The error is in the summing mechanism itself... I'll have to think about it.

 
Can I use MathPow() to increment an integer number ? Is it correct?
 

Again a question about optimization and layout, how to pack such a miracle? I've used sum+=a[i], it's a mess.

   sum=GetPrcH12(symb[4])+GetPrcH12(symb[5])+GetPrcH12(symb[6]);
   Content[5][3]=DoubleToStr(sum/3,3);
   
   sum=GetPrcH12(symb[7])+GetPrcH12(symb[8])+GetPrcH12(symb[9]);
   Content[6][3]=DoubleToStr(sum/3,3);
   
   sum=GetPrcH12(symb[10])+GetPrcH12(symb[11])+GetPrcH12(symb[12]);
   Content[7][3]=DoubleToStr(sum/3,3);
   
   sum=GetPrcH12(symb[13])+GetPrcH12(symb[14])+GetPrcH12(symb[15]);
   Content[8][3]=DoubleToStr(sum/3,3);
   
   sum=GetPrcH12(symb[16])+GetPrcH12(symb[17])+GetPrcH12(symb[18]);
   Content[9][3]=DoubleToStr(sum/3,3);
 

Guys, can anyone know why my mother ASUS P5B under the Seven out of 4 gig RAM (2 on 2GB DDR3) sees only three?

It says 4 installed, 2.94 available...

 
moskitman:

Guys, can anyone know why my mother ASUS P5B under the Seven out of 4 gig RAM (2 on 2GB DDR3) sees only three?

It says 4 installed, 2.94 available...

Laptop, maybe? It's reserving for the video card.
 
AndEv: Can I use MathPow() to increment an integer number ? How correct it will be ?
The easiest way is to run a check, and theory says: int is converted to double, which takes precedence. MathPow (double base, double exponent) passes variables of type double. Use "without loss of health" variables of int type instead of double type.