Errors, bugs, questions - page 1778

 
Evgeny Chernyshev:
Good afternoon!

This is standard behaviour. The countdown starts from the current bar which is under construction. Accordingly, with the appearance of a new bar, in the absence of autoscrolling, its number is incremented by one.
Ok, then please add somewhere in the documentation that it is not the "first visible bar", but the first bar starting from the current (unfinished) one.
 

Error during execution as a result of compilation

#define MACRO( x )      #x
void OnStart()
{
        Print( MACRO( "1\0" )); //равносильно Print( "\"1\\0\"" );
}

Result : 1

Expected: "1\0".

2 errors: Quote marks missing " and misinterpreted \ character

and then

void OnStart()
{
        Print( MACRO( 1\0 )); //Error: '\' - illegal escape sequence
}
compile time error whereas the expected result was "10".
 
Vladislav Andruschenko:

Yes, but you can't explain that to customers, can you?

Imagine that the expert is working, it works, you go to sleep, you go to sleep, you wake up and the expert is not working, why?

It helps to restart with a short delay, something like this:

int err=-1;
      int count=5;
      {while((err!=0)&&(count>0))
      {
         ResetLastError();
         EventSetMillisecondTimer(MSTimerSet);                    //Установка таймера XXX миллисекунд
         err=GetLastError();
         Print("EventSetMillisecondTimer n=",count," err >>",err);
         {if(err!=0){Sleep(50);}}
      }}//while((err!=0)&&(count>0))
 
Yury Kirillov:

It helps to restart with a slight delay, of sorts:

int err=-1;
      int count=5;
      {while((err!=0)&&(count>0))
      {
         ResetLastError();
         EventSetMillisecondTimer(MSTimerSet);                    //Установка таймера XXX миллисекунд
         err=GetLastError();
         Print("EventSetMillisecondTimer n=",count," err >>",err);
         {if(err!=0){Sleep(50);}}
      }}//while((err!=0)&&(count>0))
I found out by experience that the timer hangs up when the internet glitches. The terminal freezes and the timer hangs up. I.e. It can hang up for no reason. When the Internet is slow.

So I did it differently, namely. Running the timer in a tick.
 

Execution error

typedef void (*fn)();
class A { public:
        fn a;
};
class B : public A { public:
        void a() { Print( __FUNCSIG__ ); }
};
void OnStart()
{
        B b;
        b.a();
}

Result: invalid function pointer call; execution of B::a() was expected

and here -> compile error

typedef void (*fn)( int );
class A { public:
        fn a;
};
class B : public A { public:
        void a() { Print( __FUNCSIG__ );  }
};
void OnStart()
{
        B b;
        b.a(); //Error: 'a' - wrong parameters count
}
 
MT4 skips user events in packs. Is this a feature or a bug?
 
Andrey Dik:
MT4 is skipping user events in packs. Is this a bug or a bug?


just checked on the dashboard - all is ok, all events are working fine

 
Vladislav Andruschenko:

just checked on the dashboard - all is OK, all events are working as normal

I've run spies on a few symbols and the EA gets events from these spies when the ticks come in. On MT5 all events have time to come, but on MT4 I can see freezes sometimes for a second or more.
Nothing heavy is running, one chart is open.
 
I cannot get an adequate value of margin requirement to open a position. I get the same value for all symbols, different brokers have different values, one shows 0.0 for all symbols, another shows 100000.0.

What is going on with MT4? Win 10 64, MT4 build 1031

doing so:

void OnStart()
{
  Print(MarketInfo (Symbol (), MODE_MARGININIT));
  Print(MarketInfo (Symbol (), MODE_MARGINMAINTENANCE));
  Print(MarketInfo (Symbol (), MODE_MARGINHEDGED));
  Print(MarketInfo (Symbol (), MODE_MARGINREQUIRED));
  Print(SymbolInfoDouble (Symbol (),SYMBOL_MARGIN_INITIAL));
}
Either MT4 is totally screwed up, or I'm completely unlearned and no longer understand MT4.

Here are the values obtained from 2 brokers:


