Errors, bugs, questions - page 36

 
Renat:
Coming soon - already in development.
OK, I'll wait, because my library is a bit incomplete...
 
alexvd:

1. Refer to the CopyClose() help function.

The function returns the amount of data copied to the array, not the closing price.

2. Are you looking at Close[] value in vtoche?

I'm looking at value of vMA and Close[]. It works fine in the wotch. I tried it this way:

     MqlRates mrate[]; 
double
calc_SMA( int timeframe, int period, int offset )
{    
    double vMA = 0;
    double sum=0;
    int    i;
    for( i = 0 ; i < period ; i++ )
    {
        sum += mRate[i].close;
    }
    vMA = sum / period;

    return(vMA);
}

Again I get another error. Maybe there is another way to calculate simple moving average, or to take the iMA handle and CopyBuffer to the right place?

 

Developers, don't consider me a complete cretin - Why do I need const when declaring functions? As I understand to declare their result as const (just can't understand the need for it).

For example, this declaration in CAccountInfo

string CAccountInfo::TradeModeDescription() const

Or am I mistaken?

 
Hello, when compiling the EA, I get a possible loss of data due to type conversion
mrequest.price=NormalizeDouble(Podd1,SymbolInfoInteger(Megasymbol,SYMBOL_DIGITS)); //Первая линия поддержки

Can you tell me what's wrong with the code?

Thank you

Документация по MQL5: Основы языка / Типы данных / Приведение типов
Документация по MQL5: Основы языка / Типы данных / Приведение типов
  • www.mql5.com
Основы языка / Типы данных / Приведение типов - Документация по MQL5
 
kirill190982:
Hello When compiling the EA, I get a note about possible loss of data due to type conversion

Can you tell me what's wrong with the code?

Thank you

... Possible data loss ...

I would check if variable types Podd1 and Megasymbol correspond to parameter types of NormalizeDouble() and SymbolInfoInteger() functions.

 

Question to the developers regarding "user" events and several experts working on the same terminal.

So I want to ask if I want to make it right or not?


Here is an idea.

In the course of the play we need to inform the "neighbouring" Expert Advisors about some processes that take place.

For example, the following processes should be monitored first:

1. Expert locking;

2. Unloading of the Expert Advisor;

3. Termination of trading operations;

4. Resume trading operations.


Implement

I. Create 4 identifiers of events:

1 - CHARTEVENT_CUSTOM+1//Starting the Expert Advisor

2 - CHARTEVENT_CUSTOM+2//Unloading of the Expert Advisor

3 - CHARTEVENT_CUSTOM+3 //Stop trading operations

4 - CHARTEVENT_CUSTOM+4//Restarting of trading operations


II. Tracking events

When a certain situation happens, the Expert Advisor generates a SPARTEVENT message using EventChartCustom.

At the same time,the Expert Advisor writes in sparam a comment (its name and type of the event, or other information) , andlparam its own chart identifier.

The Expert Advisors on other charts (if they can correctly identify the nature of an event) will respond to this specific EA.


PS

If the idea is good, may be it elaborated and arranged as an article. Or add it to help section dedicated to custom events?

 
kirill190982:
Hello, I get a possible loss of data due to type conversion warning when compiling the EA.

Please tell me what's wrong with the code.

Thanks


I need to explicitly convert the type of information being written to a variable type or function parameter.

In your case, it would probably be like this

mrequest.price=NormalizeDouble(Podd1,(int)SymbolInfoInteger(Megasymbol,SYMBOL_DIGITS)); //Первая линия поддержки

PS

But since this is a WARNING and not an error, it can be ignored (at least in most cases).

It'll just be a nuisance and that's all...

Документация по MQL5: Основы языка / Типы данных / Приведение типов
Документация по MQL5: Основы языка / Типы данных / Приведение типов
  • www.mql5.com
Основы языка / Типы данных / Приведение типов - Документация по MQL5
 
Yedelkin:

... Possible loss of data...

I would check if variable types Podd1 and Megasymbol correspond to parameter types of NormalizeDouble() and SymbolInfoInteger().

The Podd1 variable is double, Megasymbol is string. The meaning: pending order price = resistance level, let's say 1.259756, I want to normalize it to 5 digits (Megasymbol = EURUSD)
 
kirill190982:
The variable Podd1 is double, Megasymbol is string. The meaning: pending order price = resistance level, let's say 1.259756, I want to normalize it to 5 digits (Megasymbol = EURUSD)

The variables are probably OK. Please see my post above...

 
Interesting:

An explicit conversion of the type of information to be written to a variable type or function parameter is required.

In your case it will most likely be this

PS

But since this is a WARNING and not an error, it can be ignored (at least in most cases).

It will just be a nuisance and that's all...

I'll probably ignore it for now, but the compiler has never generated such warnings in MQL4
Reason: