Errors, bugs, questions - page 775

 
Neofit:

Thank you for responding.

I'm writing an indicator...unfortunately, the concept of the indicator assumes - that by the time we get to OnCalculate the optimal pair will be selected, which sounds suspiciously murky.

In general, in the function OnCalculate we should already use the results of calculations and analyses that were performed in On Init.

We can't transfer those calculations to OnCalculate, as we don't have time to perform all calculations between two neighboring ticks...

Everything turns out well and easily.

Move the analysis to a separate function and call it from OnCalculate. If there is no data, then exit OnCalculate and wait for the next tick.

The fact that the indicator really starts after 1-2 seconds is not a problem. Other way to work with strongly dependent and asynchronous processes is not possible, only lazy/ondemand initialization.

 
Renat:

This works out fine and easy.

Move the analysis to a separate function and call it from OnCalculate. If there is no data, then exit OnCalculate and wait for the next tick.

The fact that the indicator will actually start in 1-2 seconds is not a big deal. Other way to work with strongly dependent and asynchronous processes is impossible, only lazy/ondemand initialization.

Thank you for this tip. It has not occurred to me for some reason. I'll try to write my own "pseudo-init", although there's little hope. I tried to wait in OnInit, it didn't work, I got LastError 4007

ERR_ARRAY_RESIZE_ERROR

4007

Not enough memory to redistribute an array or an attempt to resize a static array

The array is dynamic, i.e. the 2nd part of the error definition about"an attempt to resize a static array" is gone, and I can hardly imaginewhat "insufficient memoryto redistribute an array"means.

for(int i=0;i<100;i++)
        {int p99=CopyBuffer(MaHandle1,0,0,n_analyzed_bars+shift_offset+2,MaBuffer1);
         if(CopyBuffer(MaHandle1,0,0,n_analyzed_bars+shift_offset+2,MaBuffer1)>0)       break;
         else  
         {
           Print("Getting MA is failed! Error",GetLastError()); 
           int err=GetLastError(); 
             Sleep(500);    
           //return(0);
         } 
         
        }
  
 
papaklass:
I have tried to make an indicator on the basis of another indicator. The first indicator selects a pair and the second one works on this pair.

Renat's advice helped a lot, I had problems with transferring iMA values to custom buffers, moved the code from OnInit to another function and with additional checks everything worked...now I'm working on it.

ZS Please advise the most convenient way to keep track of your own posts on the forum. Where can I see all posts addressed to me (replies to my posts)?

 

I haven't been following MT5 innovations for a long time, so I'll probably ask a very silly question.

I start optimization of a standard Expert Advisor, slow (full search of parameters) but it limits this full search to some 10490....

Log is full of some: 2012.07.13 21:48:10 Core 5 genetic pass (494, 2560000) tested with error "cannot initialize expert"

Then 2012.07.13 21:49:26 Tester genetic optimization finished on pass 9353 (of 816310000)


What genetic pass? What genetic optimization? Full overshoot, right?

I tried Fast optimization method(genetic algorithm) and saw the same thing.

What article should I read?).

Генетические алгоритмы - это просто!
Генетические алгоритмы - это просто!
  • 2010.05.25
  • Andrey Dik
  • www.mql5.com
В статье автор расскажет об эволюционных вычислениях с использованием генетического алгоритма собственной реализации. Будет показано на примерах функционирование алгоритма, даны практические рекомендации по его использованию.
 
Figar0:

I haven't been following the innovations of MT5 for a long time, and therefore I will probably ask a very silly question.

I start optimization of a standard Expert Advisor, slow (full search of parameters) and it limits this full search to some 10490....


What genetic pass? What genetic optimisation? Full brute force, right?

In the 32 bit version, when the number of passes exceeds 1,000,000, the genetic mode is activated. The 64-bit version has a limit of 100,000,000 for full brute force. This is described in the help.

It is done in this way to automatically help traders not to make obvious mistakes.


Log is packed with some: 2012.07.13 21:48:10 Core 5 genetic pass (494, 256000000) tested with error "cannot initialize expert".

You must look at the code - or you missed memory or something else during initialization of expert.

 
Renat:

In the 32-bit version, if the number of passes exceeds 1,000,000, genetics mode is activated. The 64-bit version has a limit of 100,000,000 for a full run. This is described in the help.

It is done to automatically help traders not to make obvious mistakes.

Thank you for your reply. 100 000 000 is enough for me.

Renat:

I have to look at the code - or memory was insufficient, or something else during initialization of the Expert Advisor.

ExpertMACD standard....

 

https://www.mql5.com/ru/forum/1111/page775#comment_234266

From users with low ratings, apparently the bugs are not relevant). Same thing in the new build.

OrderCalcProfit(ORDER_TYPE_BUY, "USDJPY", 0.01, 0.01, 0.02, profit_USDJPY_1 );

OrderCalcProfit(ORDER_TYPE_BUY, "USDJPY", 0.01, 200.01, 200.02, profit_USDJPY_2 );


Print("profit_USDJPY_1=", profit_USDJPY_1 ," profit_USDJPY_2=", profit_USDJPY_2 );

(EURUSD,M15) profit_USDJPY_1=500.0 profit_USDJPY_2=0.05

In the cross variant it works fine.

 

Which folders need to be cleaned (remove logs, ...etc.) to free up space in the terminal directory. - of course leave the scripts, indicators, owls) to free up space in the terminal directory? While testing and optimizing Expert Advisors, the terminal directory has become 80 Gigs... Time to clean it.

Ideally, we should create something similar to 4 - the file clear.bat (clears everything extraneous, including the history of quotes for symbols, cleans the logs and bring it in accordance with the installation version, of course, while leaving the scripts, indicators and Expert Advisors).

If anything, can you give me a link to the description of MT5 folders?

I may look for it myself and clean the contents of folders manually, but the same way I can write the same batch file for MT5, just in case there is something similar...

Thank you.

Files:
clear.zip  1 kb
 
R0MAN:

Which folders need to be cleaned (remove logs, ...etc.) to free up space in the terminal directory. - of course leave the scripts, indicators, owls) to free up space in the terminal directory? While testing and optimizing Expert Advisors, the terminal directory has become 80 GB... Time to clean it.

Ideally, we should create something similar to 4 - the file clear.bat (clears everything extraneous, including the history of quotes for symbols, cleans the logs and bring it in accordance with the installation version, of course, while leaving the scripts, indicators and Expert Advisors).

If anything, can you give me a link to the description of MT5 folders?

I may look for it myself and clean the contents of folders manually, but the same way I can write the same batch file for MT5, just in case there is something similar...

Thank you.


MetaTrader 5 Help → Getting Started → Directory and File Structure

 
WWer:

MetaTrader 5 Help → Getting Started → Directory and File Structure

Thank you. I will read it...
Reason: