![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
There are a lot of questions...
I mean, they come up all the time, but on a case-by-case basis.
For those functions that are published now there are no questions, because I just look without "feel" in the unit.
The role of ldStopLoss is unclear ...Also, besides them, there are questions about earlier codes, in particular about trailing, which has something to do with
with above written: how, why to pass to functions, for example, this trailing section puzzled me:
oooo... :-) is such an ancient function. It was designed to change the stop level of an open position or a set order. There was also a similar function for take profit. They were both replaced by a better and more functional ModifyOrder().
The role of ldStopLoss is unclear ...
This is a local variable, by means of which the price level, at which StopLoss should be set, is passed to the ModifyStopLoss function. For example, let's call the ModifyStopLoss function like this:
Then the local variable ldStopLoss will take the value 1.5662. You can check it this way:
The log will contain this record:
oooo... :-) is such an ancient function. It was designed to change the stop level of an open position or a set order. There was also a similar function for take profit. They were both replaced by more perfect and functional ModifyOrder().
So... ancient ... (sort of embarrassed :)))
I've glancing through the folders, the oldest file is dated 22.01.2006.
And it looks like it wasn't even tampered with by my cranks...
I'm sorry, I've been practicing simple things for a long time, e.g. change a number.
Simple calculators, etc...
All this started with a request to write an Expert Advisor on one of the PRDC forums, but...
My cents are not enough, but I have to use them on my own, and then I need an indicator that displays information on charts.
Now I'm addicted to it... ;) me? It's convenient... everything's there... unitor, etc, compact, portable.
I remember my first and last attempt at Delphi 6... I shudder.
I still have a couple of those disks on the shelf... :))) sorry for the offtop.
So, what 's inside the brackets of function(), is it some kind of "form" to pass some parameters to it?
Because I've got it in my head for some reason that it is a parameter which the function returns as a result of processing.
And it's also that the function gets parameters to be processed inside curly brackets...{}
I.e. all these Bid, Point and so on are input parameters.
I must have been wildly mistaken... And what is inside braces() allows passing parameters to a function,
while the function itself can be located in any (or other) place of the script proper code...
Right?
Good day, Igor! I have problems using your EAs and scripts using trawls of any form on my real account (Alpari DC). Especially I am interested in e-News-Lucky$ (ideal for my system), e-TFL_v2, Set2StopOrders, e-SotTrailing. It works on demo (also Alpari). No error messages. What can it be?
So, what' s inside the brackets of function() is a kind of "form" for passing it some parameters?
Yeah... sort of like a container :-)
Because for some reason I've got the opposite in my head: this is the parameter that the function returns as a result of processing.
What the function returns is the return value. Here is a simple example. We define a function that adds two numbers:
Now, if we call this function like this:
then the numbers 3 and 5 are the parameters of the function f. The parameters of the function can be numbers, variables, or expressions. Variables a and b are local variables that take the values of the parameters and give them to the function. The variable x is the return value of the function f, i.e. after our call to the function f, the variable y will take the value passed to it by the variable x, i.e. 8.
And also the fact that the function receives parameters to be handled inside curly brackets...{}
i.e. all these Bid, Point and so on are the input parameters.
no... the ModifyStopLoss function's parameter will be the value of the Bid-TrailingStop*Point expression.
I must have made a wild mistake... and what is in brackets() allows to pass parameters to be processed in the function,
the function itself can be located in any (or other) place of the script's code itself...
Right?
yes
The question is - why, unlike OpenPosition, ModifyOrder has no error handling?
I've heard it said somewhere that the rules of the road were written in blood. And there is nothing superfluous in them. Behind every word there is almost a life lost in an accident.
I write my functions, in accordance with my experience, and include processing of errors that have occurred in my practice, and there is no way to do without it. I try to be as "polite" as possible (error handling) when trying to enter the market. During modification, most of errors are eliminated by normalization of prices and simple checks of values. If some error occurs during modification, it is OK on the next tick. The same happens at closing.
What is the purpose of sending pp - opening price of the order to this function?
It's like the colour is already set at the beginning ... test_ModifyOrder.mq4 (12.14 KB) ... why don't you use it, but re-send it to the function
what is the advantage ofbefore short form
why do you need to normalize OrderOpenPrice()? isn't it in the same format as in the order?
So far, I haven't noticed any errors if the same thing is inserted when modifying. same with OrderStopLoss(), and OrderTakeProfit()What is the purpose of sending pp - opening price of the order to this function?
The orders OP_BUYLIMIT, OP_BUYSTOP, OP_SELLLIMIT and OP_SELSTOP will be moved.
The colour is also sort of already defined at the beginning... test_ModifyOrder.mq4 (12.14 KB) ...why do not use it, and re-send to the function
Thank you! I will use it!
what is the advantage
before a short form
The versatility which allows the EA to work with positions and orders not only for the current symbol, but also for other symbols. For example, the EA works on the EURUSD chart. A variant with Digits will not allow working with positions opened on USDJPY.
Why does the OrderOpenPrice() need to be normalised?
It is in order to successfully compare values of the double type. If it's not normalized, the comparison is impossible or rather meaningless.
Didn't notice an error if you put the same back in when modifying. same with OrderStopLoss(), and OrderTakeProfit()