[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 125
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
If stop - new stop (in b.u.) is not equal to zero... then we modify... If not, we don't modify. That's why it's not clear to me how this happens. After all, I understand that I need to check for equality of past and new stop and I've done it.So I have a check for this case:
Here's a look at how I check from above and below when trawling without error for a bai:
I can give the ModifyOrder() function, good for all order and position modifications.
Edit this code so it doesn't look like a hack
How do you edit it? What do you mean?
I would advise to modify it not by bars, but by so many pips. If necessary, this is what the resources are for. And the "no error" error pops up when the price is repeated for a modification that already exists. Therefore, you have to go step by step as I advised you at the beginning.
The B.U. is of course drawn by pips. I meant to call the B.U. function at every tick or at bar opening for example... But that would be silly. The price can jump a lot per bar. So, the call will be similar to the tickwise one, right? I was just thinking, maybe some condition should be added, so it won't be called at every tick. I think we should compare the current STOP and the one that is going to be set, sort of...
In general. What a strange thing to do.
I added a condition to start and it worked out that way:
if (priceBU != OrderStopLoss()) { MovingStopLossToBU(); }
Now there are no errors.
What I don't understand is that the MovingStopLossToBU() function itself changes only if the stop is not equal to Stop Loss:
How do you understand it then?The B.U. is of course drawn by pips. I meant to call the B.U. function at every tick or at bar opening for example... But that would be silly. The price can jump a lot per bar. So, the call will be similar to the tickwise one, right? I was just thinking, maybe some condition should be added, so it won't be called at every tick. I think we should compare the current STOP and the one that is going to be set, sort of...
In general. What a strange thing to do.
I added a condition to start and it worked out that way:
Now there are no errors.
What I don't understand is that theMovingStopLossToBU() function itself changes only if the stop is not equal to Stop Loss:
How do you understand it then?In your example, when the stop is zero, that means you just opened a position without a stop. And I gave you the case when you're already at breakeven.
But look above, I gave you my trawl without breakeven! And I can give you the function.
I don't understand.
How to edit it ? how to understand it ?
See above, I gave you my error-free trawl! And I can give you the function.
I did not see your reply when I wrote. I'll take a look now.
But in general, I'd be happy to see your modification function, maybe I'll learn something new for myself.
In your example, when the stop is zero, it means you have just opened a position without a stop. And I gave you the case when it's already at breakeven.
See above, I gave you my trawl with no break-even! And I can give you the function.
No, not without a stop. I only posted a piece of it. Here's my breakeven function:
In the line it is clearly seen that if the calculated stop is equal to the one that is already there, there will be no modification! Right? So the check originally was? But error 1 was constantly popping up, until I had entered another condition in the start before the modification function:
if (priceBU != OrderStopLoss()) { MovingStopLossToBU(); }
That's why.... that's what I'm trying to figure out. I think I've described everything thoroughly.Then you've come to the wrong place if you don't understand. Study what you don't understand, you'll ask. And if you don't understand anything, you don't need it.
If you do not understand anything, you don't need it. Well, tell me how to edit the code so it does not look hacked if you understand everything. It's my first time on the forum, and I got such a nice answer.
"Genius people have a genius answer."
Well then tell me how to edit the code that would not resemble a hack if you all understand. I came to the branch for beginners. I came on the forum for the first time on the forum and I got a nice answer.
"Genius people have a genius answer".
For newcomers first: