iRSI showing weird values

 

Hi there !

cf . title. Anyone could help ?

double RSI[];
RSIHandle=iRSI(symbol,PERIOD_M1,14,PRICE_CLOSE);
if(RSIHandle<0)
     {
      Print("The creation of iRSI has failed: Runtime error =",GetLastError());
      //--- forced program termination
      return(-1);
     }
CopyBuffer(RSIHandle,0,0,1,RSI);
printf("RSI : %g",RSI[0])


The debug :

2014.12.15 00:13:47.527 2013.01.11 00:00:01   RSI : 7.37001e-268 <- unusual value
 

Solved. Loaded on the fly ... Here's in the indicator's source :

      //--- first RSIPeriod values of the indicator are not calculated
      ExtRSIBuffer[0]=0.0;
      ExtPosBuffer[0]=0.0;
      ExtNegBuffer[0]=0.0;
      double SumP=0.0;
      double SumN=0.0;


Workaround : make it sleep.

 

That is not a weird value, at least to me, it is a float value

NormalizeDouble(  7.37001e-268, 2 )

will give you a human readable value 

 
trevone:

That is not a weird value, at least to me, it is a float value

NormalizeDouble(  7.37001e-268, 2 )

will give you a human readable value 

Nope. Still invalid, a RSI @ 7.37 ... i'm even not sure it happens ... the first value aren't calculated, with a Sleep it's ok !
 
blouf:
Nope. Still invalid, a RSI @ 7.37 ... i'm even not sure it happens ... the first value aren't calculated, with a Sleep it's ok !

What is the value returned by CopyBuffer() when you get this weird RSI ?

int value=CopyBuffer(RSIHandle,0,0,1,RSI);
value=?
 
angevoyageur:

What is the value returned by CopyBuffer() when you get this weird RSI ?

value=?
The same as I told you the indicator when loaded doesn't calculate the first values. Now it's ok, solved.
 
blouf:

The same as I told you

You don't give the value I asked.

the indicator when loaded doesn't calculate the first values.

Except it's not right.

CopyBuffer(RSIHandle,0,0,1,RSI);

In your EA, you are copying the RSI value of current candle (last open candle).

While this inside RSI indicator :

      //--- first RSIPeriod values of the indicator are not calculated
      ExtRSIBuffer[0]=0.0;
      ExtPosBuffer[0]=0.0;
      ExtNegBuffer[0]=0.0;

refer to the oldest candle on your chart. Inside this indicator buffers are not index as timeseries, so index 0 is the oldest candle, not the current candle.

Now it's ok, solved.

By chance.

 
angevoyageur:
You don't give the value I asked.

Except it's not right.

In your EA, you are copying the RSI value of current candle (last open candle).

While this inside RSI indicator :

refer to the oldest candle on your chart. Inside this indicator buffers are not index as timeseries, so index 0 is the oldest candle, not the current candle.

By chance.

:) I yet not solved the optimization problem. Even when allowing 3 gb.  Without the agent (I btw have to repay each pass requeued) how much time will it take ? On MQL4, there's no agent, does it last ... err a month ?

2014.12.15 15:23:53	MQL5 Cloud Europe 2	genetic pass (0, 265) tested with error "no memory in OnTick function (cannot get 4096 Kb, used 0 Mb)" in 812 ms (PR 193)
2014.12.15 15:24:02     MQL5 Cloud Europe 2     genetic pass (0, 470) tested with error "critical runtime error 520 in global initialization function (cannot load expert because of transformation error)" in 1 ms (PR 193)
 
blouf:

:) I yet not solved the optimization problem. Even when allowing 3 gb.  Without the agent (I btw have to repay each pass requeued) how much time will it take ? On MQL4, there's no agent, does it last ... err a month ?

Don't mix topics please. Your other topic is here.
 
angevoyageur:
Don't mix topics please. Your other topic is here.
Seems nobody has an answer. Still waiting the service desk answer :/