Download MetaTrader 5
To add comments, please log in or register
Carry on your private correspondence in your profile. It is secure!
Max
58
Max 2014.03.24 20:33 

I have an old indicator source code, but when I try to recompile with build +600 I obtain the following errors:

'Close' - constant variable cannot be passed as reference HurstExponent.mq4 228 50
'Open' - constant variable cannot be passed as reference HurstExponent.mq4 229 50
'High' - constant variable cannot be passed as reference HurstExponent.mq4 230 50

'Low' - constant variable cannot be passed as reference HurstExponent.mq4 231 50


How can I fix the code to pass the new compiler?
The "block" of involved code is the following:


void _computeLastNbBars( int lastBars )
{
int pos;


switch( e_type_data )
{
case PRICE_CLOSE : _computeFdi( lastBars, Close ); break;
case PRICE_OPEN : _computeFdi( lastBars, Open ); break;
case PRICE_HIGH : _computeFdi( lastBars, High ); break;
case PRICE_LOW : _computeFdi( lastBars, Low ); break;
case PRICE_MEDIAN :
for( pos = lastBars; pos >= 0; pos-- ) ExtInputBuffer[pos] = (High[pos]+Low[pos])/2.0; _computeFdi( lastBars, ExtInputBuffer );
break;
case PRICE_TYPICAL :
for( pos = lastBars; pos >= 0; pos-- ) ExtInputBuffer[pos] = (High[pos]+Low[pos]+Close[pos])/3.0; _computeFdi( lastBars, ExtInputBuffer );
break;
case PRICE_WEIGHTED :
for( pos = lastBars; pos >= 0; pos-- ) ExtInputBuffer[pos] = (High[pos]+Low[pos]+Close[pos]+Close[pos])/4.0; _computeFdi( lastBars, ExtInputBuffer );
break;
default :
Alert( "[ 20-ERROR " + FILENAME + " ] the imput parameter e_type_data <" + e_type_data + "> is unknown" );
}
}

whroeder1
13624
whroeder1 2014.03.24 20:41  
maxxmax:
'Close' - constant variable cannot be passed as reference HurstExponent.mq4 228 50
'Open' - constant variable cannot be passed as reference HurstExponent.mq4 229 50
'High' - constant variable cannot be passed as reference HurstExponent.mq4 230 50
'Low' - constant variable cannot be passed as reference HurstExponent.mq4 231 50
case PRICE_CLOSE : _computeFdi( lastBars, Close ); break; 

  1. Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. Don't pass them by reference. They are constant
    void _computeFdi( int lastBars, const double& Price[]){ ...

/
To add comments, please log in or register