Errors, bugs, questions - page 2856

 

Hello. Ihave a misunderstanding:
How can I use Trade\Trade.mqh to modify an existing order?
The OrderModify command from Trade.mqh requires me to set 7 parameters, including the last one: StopLimit order, which is confusing to me, because I don't need it at all... And it is not required in standard execution...

OrderModify(const ulong ticket,const double price,const double sl,const double tp, const ENUM_ORDER_TYPE_TIME type_time,const datetime expiration,const double stoplimit=0.0);

I have a Sell Stop, I want to move it up, after the minimum, and I can't do it with OrderModify, and I don't understand how to modify existing SellStop order using Trade\Trade.mqh

I have to use dilettage and a new order.

What is the correct way to move Sell Stop level?

 
Сергей Таболин:

Igor, the question was not about the error in the code itself, but about why it writes an error during optimization, but not during a single run?

I'm not good at telepathy, I'm just learning.

but i'll try.... Assuming you wrote the code at the proper level, it's possible that during optimization you get to the value of input variable, which causes a critical error

.... Another way to put it is to assume that you don't know that the optimizer gets tasks in batches, and maybe there is an error in one of the tasks

.... You can also assume that if you initialize variable in global scope (it can be a function call during initialization or constructor of class) and optimizer initializes it once for constants and statics (although it seems that only for statics - I forgot) for each agent, for whole optimization time, but in single pass every single pass...

... hz

 
Yura Fomin:

Hello. Ihave a misunderstanding:
How can I use Trade\Trade.mqh to modify an existing order?
The OrderModify command from Trade.mqh requires me to set 7 parameters, including the last one: StopLimit order, which is confusing to me, because I don't need it at all... And it is not required in standard execution...

I have a Sell Stop, I want to move it up, after the minimum, and I can't do it with OrderModify, and I don't understand how to modify existing SellStop order using Trade\Trade.mqh

I have to use dilettage and a new order.

How do I move Sell Stop level correctly?

There is an example inPending Trailing

Pending Trailing
Pending Trailing
  • www.mql5.com
Советник относится к классу утилит. Работает со всеми отложенными ордерами установленными в терминале. Подтягивает отложенный ордер вслед за ценой. Например отложенные ордера 'Buy stop' и 'Sell limit'...
 
TheXpert:
There is no need for a semicolon anywhere after curly braces, probably not in any language
Thank you. The ambiguity of syntax when both are right is not good.
 
Igor Makanu:

I'm not good with telepathy, I'm just learning.

but I'll try.... Assuming your code is written at a proper level, it is possible that during optimization you get to the value of input variable which causes a critical error

.... Another way to put it is to assume that you don't know that the optimizer gets tasks in batches, and maybe there is an error in one of the tasks

.... You can also assume that if you initialize variable in global scope (it can be a function call during initialization or constructor of class) and optimizer initializes it once for constants and statics (although it seems that only for statics - I forgot) for each agent, for whole optimization time, but in single pass every single pass...

... hz

)))))

What does telepathy have to do with it?

There's an array, it's initialized and used without any problems. Everything works. But on the way out, there's a mess...

void OnDeinit(const int reason)
{
   //Print(ArraySize(netMLP));
   //Print(ArraySize(indicators)+1);
   for(int i = ArraySize(indicators); i >= 0; i--) delete netMLP[i];

Everything was checked. But the difference between the way the analyzer behaves in the optimization mode and single run is evident. The question is why? If there is something wrong somewhere, somehow, it must be wrong both ways. Isn't it?

 
Сергей Таболин:

)))))

What does telepathy have to do with it?

There is an array, it is initialised and used without any problems. Everything works. But on the other hand, on exit, such a catastrophe occurs...

Everything was checked. But the difference between the way the analyzer behaves in the optimization mode and single run is evident. The question is why? If there is something wrong somewhere, somehow, it must be wrong both ways. Isn't it?

Write it down for the sake of decency:

for(int i = ArraySize(netMLP); i >= 0; i--) delete netMLP[i];

And so there is no guarantee that the dimensions are the same. What the arrays are, no one knows.

 
Stanislav Korotky:

Write it down for the sake of decorum:

And so there is no guarantee that the dimensions are the same. No one knows what the arrays are.

I do know)))

I replaced it. The error I specified disappeared )))) But the other one keeps appearing:

2020.09.24 22:48:38.470 Core 3  pass 11877 tested with error "OnInit returned non-zero code 1" in 0:00:00.000

I repeat: there was no such thing in the previous release.

I have several checks with return(INIT_FAILED);

But they are all preceded by prints. But there are no prints. (((

 
Сергей Таболин:

only write to file:

- sign optimisation on/off

- agent number

- and all variables used in OnDeanit()

without this you won't find a bug - the optimizer works without problems, I use it all the time

 
Сергей Таболин:

I do)))

Replaced. The error I mentioned disappeared )))) But another one keeps appearing:

I repeat, there was no such a thing in previous release.

Doubleclick on corresponding optimization pass and get single run log with all details, why initialization failed - row and column in source.

 
Igor Makanu:

only write to file:

- sign optimisation on/off

- agent number

- and all variables used in OnDeanit()

without it you won't find the bug - the optimizer works without any problems, I'm using it all the time.

Ok, I'll connect writing everything to the file again. maybe there'll be a reason... that wasn't there before...