Download MetaTrader 5
To add comments, please log in or register
What is a social trading? Read the article to find that out!
joe
63
joe 2014.02.28 09:25 

hello,

i'm trying to code an indicator to give me signals when the bar range is the highest of a specified period. ihighest[iatr ...] doesn't seem to work and i don't know where to start looking.

any idea?

thanks

qjol
3243
qjol 2014.02.28 10:02  

i tried to compile ur code & it works just fine

hoops there is no code

joe
63
joe 2014.03.07 09:01  

was trying another way than the ihighest[atr... still doesn't work proper :

  {
   int t = 0;
   for (int n=t;n<t+period;n++)
    { 

     double Mid = (High[t] + Low[t]) / 2.0;
     double Range = High[t]-Low[t];
     double Nrange = High[n]-Low[n];
      {
      if (Range >= Nrange) Signal[t] = Mid;
      }
    }
   }

can anyone give a hand here?

thanks

qjol
3243
qjol 2014.03.07 14:05  

iHighest

Returns the shift of the maximum value over a specific number of bars depending on type.

not the price

ydrol
594
ydrol 2014.03.07 14:19  

OP is after Biggest Range ?

if t is always 0 ( as it appears to be here) then following should work ..

// not mql - pseudo code!

int t=0;

int bestRange =t;

double Range = High[t] - Low[t];

for each candle 'n' before  {

   set Nrange ...

   if (Range < Nrange ) { 
      bestRange = n;  
      break; 
    }

}

if (bestRange == t) Signal[t] = Range/2;
qjol
3243
qjol 2014.03.07 14:35  
double Mid = (High[t] + Low[t]) / 2.0;

B.T.W.

iMA(Symbol(), Period(), 1, 0, MODE_SMA, PRICE_MEDIAN, shift) = Mid
/
To add comments, please log in or register