The problem of transferring from MT4 to MT5. Or, more precisely, the inability to execute some algorithms in MT5 without'err. - page 11

 

Information for reflection.

Watching some of the EA developments published on the marketplace. Or some articles.

They often specify a small spread in the broker selection requirements for the EA.

And, in my opinion, MT5 has largely been tuned to react quickly to changes in the market. This explains why all the brakes with waiting for quotes update are turned off.

It means that if there is an update of quotes, the terminal will deny access to timeseries. Not to interfere with some fast algorithms.

This paradigm has a right to exist. In this case the trading is short. It is entered quickly. Collect a few points. Quickly exit.

But there is another paradigm.

There are some extreme situations in the market where market reversals are formed.

These extremes may have been formed even several years ago. But they continue to influence the current market situation.

Momentary changes on the tick or minute history in this case can be taken into account. But they are not decisive.

In this case it is possible to wait for quotes update without exiting the handler as a result of access interruption. And it works just in MT4.

Some pictures with explanations of what has been said.

We take the monthly tf. Extremes in March 1995, October 2000 and July 2007 continue to influence the market.

Even the extremum from February 1985 has an effect:


It can be seen that lines built with these extrema are noticed by the market.

Let's move to other timeframes. Approximately in such a ratio as if we were making wave markups. This choice may result in the development of one wave level in each TF

Weekly tf:

D1:

H4:

M30:

M5:

M1:

We see extrema formed far back in history have an impact on the current market momentum.

----------------------------------

There should be continuous access to quotes for such constructions.

I will continue further. Basically everything shown in the pictures is used in manual trading.

But. It is possible to feed quotes of different timeframes to inputs of several neural networks, for example represented in the pictures. Each NS will process its own data. And give on its output its own understanding of what is going on. Outputs of neural networks will be synchronized according to the bars receipt time.

In this case signals from the NS of a higher priority than those of a lower one.

Received signals from neural networks are fed to the input of the following NS with some consideration of priority. There may be variants here.

The first layer of neural networks, for example, may be of the LSTM type. By layer in this case we mean neural networks getting quotes each from its timeframe. Each neural network of the first layer can have several layers of neurons.

The summing neural network may have its own architecture. This is more of an engineering task.

It is possible to train, for example, with some algorithm of trade opening. In the first layer of neural networks. That is each neural network of the first layer is trained separately. We open trades, for example, at the end of a bar in the corresponding layer. You can even open trades in different directions. The trades are conditional. At the end of those deals a signal is sent to train the NS.

Thus, the aggregate neural network is given the right to choose the best trading mode.

So we get an algorithm somewhat similar to that implemented in Alfa Zero by the DeepMinde team.

You should train such a network on the entire history for all selected timeframes. The only thing to take into account is that all timeseries in MT5 are based on minutes. This is not true. NCC files on eurodollars until 1993 are made of time series. There must be an algorithm that reconstructs the true timeseries timeframe.

You may train on one currency pair. And test it on another one.

------------------------------

Summary. Why in this approach is it necessary to react quickly to what is happening in the market?

 
Eugeni Neumoin:


Sorry for the off-topic, but as long as the topic is interesting, I can't quit


Vict:

Well, I mean like this:

MQL has typename() - it returns string type name, works even

void OnStart()
  {
   Print(typename(Txt()));      // в логе будет       string
  }
string Txt()
{
return(" Txt ");
}

