Errors, bugs, questions - page 1973

 
Stanislav Korotky:
Could you please suggest an algorithm to calculate volumes for a particular bar (maybe it's already described somewhere?). For example, we request with CopyTicksRange all ticks for a particular bar and we need to get as a result of calculations the same volume (both real and ticks) that is displayed in Data Window. I have discrepancies in both volumes for exchange instruments by orders of magnitude (to be specific, take AFLT on MQ-Demo). For forex, the tick volumes are the same, the real volumes are out of the question there.
When summing up the volumes, check the flags - TICK_FLAG. Otherwise, you will count the same volume several times in total.
 
Dmitriy Skub:
When summing up the volumes, you must check the flags - TICK_FLAG. Otherwise, you will count the same volume several times in total.

Of course I watch the flags. That's what I was asking - I just wanted specifics. It has already been answered. It's easier to request _TRADE ticks. It works.

 
Stanislav Korotky:

Of course I watch the flags. That's what I was asking - I just wanted specifics. It has already been answered. It's easier to request _TRADE ticks. It works.

You can also apply a flag depending on ENUM_SYMBOL_CALC_MODE

 
Alexey Viktorov:

You can also apply a flag depending on ENUM_SYMBOL_CALC_MODE

Of course I do.

 
Comments not related to this topic have been moved to "Questions from MQL4 MT4 MetaTrader 4 beginners".
 
internal error #27
#import "Test.ex5"
        int f();
#import
static int i = Test::f();
 
Николай Никитюк:

If I need the "LongCondition" and "ShortCondition" functions to use the results of calculations from the TrendTenkan method, and I still can't do it. Does this mean that LongCondition has to call TrendTenkan ?

I can only tweak the obvious errors:

for(i=idx+1;i<idx+21;i++)
     {if(DiffKijun(i)>0.0) {value_t=TYPE_TREND_UP; break; return(value_t);}
//здесь явно что-то не так
//return после break не имеет смысла

I don't know where what should be called from

 

internal error #112

class A;
struct B {
        void f() { a.g(); }
        A *a;
};
void OnStart()
{
        B b;
        b.f();
}
 

In build 1653, the runtime error has not disappeared, but has moved to a different part of the code:

Cannot find 'f1' in 'Test2.ex5'

//Test.mqh
class B {
        virtual void  f() {}
};
class C {
        virtual void g( B& ) {}
};
class A : C {};
#import "Test2.ex5"
        A *f1();
        B *f2();
#import
//Test.mq5
#include "Test.mqh"
void OnStart()
{
        f1();
}
//Test2.mq5
#property library
#include "Test.mqh"
A *f1() export { return NULL; }
B *f2() export { return NULL; }
 

Compilation error

#import "Test.ex5"
        void g();   //g(1)
#import
        void g() {} //g(2)
typedef void (*fn)();
void f( fn )       {}
void f( int, int ) {}
void OnStart()
{
        f( Test::g ); //нормально
        f(     ::g ); //error: 'f' - no one of the overloads can be applied to the function call
        f(       g ); //error: 'f' - no one of the overloads can be applied to the function call
//а как иначе указать что g - это g(2) ... и причем здесь overloads ???
        fn gg = g;    //нормально
        f( gg );
}
Reason: