Questions from a "dummy" - page 54

 
Urain:
Correcting the mistakes of the man with the nickname Expert? that should go in the humour thread.
How much of your post is trolling on a scale of 10 ? =)
 
Expert:
As far as your post relates to trolling on a scale of 10? =)

At first I thought it was Andrei who was asking such questions, but then I remembered that his nickname is TheXpert, to which he corresponds.

Since you got so close, be prepared that you will be doubly in demand.

Better change it, it's not too late for 3 posts, there's enough of an expert on this forum.

 
tol64:

Please advise how to correctly implement new bar checking in multi-currency EA in the presented scheme.

I have added a static array for storing the time of opening a new bar for each symbol:

void OnTick()
{ 
 // Объявление массивов переменных для торговых сигналов
 static datetime New_Bar[2];  
 static bool UpSignal[2], DnSignal[2];

 // Получение торговых сигналов
 TradeSignalCounter(0, остальные параметры);
 TradeSignalCounter(1, остальные параметры);

 // Совершение торговых операций
 TradePerformer(0, остальные параметры);
 TradePerformer(1, остальные параметры);
}

Changed function isNewBar(string Symbol_, ENUM_TIMEFRAMES Timeframe); Now it works with arrayNew_Bar[].

bool isNewBar(int Number,string Symbol_,ENUM_TIMEFRAMES Timeframe,datetime &New_Bar[])
{
 // Текущее время
 datetime lastbar_time = (ENUM_SERIES_INFO_INTEGER)SeriesInfoInteger(Symbol_,Timeframe,SERIES_LASTBAR_DATE);

 // Если это первый вызов функции
 if(New_Bar[Number] == 0)
   {
    // Установим время и выйдем 
    New_Bar[Number] = lastbar_time;
    return(false);
   }

 // Если время отличается
 if(New_Bar[Number] != lastbar_time)
   {
    // Запомним время и вернем true
    New_Bar[Number] = lastbar_time;
    return(true);
   }
 // Дошли до этого места - значит бар не новый, вернем false
 return(false);
}
The results are still different for different tools with unchanged parameters. Can you tell me where I am wrong?
 
Urain:

At first I thought it was Andrei who was asking such questions, but then I remembered that his nickname is TheXpert, to which he corresponds.

Since you're so close, be prepared that you'll be doubly in demand.

Better change it, 3 posts is not too late, the forum one expert is enough.

I thought at the beginning that Andrew is asking such questions (in context understand the stupid) asks, but then I remembered that he nicknamedTheXpert, which he matches (oops, hidden insult TheXpert) =)

P.S. Sitting down to think up a new nickname.

 
papaklass:
The results will be different because the OnTick() function triggers when a new tick comes for the symbol, on the chart of which the Expert Advisor works. The ticks for different symbols do not come at the same time. This leads to divergence of final results. If you set your EA to work on the most liquid currency, with the highest ticks for the day (eurusd), do not worry about it.

The reason why the results are different is clear to me. It has already been discussed in several threads many times. Not getting steamed up is not an option in my case.) There is a problem that needs to be solved in order to get correct test results. Scheme proposed by Nicholas Kositsin for me at the moment the most understandable and quite suitable. There is just no way to solve the issue voiced above.

Konstantin Gruzdev suggested an interesting method with "spies" and "agents" in his article. )) But his "agent" exSpy Control panel MCM doesn't seem to work for me.

Has anyone tried to solve the above problem with the help of Konstantin Gruzdev's "agents"?

 
tol64:

Has anyone tried to solve the above problem with Konstantin Gruzdev's "agents"?

I don't think this technique will work in the tester.

// Work by timer. What's not to like?

 
MetaDriver:
I think this technology will not work in the tester.

Konstantin himself commented in the discussion thread of the article like this:

OnChartEvent() doesn't work in the tester yet. The developers promised to do it. I tested, if it can be called a test, the methodology with calling "spies" directly from the Expert Advisor in the tester, replacing the transfer of events through global variables - it works.

That's the way to try it.

I've got some more variants in my head, but they seem quite complicated to me. In any case I'll have to solve this problem. I'm just tired of getting the results wrong. I started studying MQL5 exclusively due to the possibility to test multicurrency trading systems. Before that I was uploading the test results to Excel and performed calculations there. But I need to see the results directly in the strategy tester.

Vladimir, how have you solved this question?

MetaDriver:

// Work by timer. What's not to like?

Ah, already answered)). Yes, some forum "sharks" have already suggested this option too, but I have yet to see how it can be implemented. I'll try to concentrate now and finally make this necessary function. If you have a ready solution, I would be deeply grateful to you for at least a simple example, if you do not mind)).

 
MetaDriver:

// Work on a timer. What's not to like?

I tried to test it in the timer. It all seemed more complicated to me, but here it turns out to be enough to move the code from the OnTick() function to OnTimer(). The results are identical. To be accurate, you will have to set the timer, for instance, every 10 seconds. However, it takes much longer to test, which is the only thing that might not be to your liking at first glance.
Документация по MQL5: Работа с событиями / EventSetTimer
Документация по MQL5: Работа с событиями / EventSetTimer
  • www.mql5.com
Работа с событиями / EventSetTimer - Документация по MQL5
 
tol64:
I tried to test it in a timer. I found it all more complicated, but here it turns out that I only need to translate the code from the OnTick() function into OnTimer(). The results are identical. To be accurate, you will have to set the timer, for instance, every 10 seconds. True, testing takes much more time; it is the only thing that may be unpleasant at first sight.

It depends on the timer period. You can do it for 10 days (60*60*24*10), it'll be faster. :))

There are also subtleties. For example, you don't have to tick on weekends. ;)

 
tol64:
But it takes much longer to test it

If the "ticking" is needed only for catching a new bar, it is enough to set a timer for the bar appearance time (00 minutes 00 seconds for H1) and tick every 1 second for a couple of minutes until the bar appears on all necessary TFs. It will be more accurate and economical.

But a solution with custom events is, of course, much more elegant.

Документация по MQL5: Стандартные константы, перечисления и структуры / Константы графиков / Типы событий графика
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы графиков / Типы событий графика
  • www.mql5.com
Стандартные константы, перечисления и структуры / Константы графиков / Типы событий графика - Документация по MQL5
Reason: