coding problem - page 2

 
jopopo:

OK, i thought that ihigh(null,null,12) will sum every high of the 12th past bars...

there must be a better way than high+1 + high+2 .... but i don't find it

Please read the documentation iHigh()

Use a loop to loop through the values you want and keep a running total as you go, then when the loop finishes you can divide the running total by the number of items . . . it's 5 lines of code . . . or less, you can do it in 3.

 

hi,

i'm still working on it but getting stuck here, doesn't it make sense?

extern int     LookBack = 12;

-----------------------------------------

   double Range;
   double Averagerange;
  
   for (int n = current+1 ; n < current+1 + LookBack; n++)  
    { 
         
      Range = (High[current+1]-Low[current+1]);
      Averagerange = ((High[n]-Low[n])/LookBack);

if (Range < Averagerange)

}
 
jopopo: i'm still working on it but getting stuck here, doesn't it make sense?
  1. Nope, not even close. From wiki average
    That has TWO parts a SUM and a divide. Your non-compiling post tries to do it in one statement. Can't possibly work.
  2. For average range, why don't you use iATR?
  3. From my previous post - I suggest you follow the third suggestion because you certainly have followed the second.
 
jopopo:

hi,

i'm still working on it but getting stuck here, doesn't it make sense?

How do you keep a running total ?

Total = Total + new value ?

Reason: