[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 575

 
Ekburg:

...if it's not too much trouble, you'd better write it correctly, teach a helpless beginner...I'd appreciate it!
MQL4 Tutorial -->Trade Operations--> Order Modification --> modifystoploss.mq4
 
Ekburg:

I understand that there's a lot of experience and you can make jokes! But if it's not difficult, you'd better write the right way, teach a helpless newcomer...I'd be grateful!

Try the function that I left you in the attached file on the previous page. I have changed it a little, but I can not check it, no Expert Advisor, where I could put it. I've got no experience, MQL is the only language I know a bit, I've been studying it with help in MT and breaking somebody else's code from Kodobase, now I feel that I lack knowledge and experience and I've decided to search for it on the forum. I look at what people ask, try to solve other people's problems, little by little I gain experience and earn the moral right to get answers to my questions.
 
Ekburg:

I understand that a lot of experience and you can play pranks! But if you don't mind, write your own stuff and teach a helpless beginner how to do it properly - I'd appreciate it!

You're welcome. Only for some reason every other beginner, immediately starts writing his trailing! And when he doesn't succeed, LOUDLY WANTS everyone to sort out his hffantasies!!!! There are a HUGE number of trailing bars in Codabase. They are in almost every EA. As long as you can't write your own - BELIEVE someone else's - FREE!

P.S. Start with the analysis of other people's codes. Not all codes without comments. When EVERY line is clear, go on to writing your own functions. In this case, I'm sharing with you my experience of mastering the language to get the RESULT, of course, if "you need it"! :)

 
Roll:

"Two subspecies of red deer, the Altai red deer (Cervus elaphus sibiricus) and the Tien Shan red deer (Cervus elaphus songaricus). The red deer are bred in nurseries and specialised farms to produce antlers from which a medicinal drug, pantocrine, is made". (KiM).

Don't you have any mechanical errors or typos?
 
TarasBY:

You're welcome. Only for some reason every other beginner, immediately starts writing his trailing! And when he doesn't succeed, LOUDLY WANTS everyone to sort out his hffantasies!!!! There are a HUGE number of trailing bars in Codabase. They are in almost every EA. As long as you can't write your own - BELIEVE someone else's - FREE!

P.S. Start by parsing other people's codes. Not all codes are without comments. When EVERY line is clear - go on to writing your own functions. In this case, I'm sharing with you my experience of mastering the language to get the RESULT, of course, if "you need it"! :)


Thanks. I searched the codebase, found something, tried to substitute, changed as it were, read thousands of lines of pro code and not only, gives out an error 1 when modifying, and all the hell knows what to do. I have faced with various difficulties in writing and working with EAs, but I try to solve them myself, otherwise I wouldn't get a good experience, I've read help, re-read textbooks, solved problems and got a bit different thinking than when I started, but I failed to solve this problem myself, so I turned to you, professionals! I wouldn't write Traylin if I didn't need it for my EA to work:)
 
Roll:
MQL4 Tutorial -->Trading Operations -->Order Modification --> modifystoploss.mq4

I have read it many times, tried to apply it, the result is the same! The main code also has modifications, but of the orders, everything is OK there! But the modification of market orders is a mess, I don't understand why.
 
rigonich:

Try the function I left for you in the attached file on the previous page. I've redesigned it a bit, but I have no way to test it, no Expert Advisor where I can insert it. I've got no experience, MQL is the only language I know a bit, I've been studying it with help in MT and breaking somebody else's code from Kodobase, now I feel that I lack knowledge and experience and I've decided to search for it on the forum. I am looking at what people ask, trying to solve other people's problems, little by little gaining experience and earn the moral right to get answers to my questions.

The result is the same... error 1
 
Good people advise how to work with arrays, I need to select the maximum and minimum values of the closing and opening bar, in the time interval from 1.00 to 10.00, I tried to do so, but it's not the same.
int MAX()
{
if (Hour()==10)
        {
      
        for(i=0; i<=9; i++)
        MAX1 = High [iClose(NULL,PERIOD_H1,i)];
        }
        return(MAX1);
        
}
But it's not right. It gives out '[' - array index is to be an integer C:\Program Files\InstaTrader\experts\Profiler19 EUR-JPY.mq4 (61, 21)
What is wrong, how to fix it
 
Ekburg:

Thanks. I have looked in the codebase, found something, tried to replace it, changed it this way and that, read thousands of lines of pro code, and not only that, but it gives out error 1 when modifying and that's it, I don't know what to do. I have faced with various difficulties in writing and the subsequent work of the EA, but to solve them myself, otherwise I don't get good experience, I've read the help, re-read the tutorial, and solved the problems, I started to think a little differently than when I started, but this problem alone did not work, so I turned to you, professionals! I would not write Traylin, if it is not necessary for the work of the EA:)

In order to avoid error 1, you should check parameters passed to modification function before you call the function. If at least one of them is not equal to parameters of the modified order, you can call the OrderModify() function, otherwise you will get out or error 1.
 
rigonich:

To avoid error 1, we should check parameters passed to modify function before calling the function. If at least one of them is not equal to parameters of updatable order, you can call the OrderModify() function, otherwise you will get exit or error 1.

That's the thing: everything is fine there! I put the prints there for that to track during the test what values are passed to the modification function, everything is fine there, the stop is different, nothing unnecessary is thrown, everything is within the limits allowed by the server, and the opponents in the code above do not allow to pass the same values...
Reason: