Errors, bugs, questions - page 1747

 

How can I remove the visual sticking of NOT LABEL objects to the time coordinates of bars?

I set the time-coordinate of the object to seconds, but it visualises as if I set it to the timeframe.

I dug the question

Forum on trading, automated trading systems and strategy testing

Errors, Bugs, Questions

Andrew Petras, 2014.11.26 13:34

I am very good at moving objects like triangle, ellipse or rectangle, and the anchor points are disproportionately "floating".

It doesn't depend on these settings


I create


drag and drop


The rectangle is "drifting" the second point, the triangle and ellipse have the third point.

Can this be fixed? I need accurate "measurements".

When I select "Precise time scale", the mentioned binding disappears and everything is shown as it should be. However, I have not found anywhere in MQL5 how to enable/disable this parameter. Is it not provided for?

 

Really need some help! Been trying to figure out the cause of the strange behaviour for a few hours. In the end I wrote an EA with quite an unexpected result

#define TOSTRING(A) #A + " = " + (string)A + "\n"

string TimeToString( const ulong Time )
{
  return(TimeToString(Time / 1000, TIME_DATE|TIME_SECONDS) + "." + ::IntegerToString(Time % 1000, 3, '0'));
}

void OnTick()
{
  static MqlTick PrevTick = {0};
  
  MqlTick NowTick;
  
  if (SymbolInfoTick(_Symbol, NowTick) && (PrevTick.time_msc > NowTick.time_msc))
    Alert(TOSTRING(TimeToString(PrevTick.time_msc)) + TOSTRING(TimeToString(NowTick.time_msc)));
    
  PrevTick = NowTick;  
}

The result (bottom-up)

2016.10.31 11:55:51.031 Test10 (Si-12.16,M1)    TimeToString(NowTick.time_msc) = 2016.10.31 12:58:10.698
2016.10.31 11:55:51.031 Test10 (Si-12.16,M1)    TimeToString(PrevTick.time_msc) = 2016.10.31 12:58:10.702
2016.10.31 11:55:50.979 Test10 (Si-12.16,M1)    
2016.10.31 11:55:50.979 Test10 (Si-12.16,M1)    TimeToString(NowTick.time_msc) = 2016.10.31 12:58:10.654
2016.10.31 11:55:50.979 Test10 (Si-12.16,M1)    TimeToString(PrevTick.time_msc) = 2016.10.31 12:58:10.656
2016.10.31 11:55:45.792 Test10 (Si-12.16,M1)    
2016.10.31 11:55:45.792 Test10 (Si-12.16,M1)    TimeToString(NowTick.time_msc) = 2016.10.31 12:58:05.458
2016.10.31 11:55:45.792 Test10 (Si-12.16,M1)    TimeToString(PrevTick.time_msc) = 2016.10.31 12:58:05.464
2016.10.31 11:53:45.807 Test10 (Si-12.16,M1)    
2016.10.31 11:53:45.807 Test10 (Si-12.16,M1)    TimeToString(NowTick.time_msc) = 2016.10.31 12:56:05.474
2016.10.31 11:53:45.807 Test10 (Si-12.16,M1)    TimeToString(PrevTick.time_msc) = 2016.10.31 12:56:05.476

SymbolInfoTick sometimes returns (you have to wait) a tick with a time lower than the previous one!

What the heck is that all about! Configuration

Network 'xxx': authorized on BCS-MetaTrader5 through Access Server #2 (ping: 112.19 ms)
Terminal        C:\Program Files\BCS Broker MetaTrader 5 Terminal
Terminal        Windows 7 Ultimate (x64 based PC), IE 09.00, Intel Core i7-2700K  @ 3.50GHz, RAM: 11327 / 16301 Mb, HDD: 4346 / 30000 Mb, GMT+02:00
Terminal        MetaTrader 5 x64 build 1455 started (MetaQuotes Software Corp.)
 
fxsaber:

Really need some help! Been trying to figure out the cause of the strange behaviour for a few hours. In the end I wrote an EA with quite an unexpected result

#define TOSTRING(A) #A + " = " + (string)A + "\n"

string TimeToString( const ulong Time )
{
  return(TimeToString(Time / 1000, TIME_DATE|TIME_SECONDS) + "." + ::IntegerToString(Time % 1000, 3, '0'));
}

void OnTick()
{
  static MqlTick PrevTick = {0};
  
  MqlTick NowTick;
  
  if (SymbolInfoTick(_Symbol, NowTick) && (PrevTick.time_msc > NowTick.time_msc))
    Alert(TOSTRING(TimeToString(PrevTick.time_msc)) + TOSTRING(TimeToString(NowTick.time_msc)));
    
  PrevTick = NowTick;  
}

The result (bottom-up)

2016.10.31 11:55:51.031 Test10 (Si-12.16,M1)    TimeToString(NowTick.time_msc) = 2016.10.31 12:58:10.698
2016.10.31 11:55:51.031 Test10 (Si-12.16,M1)    TimeToString(PrevTick.time_msc) = 2016.10.31 12:58:10.702
2016.10.31 11:55:50.979 Test10 (Si-12.16,M1)    
2016.10.31 11:55:50.979 Test10 (Si-12.16,M1)    TimeToString(NowTick.time_msc) = 2016.10.31 12:58:10.654
2016.10.31 11:55:50.979 Test10 (Si-12.16,M1)    TimeToString(PrevTick.time_msc) = 2016.10.31 12:58:10.656
2016.10.31 11:55:45.792 Test10 (Si-12.16,M1)    
2016.10.31 11:55:45.792 Test10 (Si-12.16,M1)    TimeToString(NowTick.time_msc) = 2016.10.31 12:58:05.458
2016.10.31 11:55:45.792 Test10 (Si-12.16,M1)    TimeToString(PrevTick.time_msc) = 2016.10.31 12:58:05.464
2016.10.31 11:53:45.807 Test10 (Si-12.16,M1)    
2016.10.31 11:53:45.807 Test10 (Si-12.16,M1)    TimeToString(NowTick.time_msc) = 2016.10.31 12:56:05.474
2016.10.31 11:53:45.807 Test10 (Si-12.16,M1)    TimeToString(PrevTick.time_msc) = 2016.10.31 12:56:05.476