knowing MyFunc() type - write a macro (((, ... Of course I can write all macros of type _Try_helper ... in general, i probably am not venturesome, for i do not know how

 
Igor Makanu:

Sorry for some of the off-topic, but as long as it's an interesting topic, I can't quit


It's fine.

 
Igor Makanu:

MQL has typename() - it returns string type name, works even

knowing MyFunc() type - write a macro (((, ... Of course I can write all macros of type _Try_helper ... well, i guess i'm not a gambler, for i don't know how

typename() in µl won't help, it won't give at compile time a type suitable for declaration of a variable, only print it. This leaves us with Try_d(), Try_i(), ... . I don't know how to get decltype functionality in µl.

 
Vict:

typename() in µl won't help, it won't give you at compile time a type suitable for declaration of a variable, just print it. This leaves us only with Try_d(), Try_i(), ... . I don't know how to get decltype functionality in µl.

Hmm, I don't feel like a gambler at all! I'll even say absolutely no gambler! ))) - I don't know how, that's how something will work (I really don't understand how it's at the machine level "all spinning" - I think we have a strictly typed language?)

void OnStart()
{
  int i = func(1);
  double d = func(1.123);
  string s = func("s");
  Print("i = ",i);
  Print("d = ",d);
  Print("s = ",s);
}

template<typename T>
T func(T invalue)
{
   string s = typename(T);
   if(s=="int") return(invalue);
   if(s=="double") return(invalue);
   if(s=="string") return("Hello word!!!");
return(NULL);
}

2019.07.31 21:07:05.304 tst2 (EURUSD,H1) i = 1

2019.07.31 21:07:05.304 tst2 (EURUSD,H1) d = 1.123

2019.07.31 21:07:05.304 tst2 (EURUSD,H1) s = Hello word!!!


you can also describe a pointer to the function

typedef void(*TFuncvoidPTR)(void);

and further use

TFuncvoidPTR      func[];
....
func[0]();
 
Vict:

typename() in µl will not help, it will not give at compile time type suitable for variable declaration, only print it. That leaves us only to multiply Try_d(), Try_i(), ... . I don't know how to get decltype functionality in µl.

A template function with a static T-type variable.

 
Igor Makanu:

Thank you!

I read your posts, unfortunately you are right in many ways, yesterday I corresponded a lot with moderator Artem in this thread, the result of the conversation: if it is implemented that way, then it should work that way... in general, like in the old adverts "you just don't know how to cook them!

Imho, the results of MQL5 compiler are really fantastic (it's very productive!), but its use as a trading terminal... Well, let's put it this way: it requires very, very good technical training and desire to write ~30% more code than "in the old terminal" ( - even this phrase is a well-established expression on the forum)

Ay-yi-yi... I didn't say so :)

I was saying - use what we have to get the result we want.

I keep the rest of my emotions to myself.

 
Igor Makanu:

I did not say that moderator Artem said any such thing, I only wrote the result of the conversation - I think that is my judgement, which I can only form based on my emotions and analysis of the conversation .... ))))

i.e. i don't know what happened in someone's head, i can only see my own head... luckily in the mirror for now )))

I would have believed it if instead of

the result of the conversation: if it's implemented that way, then it should work... like the old adverts " you just don't know how to cook them!"

was

my conclusion is: if it's implemented that way, then that's how it should work... it's like the old commercial, " I just don't know how to cook them!"

And so it turns out that one head from the mirror quoted supposedly moderator Artem...

And good, if it was a conversation in private. But to draw public conclusions about my words that I didn't say is to frame me publicly with my allegedly completely wrong opinion - I have a completely different one from the one allegedly voiced in the quote.

I can voice my opinion:

Let's make the best of what we have at the moment, don't whine, help find bugs and ask with anticipation for fixes - they do get fixed and new nice features appear.

 
Artyom Trishkin:

I would believe it if instead of

it was

But as it turns out, one head from the mirror quoted supposedly moderator Artem...

And good, if it was a conversation in private. But to draw public conclusions about my words that I didn't say is to frame me publicly with allegedly my completely wrong opinion - I have a completely different one from the one allegedly voiced in the quote.

I can voice my opinion:

I'm not complaining, I'm helping in finding bugs and asking for fixes - they're being fixed and new cool features are appearing.

hmm, how complicated things have become.... cleaned up after myself, my opinion... who cares? what will change? developers have their own vision of their products, it's their business and my opinion ... if you don't update the thread in 2 days it will be way off the top


... How it will change ... Well, today a good man@Vict- showed me some easy debugging techniques, and most importantly - I can achieve readability of my code - this has changed my opinion of MQL5, and in general, the members of the forum

I'll shut up now, luckily there's a forum with a long history, you can't reread it - the answers to my questions in the search for this forum are numerous

 
Igor Makanu:

fxsaber is correct - there is one option

 template <typename T> T Try_helper(T val, bool assign) {
   static T sval;
   if (assign)
      sval = val;
   return sval;
}
#define  Try(EXPR, MES)                    \
   Try_helper(EXPR, true);                \
   if (Try_helper(EXPR, false) <= 0.0) {  \
     printf("Error: %s ", MES);           \
     return;                              \
   }

double f(double) {return DBL_MAX;}
ulong f(ulong) {return ULONG_MAX;}

void OnStart()
{

   double d = Try(f(0.), "double error");
   ulong u = Try(f(0), "ulong error");
}

It's a bit kitschy - EXPR will be calculated twice, but it's still more flexible. Can't say it's universal (only for arithmetic types. The error value must be equal, which is unpleasant. I tried to avoid it through explicit specialization of the structure/function, but it may not be possible.

template <typename T> bool Try_helper_is_valid(T val);
template <> bool Try_helper_is_valid<string>(string val) {val==""?false:true;}  // compile-time error

template <typename T>
struct S;
template <>
struct S<string> {...};      // compile-time error

Well, it seems that no matter where you dig in the µl, you will find traps everywhere. Probably, it's better to limit yourself to a small highly specialized macro with a fixed type.