Questions from a "dummy" - page 209

 
talliy:

I would also like to clarify how to prohibit a variable from moving behind a price.

Example: A simple stop trawl. We tell the variable to follow the price at a distance of 20 pips (for example). In other words, variable = bid price - 20 pips (assuming we have bought). The price goes up and we successfully follow it. Then the price goes down and we need the variable to remain in its value at the same level.

So, my question is how to forbid the variable to take a value at a certain point?

For example like this:

if(mysymbol.Bid()>(myposition.StopLoss()+StopLoss*_Point))
              {
                ...
              }
 
A100:

Method Description
mysymbol.RefreshRates() Used to refresh rates. When a new symbol is set, it is called automatically.

Then it's not called automatically!

Method Description
mysmbol.RefreshRates() This function is used to check the latest quotes data. It returns true on success and false on failure. This is a useful function you cannot do without.

It turns out that the article https://www.mql5.com/en/articles/138 was originally written in English and the translation is not quite right - there is no reference to the automatic call. It is advisable to specify the original language in the header of the article.

The Use of the MQL5 Standard Trade Class libraries in writing an Expert Advisor
The Use of the MQL5 Standard Trade Class libraries in writing an Expert Advisor
  • 2010.11.10
  • Samuel
  • www.mql5.com
This article explains how to use the major functionalities of the MQL5 Standard Library Trade Classes in writing Expert Advisors which implements position closing and modifying, pending order placing and deletion and verifying of Margin before placing a trade. We have also demonstrated how Trade classes can be used to obtain order and deal details.
 
uncleVic:

Thank you very much humanly!!!

Whoa, whoa, whoa, whoa, whoa, whoa, whoa, whoa, whoa!

A static variable can be initialised with a constant or constant expression corresponding to its type, unlike a simple local variable which can be initialised with any expression.

Static variables exist at the momentof program execution and are initialized once before calling the specialized OnInit() function. If no initial values are specified, static memory class variables take zero initial values.

Local variables declared with static keyword save their values as long as the function exists. At each next function call, these local variables contain the values they had at the previous call.

 
Reshetov:

For example, like this:

And if the trawl is done invisibly from the broker without marking a stop loss. Just some kind of price tracking.
 
A100:
Method Description
mysmbol.RefreshRates() This function is used to check the latest quotes data. It returns true on success and false on failure. This is a useful function you cannot do without.

It turns out that the article https://www.mql5.com/en/articles/138 was originally written in English and the translation is not quite right - there is no reference to the automatic call. It is advisable to specify the original language in the header of the article.

Thanks for the useful link
 
MetaQuotes:


MetaTrader 5 Client Terminal build 722

5. Terminal: Fixed chart navigation when fixing point is set.
Can you elaborate on what this is about?
 

talliy:

Yedelkin : Alternatively, enter another variable to which you will assign the value true, if the first variable is sent to print.

bool bar_printed=false;
...
if()                     //Проверяете нужное условие
  {
   ...
   if(!bar_printed) { Print("Нужное условие выполнено");
      bar_printed=true;
     }
  } 

In the case you suggest, the variable is false with every tick and becomes true after the printing is done. Then there is a new tick and the onTick() operator executes its program from top to bottom. And there the variable is again false, and in the condition if the variable is false then print. And hence the log is full of entries with every tick. Tested!!!

I wonder who told you that the line'bool bar_printed=false;' needs to be inserted in the tick handler? - Nevertheless, you inserted this line directly into the tick handler and then made your output like "variable with every tick is false".

And where did you insert the ellipsis from the second line of my example? And how did your Expert Advisor react to that ellipsis? - ...Maybe, before you put another stamp "Verified!!!", it's better to ask, how correctly you understood the essence of your proposed example?

 
uncleVic:

If you look closely at the CPositionInfo class "with X-ray", you may notice that the Type() method does not return the position type (unlike the PositionType() method).

I suggest renaming all the Type() methods of the standard library to ClassType().

There are too many such errors and confusion.

I had already put CPositionInfo.Type() into the code three or four times where I needed the type of position. Then I spent three days on debugging (the first two times. Then I understood it faster) :).

For compatibility, you can first make a duplicate with the new name, and remove the old one in a few weeks (months).

 
Hello. Could you please advise how to place Channel.mq4 and Scalper_MA.mq4 file in MT4? Thank you!
 
[АРХИВ!] Любой вопрос новичка, чтоб не захламлять форум. Профи, не проходите мимо. Без вас никуда - 4. - MQL4 форум
  • www.mql5.com
[АРХИВ!] Любой вопрос новичка, чтоб не захламлять форум. Профи, не проходите мимо. Без вас никуда - 4. - MQL4 форум
Reason: