Errors, bugs, questions - page 35

 
Interesting:

You need to check the dimensionality of the array, it's most likely that a non-existent "cell" (or an existing but differently numbered cell) has been accessed there...

Arrays are indexed starting from 0, so when an array index is accessed without taking this feature into account, it often goes out of range...

Thanks, I've fixed that. But now in the tester the graph is a straight line, no error log and no entry:

2010.07.06 15:15:38 Core 1 Disconnected
2010.07.06 15:15:38 Core 1 Log file "C:\Program Files\MetaTrader 5\Tester\Agent-127.0.0.1-3000\logs\20100706.log" written
2010.07.06 15:15:38 Core 1 GBPUSD,M5: 107944 ticks (552 bars) generated within 97266 ms (total bars in history 108713)
2010.07.06 15:15:38 Core 1 OnTester result 0

Where do I look next.

 
Rosh:

Here is the answer to your application


Try slightly modified versions, everything matches

I've tried both 0 and 1 and it doesn't match either, and I'm talking about the tester, not running it on a chart
 
Rosh:

....

I've never seen one of these before

static int Handle;
Why static? Is there a pitfall?
 
Prival:

Why static? Is there a pitfall?

I can't find where I got it from, but I must have copied it from someone's expert.

I don't know any pitfalls - static can be removed

 
ddd06:

I can't find where I got it from, but I must have copied it from someone's expert.

Don't know any stones - static can be removed

I didn't know it was yours. I think Rosh wrote it that way, I try to look through his codes carefully, at least someone to learn from, it's a pity he does not write and post, sometimes even in two lines there is something nice.
 
AM2:

Thank you I have corrected that. But now in the tester the graph is a straight line, no error log and no entry:

2010.07.06 15:15:38 Core 1 Disconnected
2010.07.06.06 15:15:38 Core 1 Log file "C:\Program Files\MetaTrader 5\Tester\Agent-127.0.0.1-3000\logs\20100706.log" written
2010.07.06 15:15:38 Core 1 GBPUSD,M5: 107944 ticks (552 bars) generated within 97266 ms (total bars in history 108713)
2010.07.06 15:15:38 Core 1 OnTester result 0

Where do I look next.

How do I know what's there and how, in your code. Run it through debugger (F5 in EDITOR) and see what's going on...
 

Interesting:
Ну откуда я знаю что там и как, в вашем коде. Прогоните через дебагер (F5 в Эдиторе) и посмотрите, что и как там творится...

This is where I found the error:

double calc_SMA( int timeframe, int period, int offset )
{
    double Close[];
    ArraySetAsSeries(Close,true);
    double vMA = 0;
    double sum=0;
    int    i;

    for( i = 0 ; i < period ; i++ )
    {
        sum += CopyClose(_Symbol,_Period,0,i + offset,Close);
    }
    vMA = sum / period;

    return(vMA);
}

Expression Close[] Epression coul not be evaluated

writes

Originally it was like this:

double calc_SMA( int timeframe, int period, int offset )
{
    double vMA = 0;
    double sum=0;
    int    i;

    for( i = 0 ; i < period ; i++ ){
        sum += iClose( Symbol(), timeframe, i + offset );
    }
    vMA = sum / period;

    return(vMA);
}
 
AM2:

This is where I found the error:

Expression Close[] Epression coul not be evaluated

writes

Initially it was like this:

1. Look at the help for the CopyClose() function.

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

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

 
To developers, this question is as old as a mammoth - Is there an analogue of AccountFreeMarginMode() function that exists in MQL4 somewhere in MQL5? Or its result is not needed at all now?...
 
Interesting:
To developers, this question is as old as a mammoth - Is there an analogue of AccountFreeMarginMode() function that exists in MQL4 somewhere in MQL5? Or its result is not needed at all now?

It will be available soon - it's already in development.