SymbolInfoTick sometimes returns (you have to wait) a tick with a time lower than the previous one!

What the heck is that all about! Configuration

Network 'xxx': authorized on BCS-MetaTrader5 through Access Server #2 (ping: 112.19 ms)
Terminal        C:\Program Files\BCS Broker MetaTrader 5 Terminal
Terminal        Windows 7 Ultimate (x64 based PC), IE 09.00, Intel Core i7-2700K  @ 3.50GHz, RAM: 11327 / 16301 Mb, HDD: 4346 / 30000 Mb, GMT+02:00
Terminal        MetaTrader 5 x64 build 1455 started (MetaQuotes Software Corp.)
Yes, you're not the only one who needs help here. I've been trying to roll the ticks normally into a candle for a few weeks now. So... the ticks are still raw. Bid in SD#1598238
 

Magic line

#include "key.mqh"
virtual int f( const ABCDEFGHIJK ) const { return ABCDEFGHIJK; }

Sequence of actions (strict)

  1. Place the attached files in the same folder. Then with mouse in MetaEditor
  2. File->Open->Select Test.mqh->Open button
  3. Edit->Search and Replace->Replace->fill in the Find: and 'Replace with:' fields as shown below->the 'Replace All' button

Result:

Settings here: https://www.mql5.com/ru/forum/1111/page1127#comment_795376

Files:
Test.mqh  1 kb
key.mqh  1 kb
 
Alexey Kozitsyn:
Yes, you're not the only one who needs help here. I've been trying to roll my tics properly into a candle for a few weeks now. So... the tics are still raw. Bid in SD#1598238
The tics are rolling into the candle normally.
 
fxsaber:
Tiki rolls into the candle normally.
Really? And the volumes match? And have you done the controls? And can you even show the logs?
 
Alexey Kozitsyn:
Really? And the volumes are the same? And you have performed the controls? And can you even show the logs?

Did the control - watch the codobase. Don't care about the mismatch between candlestick volumes and calculated ones, because it's about a boundary tick, which can fall into either one bar or the other. This is not principal. I also posted the trade turnover indicator on the forum. So there is no problem at all.

In your case, if you get very nerdy, you can pick on the bar creation mechanism, but not on CopyTicks.

 

Compilation error

class A {
protected:
        void f(  int ) {} //(*)
};
class B : public A {
public:
        void f( uint ) {}
};
void OnStart()
{
        B b;
        b.f( 1 ); //'A::f' - cannot call protected member function
}

And if you remove the (*) line, everything is OK. What's wrong with B::f(uint)? If you look at the situation from the other side

class A {
public:
        void f(  int ) {} //(**)
};
class B : public A {
public:
        void f( uint ) {}
};

we can see the fundamental disadvantages of the MQL algorithm of searching for a matching function. In the 2nd example, B::f(uint) will be called until there is no string (**). As soon as line (**) appears, A::f(int) will be called. It means that changes in the base class affect the final result, while in C++ B::f(uint) will be always called regardless of changes in the base class, which guarantees the stability of the final result.

In MQL, it turns out that the A class developer just invented a new public\protected\private function and because of this the B class user stopped compiling the code and/or, what is more important, the final result has changed

 
A100:

Magic line

#include "key.mqh"
virtual int f( const ABCDEFGHIJK ) const { return ABCDEFGHIJK; }

Sequence of actions (strict)

  1. Place the attached files in the same folder. Then with mouse in MetaEditor
  2. File->Open->Select Test.mqh->Open button
  3. Edit->Search and Replace->Replace->Fill in the Find: and 'Replace with:' fields as shown below->the 'Replace All' button

Result:

Settings here: https://www.mql5.com/ru/forum/1111/page1127#comment_795376

Thanks for the post, bug will be fixed in next update.
 
A100:

Compilation error

class A {
protected:
        void f(  int ) {} //(*)
};
class B : public A {
public:
        void f( uint ) {}
};
void OnStart()
{
        B b;
        b.f( 1 ); //'A::f' - cannot call protected member function
}

And if you remove the (*) line, everything is OK. What's wrong with B::f(uint)? If you look at the situation from the other side

class A {
public:
        void f(  int ) {} //(**)
};
class B : public A {
public:
        void f( uint ) {}
};

we can see the fundamental disadvantages of the MQL algorithm of searching for a matching function. In the 2nd example, B::f(uint) will be called until there is no string (**). As soon as line (**) appears, A::f(int) will be called. It means that changes in the base class affect the final result, while in C++ B::f(uint) will always be called regardless of changes in the base class, which guarantees the stability of the final result.

In MQL, it turns out that the A class developer just invented a new public\protected\private function and because of this the B class user stopped compiling the code and/or, more critically, the end result has changed.

Just the constant "1" in the b.f( 1 ) call is interpreted as int. Do an explicit conversion and everything will work:

b.f( (uint)1 );