2017.01.31 22:15:59.312 Script MarginReq AUDCHF,M15: removed
2017.01.31 22:15:59.310 MarginReq AUDCHF,M15: uninit reason 0
2017.01.31 22:15:59310 MarginReq AUDCHF,M15: 0.0
2017.01.31 22:15:59.310 MarginReq AUDCHF,M15: 1000.0
2017.01.31 22:15:59.310 MarginReq AUDCHF,M15: 100000.0
2017.01.31 22:15:59.310 MarginReq AUDCHF,M15: 0.0
2017.01.31 22:15:59.310 MarginReq AUDCHF,M15: 0.0
2017.01.31 22:15:59.309 MarginReq AUDCHF,M15: initialized
2017.01.31 22:15:59.300 MarginReq AUDCHF,M15 inputs: Input1=0;
2017.01.31 22:15:57.899 Script MarginReq AUDCHF,M15: loaded successfully
2017.01.01.31 22:13:38.077 Script MarginReq AUDCHF,M15: removed
2017.01.31 22:13:38.075 MarginReq AUDCHF,M15: uninit reason 0
2017.01.31 22:13:38.075 MarginReq AUDCHF,M15: 100000.0
2017.01.31 22:13:38.075 MarginReq AUDCHF,M15: 1000.0
2017.01.31 22:13:38.075 MarginReq AUDCHF,M15: 100000.0
2017.01.31 22:13:38.075 MarginReq AUDCHF,M15: 0.0
2017.01.31 22:13:38.075 MarginReq AUDCHF,M15: 100000.0
2017.01.31 22:13:38.075 MarginReq AUDCHF,M15: initialized
2017.01.01.31 22:13:38.066 MarginReq AUDCHF,M15 inputs: Input1=0;
2017.01.31 22:13:36.806 Script MarginReq AUDCHF,M15: loaded successfully
This is bullshit.
 
Andrey Dik:
I cannot get an adequate value of margin requirement to open a position. I get the same value for all symbols, different brokers have different values, one shows 0.0 for all symbols, another shows 100000.0.

What is going on with MT4? Win 10 64, MT4 build 1031

doing so:

void OnStart()
{
  Print(MarketInfo (Symbol (), MODE_MARGININIT));
  Print(MarketInfo (Symbol (), MODE_MARGINMAINTENANCE));
  Print(MarketInfo (Symbol (), MODE_MARGINHEDGED));
  Print(MarketInfo (Symbol (), MODE_MARGINREQUIRED));
  Print(SymbolInfoDouble (Symbol (),SYMBOL_MARGIN_INITIAL));
}
Either MT4 is totally screwed up, or I'm completely unlearned and no longer understand MT4.

Here are the values obtained from 2 brokers:


2017.01.31 22:15:59.312 Script MarginReq AUDCHF,M15: removed
2017.01.31 22:15:59.310 MarginReq AUDCHF,M15: uninit reason 0
2017.01.31 22:15:59310 MarginReq AUDCHF,M15: 0.0
2017.01.31 22:15:59.310 MarginReq AUDCHF,M15: 1000.0
2017.01.31 22:15:59.310 MarginReq AUDCHF,M15: 100000.0
2017.01.31 22:15:59.310 MarginReq AUDCHF,M15: 0.0
2017.01.31 22:15:59.310 MarginReq AUDCHF,M15: 0.0
2017.01.31 22:15:59.309 MarginReq AUDCHF,M15: initialized
2017.01.31 22:15:59.300 MarginReq AUDCHF,M15 inputs: Input1=0;
2017.01.31 22:15:57.899 Script MarginReq AUDCHF,M15: loaded successfully
2017.01.01.31 22:13:38.077 Script MarginReq AUDCHF,M15: removed
2017.01.31 22:13:38.075 MarginReq AUDCHF,M15: uninit reason 0
2017.01.31 22:13:38.075 MarginReq AUDCHF,M15: 100000.0
2017.01.31 22:13:38.075 MarginReq AUDCHF,M15: 1000.0
2017.01.31 22:13:38.075 MarginReq AUDCHF,M15: 100000.0
2017.01.31 22:13:38.075 MarginReq AUDCHF,M15: 0.0
2017.01.31 22:13:38.075 MarginReq AUDCHF,M15: 100000.0
2017.01.31 22:13:38.075 MarginReq AUDCHF,M15: initialized
2017.01.01.31 22:13:38.066 MarginReq AUDCHF,M15 inputs: Input1=0;
2017.01.31 22:13:36.806 Script MarginReq AUDCHF,M15: loaded successfully
This is bullshit.

try

AccountFreeMarginCheck

Reason: