Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1690

 
Nikolay Ivanov #:

A slight correction... There won't be a critical error, just the boolean OrderSelect will return false... and that's all... But of course it's better to avoid... Because if you don't use the features of the code correctly, it's hard to predict the potential pitfalls...

Yes, of course. But only when using regular, terminal arrays, which are not visible to anyone and are accessed by regular functions, which have overrun protection and return error flags. I was referring to working with my arrays, after all:

But as soon as one realizes that one should cache data from regular arrays and starts working with one's own arrays, that's where one needs to get accustomed to handling arrays carefully.

And everything that people have been doing lately, using their own data caches (historical and market ones) is much easier and faster - there you can sort as you want and select whatever you want, and get new arrays with only required data, and sort them as you want and select whatever you want from them.

But this is the next level of using possibilities of the terminal and its API - MQL.

 
Nerd Trader #:

The first order is given magic = 1 by default. Then a loop is started:

Start of iteration magic = 1 unique = 0, at the end (when there is already one order with magic = 1 ) magic is still 1 and unique = 0
Second iteration magic = 2 unique = 0, at the end, magic = 2 and unique = 1 (no match) and the retorn is assigned to the 2nd order magic = 2.
The third should be the same...

I wanted to print the whole process, but something went wrong:

https://www.mql5.com/ru/articles/5687
Read on at your leisure. And it's silly to just number the Magik. It has to be encrypted. You can stick the number, the type, the ticket, even the creation time of the order in it
 
Valeriy Yastremskiy #:
h ttps://www.mql5.com/ru/articles/5687
Read it at your leisure. And it's stupid to just number Magik. It has to be encrypted. You can put the number, type, ticket, even the time the order was created in it
Let's read it. I don't know why a magician should be encrypted, serial numbering is enough for me. The option of assigning the largest magic number + 1 is fine, but I need to figure out why my code doesn't work.
 
Ivan Butko #:
Can you please tell me a trick (maneuver) to make the terminal remember several values?

For example, a task:

Given N candles backwards. Find candlesticks with size >= X pips, memorize their number and size of each of them. If the current candle after closing was >= X pips, then compare its size with the total number of calculated candles and display the result - what is its size among all the candles found.
MakarFX #:

The terminal remembers everything anyway... the quotes archive!

And for an Expert Advisor or indicator, you need this

Makar, thank you for your reply. Unfortunately, I have not mastered this page so far. How to solve this problem through the arrays, I do not understand.

 
Ivan Butko #:

Makar, thank you for your reply. Unfortunately, I haven't mastered the above page yet. I don't understand how to solve this problem with arrays.

I'm not good with arrays yet...

Maybe one of the experts can help you.

 
Maxim Kuznetsov the syntax of the language and the basic basics of algorithms.

Otherwise we get nonsense in the topic, instead of consultations on the platform and algorithms, primary schools level dialogues - where to put ; what is a loop and why indexes are 0.

For example, there is a site intuit.ru - there are courses on C and algorithms, take your time, a couple of weeks at most. At the same time you may get a paper :-)

The best motivation to study something, when there's a need. I used to try to learn C, C++ from textbooks, but I don't know where the motivation to do the tasks should come from, for example: convert degrees Celsius to Fahrenheit, etc. But when there is a real need, as I have, to write an EA, it's a different matter. I've learned more in a week as needed: classes, structures, etc. At the same time, I also had to learn and apply git. Now I'm looking at mastering some kosher editor such as vim or emacs.

P.S.
I have a video course on mql4, but I don't even have the energy to watch it, because it doesn't write the right owls for me. Yes, the ideal course is the one where they write your EA.
 
Nerd Trader #:

I've got a video course on mql4 but I even don't have enough strength to watch it, because it's not written by those owls, that I need. Yes, the ideal course is the one where they write your EA.

How creepy... What are "those" owls? Not Chernobyl? As far as I know, owls can't write. Not only that, they don't have a clue about it at all.

 
Artyom Trishkin #:

How creepy... What are "those" owls? Not Chernobyl? As far as I know, owls can't write. Not only that, they don't have a clue about it at all.

Uh-huh, uh-huh. The owl writes.
 
Nerd Trader #:
Let's read it. I don't know why the magician needs to be encrypted, serial numbering is enough for me. The option of assigning the biggest magician + 1 is fine, but I need to figure out why my code doesn't work.
Silly, because the orders are numbered anyway. They have ordinal numbers and tickets. And you write the ordinal numbers plus 1 in Magik. And you do this even without a distinctive prefix to distinguish the orders you need.

 

Good evening, help me to rewrite a code section in MQL4 for MQL5 compiler, if it's not difficult, thank you!

   FLU=iCustom(NULL,0,"FractalsLine",0,0);
   FLL=iCustom(NULL,0,"FractalsLine",1,0);
   MA_1_t=iMA(NULL,0,Period_MA_1,0,MODE_EMA,PRICE_TYPICAL,0);
   MA_2_t=iMA(NULL,0,Period_MA_2,0,MODE_EMA,PRICE_TYPICAL,0);
   MA_3_t=iMA(NULL,0,Period_MA_3,0,MODE_EMA,PRICE_TYPICAL,0);
   MA_4_t=iMA(NULL,0,Period_MA_4,0,MODE_EMA,PRICE_TYPICAL,0);
   Sig_c=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,0);
   Sig_p=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,1);
   Macd_c=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,0);
   Macd_p=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,1);
   RCI_t = iRSI(NULL,0,14,0,0) - 50;
   Atr=iATR(0,0,14,0);
   WPR=iWPR(NULL,PERIOD_H1,14,0);
   Vol=iVolume(NULL,0,0);
   Stoh_m=iStochastic(NULL,0,21,9,9,MODE_SMA,0,MODE_MAIN,0);
   Stoh_s=iStochastic(NULL,0,21,9,9,MODE_SMA,0,MODE_SIGNAL,0);
Reason: