I will put an Expert in a VPN ..but I can not find the forum or google if you need to set slippage or what number best suited for this.
thank you very much people! (:
There is no "best" value for slippage as it depends on many factors.
First, you have to find out if the broker allows the slippage parameter to be set or if it is simply ignored!
Second, the slippage depends on market conditions such as price volatility and liquidity, type of strategy being used, type of orders being used, broker response time to order placement and many other factors.
A good place to start, is to visit the "Signals" section here and for the various and many signal services offered, take a look at the "Slippage" section of each of them and to analyze what the average slippage is for the many Brokers, Account Types as well as the Types of Strategies involved. This should give give you an idea of what the possible slippage values are and what you could use for your own case.
I agree there is no best.
The value is to keep the EA in sync with the market. You send the order, loose network for a minute, then the request reaches the server. If the market has moved significantly from the sent price, the order should be rejected.
I simply use twice the spread. (some pairs like EURNOK near 5PM ET have a spread of 3000 (sic) points.)
in their advisors, I set at the two spreads
slippage = int( 2.0 * (Ask - Bid) / _Point);
Ok, why it not specified in the reference?Why is there always write NormalizeDouble and Digits?
WHRoeder is correct! Use the TICKSIZE and not _Point (nor "NormalizeDouble()") to align your Price/Quote, especially with non-currencies. I learned this from experience, that this is indeed the case and that the many, many examples out there (even those by MetaQuotes) are incorrect.
What you can use is the CSymbolInfo class of Metatrader 5, which should work fine with MT4 too. There is a method called .NormalizePrice() which also recognizes the tick size.
Another tricky thing is, that not only NormalizeDouble() is a problem, the equation operator used with quotes which are stored in double variables is another. It may happen, that a "if (price1==price2)" returns false when the stored quotes are actually identical. To avoid any such problems, one should also use CompareDouble() which is part of stdlib.ex4.
PS: And also never use Print() with such doubles. It just makes headache.