[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 176

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
In my opinion, this is the right way although it is primitive!:) Why not implement this as a new bar function? You need it to recalculate once a day, i.e. starting from 0.00 o'clock. So we do it simply. At start of course:
It's not either, it's E. There's a && sign.
OR. Because AND condition is not fulfilled when at least one of the operands is false (first OR second) - in boolean logic this is called"De Morgan's law".
I get it. But the point is this:
Variableindex in general by code has value Bar - IndicatorCounted().
I.e. it is 1 on the current bar and 2 on the new one.
It enters the IsUpFractal() function with the value either 1 or 1 if the bar is not yet new, right?
So, the i variable will have a fixed value since the input parameter index is also fixed. So the loop will always break after the first iteration. What is the purpose of the loop then?
OR. Because the AND condition is not fulfilled when at least one of the operands is false (first OR second) - in Buda logic this is called"De Morgan's law".
Wow. What a mess. How many times have I used these operators... and here it's like"I'm looking at a new gate". I read the law, it's written in a weird way. It describes a denial situation. I take it this technique only applies to denial situations? I mean if any of boolean variables is not equal toTrue.
I realised as I went along that I didn't stick it in. The bottom line is that the difference here is as follows. It's an indicator, which is why I'm not used to thinking this way. This means that at first call of the indicator, the bars are not calculated and index will be equal to the number of bars in the chart or to the value of some variable limitReCalcBar, if the conditions of calculation of bars are limited.
As a matter of fact, variable g_center = 2 based on the code.limitReCalcBar = 5000 also based on external variables.
When first running the indicator in the function:
is passed the value of 5000 accordingly.
i = index + g_center - 1 = 5000 + 2 - 1 = 5001
Let's look into the loop:
We need to calculate 5000 bars. After the first two bars i.e. 0 and 1 the conditioncnt < g_center is false. How can we then calculate all 5000 bars? This is the point I want to master. It seems to be elementary for a pro, but I don't get it. Of course, if we take the && operator as an OR, everything will fall into place... But it somehow contradicts what I have already used in Expert Advisors and have ever met.
Well, when everything is calculated, everything will be simple. 0 and 1 will be passed at every tick through index, conditions will be fulfilled in a loop and there are no difficulties, as I see.
Dear programmers! Can you please tell me if it is possible to write a script that monitors open positions and when a position reaches a certain level of loss, it closes part of the position. The loss threshold should be set in either the deposit currency, or in points. Thus, if the price goes against us, we reduced the loss and if the price turned to the profit, then instead of the loss we may get some profit or even smaller loss, depending on TP set. The script has to work all the time in EA mode, it is an assistant to any trading system or Expert Advisor.
Dear programmers! Can you please tell me if it is possible to write a script that monitors open positions and when a position reaches a certain level of loss, it closes part of the position. The loss threshold should be set in either the deposit currency, or in points. Thus, if the price goes against us, we reduced the loss and if the price turned to the profit, then instead of the loss we may get some profit or even smaller loss, depending on TP set. The script should always work in the EA mode, it is an assistant to any trading system or Expert Advisor.
Perhaps. There is help here.
Maybe. There is help here.
There's a thing called a stop loss!!!
Hello, I have a question. There are several equal windows in the terminal, each of them has the same Expert Advisor, but with different settings. Can you tell me if there is a function or a ready algorithm in MQL4 that can detect which window a market order is opened from?
Hello, I have a question. There are several identical windows in the terminal, each of them has the same Expert Advisor, but with different settings. Can you tell me if there is a function or a ready algorithm in MQL4 that allows you to determine which window a market order is open?
It makes more sense to make copies of the EA, naming them differently, and you will see in the logbook which copy and in which window you will be able to figure it out!
I will figure it out, but how do I inform the Expert Advisor about it?
It makes more sense to make copies of the EA, naming them differently, and you will see in the log everything, which spear and, accordingly, in which window you already know!
I need this so that the Expert Advisor can start making calculations on its own.