Errors, bugs, questions - page 1011

 
//Test.mqh
class A {
public:
        virtual int f() { return ( 1 ); }
};
//TestLib.mq5
#property library
#include "Test.mqh"
int g( A* pA ) export { return ( 5 ); }

//Test.mq5
#include "Test.mqh"
#import "TestLib.ex5"
        int g( A* pA );
#import
void OnStart()
{
        A* pA = new A();
        Print( g( pA ));
        delete( pA );
}
So far everything is fine, but as soon as I insert it into Test.mq5, for example
class B : public A {
};
and immediately generates execution error - not found g in TestLib.ex5
 
Silent:

datetime is already there

ArraySize - number of bars, ArraySize-1 - last bar, ArraySetAsSeries sets indexing direction, and cell number = bar, left or right.

There is a test scripthere .

Thank you! I'll give it a try.
 

Good afternoon!

For TimeCurrent, it is specified that it returns time of the last tick from MarketWatch. Trying to use it, it returns 20:30, although the last tick was 22:59:57

Why may it be so?

Thank you!

 
ns_k:

Good afternoon!

For TimeCurrent, it is specified that it returns time of the last tick from MarketWatch. Trying to use it, it returns 20:30, although the last tick was 22:59:57

Why may it be so?

Thank you!

From the help:

In the OnTick()handler , this function will return the time of the incoming tick being processed . In other cases (for example, in the OnInit(), OnDeinit(), OnTimer() handlers and so on) this is thearrival time of the last quote for any symbol available in the "Market Watch" window, the same time as shown in the header of this window.

 
Lizar:

From the reference:

Thank you!

Then how do I get the arrival time of the last quote in onCalculate?

 
ns_k:

Thank you!

Then how to get the arrival time of the last quote in onCalculate?

Listened to Time Pink Floyd and figured it out :)

if(SymbolInfoTick(Symbol(),last_tick))

     {

      Print(last_tick.time,": Bid = ",last_tick.bid,

            " Ask = ",last_tick.ask,"  Volume = ",last_tick.volume);

     }

   else Print("SymbolInfoTick() failed, error = ",GetLastError());

   lEnd=last_tick.time; 
 

Good afternoon!

ArrayResize doesn't seem to work in the global initialisation phase for static class/structure members.

struct Test{
static string arr[];
Test() {
ArrayResize(arr,5) ;
if (ArraySize(arr)!=5) Alert("We have a bug");
}
};
Test test;

 

Does anyone have the following problem:

Terminal version and bit

Windows 8, MetaTrader 5 - Alpari UK, Build 821, 64 bit.

Problem description

Indicator on H1 calls indicator on M1. CopyBuffer command copies wrong data. This problem is only in the strategy tester. In the terminal all data is copied without errors. The M1 indicator copies the data into the first buffer.

The sequence of actions

In the strategy tester, I select to test the SampleCopyBuffer indicator on H1. I set the period from 2013-05-01 to 2013-07-07. Click Start, and read the error messages in the logs.

I get result.

And I read the error messages in the logs. Indicator buffer value from M1 does not match the CopyHigh value.

Expected result

CopyBuffer and CopyHigh values should be equal.

Further information

There is no error in the terminal at start-up. Only in the strategy tester. Please see my indicators in the appendix. SampleHighs works on M1 and is called from the SampleCopyBuffer indicator which works on H1.
Files:
 
denmax:

Good afternoon!

ArrayResize doesn't seem to work in the global initialisation phase for static class/structure members.

struct Test{
static string arr[];
Test() {
ArrayResize(arr,5) ;
if (ArraySize(arr)!=5) Alert("We have a bug");
}
};
Test test;

Thank you for the message, we will correct the error. Your code will generate an error about the absence of static string arr[]; for your code to work correctly you need to "place" the static variable before the test instance of the Test class.

struct Test{
   static string arr[];
   Test() {
       ArrayResize(arr,5) ;
       if (ArraySize(arr)!=5) Alert("We have a bug"); 
    } 
};

string Test::arr[];

Test test; 
 

Good afternoon!

I am writing a script which should analyse some characteristics of custom indicator of my own production :)

In the help it is specified to useIndicatorCreate

for receiving indicator handle. I understand almost everything, but it looks very strange, when the indicator is in the chart which the script uses, it needs to create the indicator again. Maybe there is a way to get the already calculated indicator values in the script?

Thank you!

Reason: