[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 308
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
Can you tell me how an if(a>b || c>d) condition is handled? Is it left to right, right to left or can it be different in different cases?
Because it is not a strict disjunction (and it is always true if at least 1 element is true), then on developer's position the most logical way to handle this condition would be first to divide the molecule(a>b || c>d) into "a>b" and "c>d " atoms, then it would loop through the atoms one by one to check if they are true. And if the next atom is true, then immediately break the loop, allowing the program to do the action that is right after the brackets - that is, not to search through the rest of the atoms, because it is not needed. And it does not matter whether we search from the beginning to the end or from the end to the beginning of the created list of atoms. Only the developer can show you the search direction (metaquotes). Why do you need it? Are you writing your own compiler?
Usually <= is used. Or >=. In both cases, the implementation is hardware, Metacquotes have nothing to do with it.
The developers of other languages have nothing to do with it either. Basic operation. Like + and -.
Since the condition is not a strict disjunction (and it is always true if at least 1 element is true), the most logical way to handle this condition would be to first divide the molecule(a>b || c>d) into atoms "a>b" and "c>d", then loop through atoms sequentially to check for truth. And if the next atom is true, then immediately break the loop, allowing the program to do the action that is right after the brackets - that is, not to search through the rest of the atoms, because it is not needed. And it does not matter whether we search from the beginning to the end or from the end to the beginning of the created list of atoms. Only the developer can show you the search direction (metaquotes). But why do you need it? Are you writing your own compiler?
It occurs to me: if in TC logic condition a>b is true much more often than c>d==true, then it may matter how these two conditions are checked to speed up the program
Actually the expression looks like this: if(a>b || (a<=b && c>d)). If the truth check is performed from left to right, expression a<=b will be superfluous from the viewpoint of program speed. The question was exactly whether it is from left to right or vice versa, or differently in different cases.
Actually the expression looks like this: if(a>b || (a<=b && c>d)). If the truth check is performed from left to right, the expression a<=b will be superfluous from the viewpoint of speeding up the program. The question was just whether it's from left to right or vice versa, or differently in different cases.
Can you please explain the reason why the EA does not open orders and writes error 133
It is necessary to compare position open time with current bar open time Time[0]. If the time of opening a position is more or equal to the time of the bar opening - the Expert Advisor does not open new positions. When a new bar appears, Time[0] will change its value to a later time and this comparison will show that the position has not yet been opened on the current (new) bar and we can trade.
By the way, your question can also be broken down into 2 sub-questions:
1. At the current bar a position was opened and managed to close, but we are still waiting for a new bar.
2. On the current bar a position was opened and managed to close, then we can open a position again on the same bar (i.e. one position can be opened on the same bar simultaneously).
i have a problem with this: in one and the same bar for a few minutes the condition to open an order becomes true and the order opens. then it fails and again opens a second order. how can i fight this? i only thought of opening an order once per bar maybe there are other options?
I see that you are using a flag that allows/disallows opening a position. Without knowing the condition for the flag, it is impossible to tell you anything. In my EA I use 2 approaches for opening a position and can offer the following code:
What is detrending? Is it like "stop talking"?
Applying a low-pass filter to a series == subtracting the trend (slope) component. the simplest example: apply a muwing to the price, and then show the difference in a separate window.
I see that you are using a flag that allows/disallows opening a position. Without knowing the condition for the flag, it is impossible to tell you anything. In my EA I use 2 approaches when opening a position and can offer the following code:
I don't quite understand what goes where and from where.