for cycle problem -at the red sections there are calculations but does not calculate.

 

 Below, after the start function ,

in the for cycle,

i am triying to calculate increase/decrease ratio of bars.

the bars from 1 to 48 .

you will see red sections for calculations.

result is always zero.

why?

i have tried braces. 

 

<SNIP>

 
pascalboy:

 Below, after the start function ,

in the for cycle,

i am triying to calculate increase/decrease ratio of bars.

the bars from 1 to 48 .

you will see red sections for calculations.

result is always zero.

why?

i have tried braces. 

 

<SNIP>

You have been asked before to use the   SRC  button to post code . . .

Please edit your post . . .
 or have your code deleted


Please use this to post code . . . it makes it easier to read.  If it's too big for the SRC box please attach the code as a  .mql4   file

 
pascalboy:

 Below, after the start function ,

in the for cycle,

i am triying to calculate increase/decrease ratio of bars.

the bars from 1 to 48 .

you will see red sections for calculations.

result is always zero.

why?

At the part of the code in  red  the value of  i  is 47 so the variables  Trend_Yukselis1  &  Trend_Yukselis2  stay at their initial values of 0.0 and the Alert is never called . . .  please explain why you think the situation should be any different ?
 

You should write the calculation inside { }

for (i=0;i<=47;i++)
  {

  //--- write all your calculations here 

  }

//---

if(i==0)
  {

  //--- write all your calculations here 

  }
 
pascalboy: braces braces braces... are they everything?:)
Reason: