Errors, bugs, questions - page 2863

 
Konstantin Efremov:

No. In such constructions, the only solution is to convert the indicator into a class and add it to the Expert Advisor as an instance of the class, then you can build the sequence of calculations

The point is that the indicator itself is a separate class that works with any basic indicators of the same type. This is very bad, unless there is some tricky solution.

 

I have a puzzle question.

Compare the two pictures and tell me what the trick is?

1. The Expert Advisor is running on the chart.


2. The second one is the same Expert Advisor. The chart after a single test.


 
Can you tell me if this is possible?
#define  VALUE 10

#define  MACROS

#ifdef  MACROS
  // Нужно VALUE увеличить в два раза.
#endif
 
fxsaber:
Can you tell me if this is possible?
#define  VALUE 10

#define  MACROS

#ifdef  MACROS
   #ifdef  VALUE
      #undef  VALUE
   #endif
   #define  VALUE 20
#endif

or

#define  DEFAULT_VAL 10

#define  VALUE DEFAULT_VAL

#define  MACROS

#ifdef  MACROS
   #ifdef  VALUE
      #undef  VALUE
   #endif
   #define  VALUE (2*DEFAULT_VAL)
#endif
 
Vladimir Simakov:

or

I don't have access to the original VALUE definition. Otherwise, of course, I would make the same option.

 
fxsaber:
Can you tell me if this is possible?

For some reason it's not working:

#define  VALUE 10

#define  MACROS

#ifdef  MACROS
  // Нужно VALUE увеличить в два раза.
  #define  TMP VALUE
  #undef  VALUE
  #define  VALUE (TMP*2)  // Если заменить на (10*2) - компилируется!
#endif

int OnInit(void)
{
        Print( "VALUE = ", VALUE ); //'VALUE' - undeclared identifier
        return(INIT_FAILED);
}
 
Andrey Khatimlianskii:

For some reason it's not working:

#define  INITIAL_VALUE 10
#define  VALUE INITIAL_VALUE

#ifdef  MACROS
  #define  VALUE 2*INITIAL_VALUE
#endif
Probably just like this
 
TheXpert:
It's probably the only way

Unfortunately, the challenge is not being met.

 
It's not possible to create a poll in the forum, clicking on create will take you back to the home page.
 
TheXpert:
That's probably the only way.

So why isn't it working?

@Ilyas@Slava?

Reason: