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

 
Hello! Is it possible to add a calculated level to the technical indicator opened in the sub-window of a chart? If so, what function? Or will I have to useOBJ_HLINE?
OBJ_HLINE - Типы объектов - Константы объектов - Стандартные константы, перечисления и структуры - Справочник MQL4
OBJ_HLINE - Типы объектов - Константы объектов - Стандартные константы, перечисления и структуры - Справочник MQL4
  • docs.mql4.com
OBJ_HLINE - Типы объектов - Константы объектов - Стандартные константы, перечисления и структуры - Справочник MQL4
 
Vikon:
Hello! Is it possible to add a calculated level to the technical indicator opened in the sub-window of a chart? If so, what function? Or will I have to useOBJ_HLINE?
Look at INDICATOR_LEVELVALUE in ENUM_CUSTOMIND_PROPERTY_DOUBLE

IndicatorSetDouble - Пользовательские индикаторы - Справочник MQL4
IndicatorSetDouble - Пользовательские индикаторы - Справочник MQL4
  • docs.mql4.com
IndicatorSetDouble - Пользовательские индикаторы - Справочник MQL4
 
Alexey Viktorov:
Hey Artem, why don't you put it in CodeBase? At least one more correct code will be there.
Well, it's just a template - it needs a normal modification function.
 
Artyom Trishkin:
Well, it's just a template - it needs a proper modification function.
Then it would be an Expert Advisor. And I was talking about placing it as a function. That is, as it is now.
 
Alexey Viktorov:
Then it would already be an advisor. I was talking about placing it as a function. That is, as it is now.
No, you don't understand - in fact, the lines with modification of stop are commented there - instead of comments, the user is offered to substitute his own familiar function. And to place it in kotobaza, I'll need to supplement this function with modification function with return codes processing of server, by the way, the example of getting code from it in this function is already there along with reaction to closed market. The modification function (mine), if market is closed, writes code ERR_MARKET_CLOSED in err variable and stops its work. The trawl function in turn, seeing this code, also exits. I.e., I need to add here some codes handling and modification function, which I use, to not shame to put it into cotobase. And there I have to pull everything from trade class with change of variable names, with addition of all used closed class methods (as I did for getting stopplevel)... I'm too lazy...
 

Good afternoon. I'm not writing a big EA. Just learning so far. I have a question. I have to wait for closing of a position by TP or SL and then continue code execution.

But in my case, this command is executed and then the next operators are executed. I tried while(order > 0) to delay the execution of the program but this is a stupid idea and it slows down the strategy tester.

.......;

.......;

order = OrderSend(Symbol(),OP_BUY.............) ;

.....Next operator....;

I am also interested in replacing the missing GOTO operator. Or how to implement a program that would jump to the top lines, for example.

 
DenZell:


throw in the whole file
 
DenZell:

Good afternoon. I'm not writing a big EA. Just learning so far. I have a question. I have to wait for closing of a position by TP or SL and then continue code execution.

I want to wait for the close of a deal and then continue code execution. I have also tried while(order>0) and while(order>0). I tried while(order > 0) to delay the execution of the program but this is a stupid idea and it slows down the strategy tester.

.......;

.......;

order = OrderSend(Symbol(),OP_BUY.............) ;

.....Next operator....;

I am also interested in replacing the missing GOTO operator. Or how to implement a program that would jump to the top lines, for example.

1. When the order is opened, we should write the ticket into a variable of global level or static, and then monitor the order till the blue light, oops, until it closes by comparison OrderCloseTime() > 0. If the close time is greater than zero, the order is closed.

2. The substitution for the GOTO operator is much more efficient. Read the documentation about the functions.
Функции - Основы языка - Справочник MQL4
Функции - Основы языка - Справочник MQL4
  • docs.mql4.com
Функции - Основы языка - Справочник MQL4
 
And be sure to read the event handling functions.
Функции обработки событий - Функции - Основы языка - Справочник MQL4
Функции обработки событий - Функции - Основы языка - Справочник MQL4
  • docs.mql4.com
Функции обработки событий - Функции - Основы языка - Справочник MQL4
 
Svyatoslav Minyaev:
Hello, in the Strategy Tester the maximum history of arrays like Low, Close etc. 1000 bars, are there arrays with more history in the tester?
At start it seems to be always 1000, if you scroll forward, as new bars come in, the number will increase.