Errors, bugs, questions - page 1313

 
Konstantin Karpov:
How to determine at compile time which bit mode the terminal is? The TERMINAL_X64 identifier does not fit as it is intended for functions. Most likely, there are macros which are not mentioned in the help, but they occasionally pop up in one way or another :)
Alas, they don't. There is a variable _IsX64 but it works at runtime.
 

How can I get out of using two dlls, one for 32 bit terminals and one for 64 bit terminals? It's not kasher to keep two copies of the program...

By the way, who has experience, if you compile code in ME x64, it will work on 32-bit terminals without errors or there will be some hidden features of code execution?

 

For example, there is funcTest(...) function in the library for 32-bit terminals library_x86.dll and for 64-bit terminals library_x64.dll.

If import is visible within the whole file, is it correct to write such a construct:

void CClass::Test(...) {
  код метода...

   if(TerminalInfoInteger(TERMINAL_X64)) {
      #import  library_x64.dll
         library_x64::funcTest(...);
      #import
   } else {
      #import  library_x86.dll
         library_x86::funcTest(...);
      #import
   }

   код метода...
}
or won't this trick work?
 
Konstantin Karpov:
Or this trick won't work?

As far as I know, no. You can import both dlls and call the functions of one or the other depending on the bit rate of the terminal.

In general, splitting into two versions by bit rate is not such a delusional option.

 

I take an indicator (any of the standard set), call it in the Expert Advisor:

iCustom (NULL, 0, "Momentum", 0, 1);

After running the EA with visualization in the tester - everything works, the indicator is drawn.

Now I change one line in the indicator

ExtMomBuffer[i]=close[i]*100/close[i-InpMomPeriod];

to this line:

ExtMomBuffer[i]=100;

And now the indicator does not draw anything at all - even a vertical scale is not marked.

Where is the error? MetaTrader 4 build 765.

 
You need two different values within the window to make the scale appear? EMNIP. Not sure if this can be considered a bug.
 

OK, let's call it unconventional behaviour :)

Thank you very much, but I have one more question. Yeah, it worked like this:

ExtMomBuffer[i]=i%2;

And this is how it stopped working again:

ExtMomBuffer[0]=i%2;

I had it working in the old versions of MT, what's wrong with the new ones?

 

So in the second option there is one value.

Actually, I could be wrong.

 

Well you can do it like this, it still doesn't work:

ExtMomBuffer[0]=cnt++;

The crux of the problem is that trying to write to the 0 bar of the indicator at each step of the EA - does nothing.

 

I think I've found where to dig. Changed

ArraySetAsSeries(ExtMomBuffer,false);

to true and something's starting to show. I'm going to go get drunk.