![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
@puncher - I would not expect TICKVALUE to differ between 4 and 5 digit brokers.
If you are using tickvalue (for example) in a formula to calculate risk-per-trade, then, although tickvalue is a constant, your relative stoploss would be part of the formula and would have to be factored by 10 as required.
I've been through all this in my EAs in the past. Adjusting an EA between 2/4 and 3/5 digit brokers is actually pretty straightforward.
This post may help you further.
https://www.mql5.com/en/forum/119868
CB
cloudbreaker - what does it mean : Adjusting an EA between 2/4 and 3/5 digit brokers is actually pretty straightforward ???
.
.cloudbreaker wrote >>
@puncher - I would not expect TICKVALUE to differ between 4 and 5 digit brokers.
.
It does.
.
Ah yes Phy - you and I have been here before.
Was thinking of the ratio of TickValue / Ticksize which is what I use.
Sorry all.
CB
cloudbreaker - what does it mean : Adjusting an EA between 2/4 and 3/5 digit brokers is actually pretty straightforward ???
There really isn't any complexity to it:
- Detect whether you're dealing with a 3/5 digit or a 2/4 digit broker.
- Use a factor of 10 together with all relative values (SL, TP, Slippage) if its a 3/5 digit broker - remembering places such as lot/risk calculations where you may also use the relative SL value.
- Normalize your prices to the correct number of digits prior to using them in order functions etc.
- Remember that Print() will return 4 decimal places unless you use DoubleToStr().
That really is all there is to it.
CB
There really isn't any complexity to it:
- Detect whether you're dealing with a 3/5 digit or a 2/4 digit broker.
- Use a factor of 10 together with all relative values (SL, TP, Slippage) if its a 3/5 digit broker - remembering places such as lot/risk calculations where you may also use the relative SL value.
- Normalize your prices to the correct number of digits prior to using them in order functions etc.
- Remember that Print() will return 4 decimal places unless you use DoubleToStr().
That really is all there is to it.
CB
Can I use DoubleToStr() function for put TP, SL, Ask or Bid prices into the OrderSend(), OrderModify() or OrderClose() functions???
Use NormalizeDouble( valueToNormalize, Digits)
Use NormalizeDouble( valueToNormalize, Digits)
The reason for this, Puncher, is that DoubleToStr would return a string. If you look at the input parameters for the functions you refer to, you'll see that doubles are expected as input.
You would use DoubleToStr for a different purpose - eg. to get around the fact that Print() defaults to printing all doubles with 4 decimal places.
CB
All of you are wrong - In order to Exeprt Advisors works in 5 decimal point BROKERS you should do the following:
ADD:
extern bool FractionalPips = true;
int pip;
Then after the start of the strategy you include some code that sets the value of pip. Essentially when fractionalpips equals true, then pip equals 10, if not, pip equals 1.
if(FractionalPips==true)
{
pip=10;
}
else pip =1;
It is advised to change the following line :
OrderSend(Symbol(),OP_BUY,1,Ask,3,Ask-25*Point,Ask+25*Point,"My order
#2",16384,0,Green);
With :
ticket=OrderSend(Symbol(),OP_BUY,1,Ask,0,0,0,"My order #2",16384,0,Green);
if(ticket>0)
{
OrderSelect(ticket,SELECT_BY_TICKET);
OrderModify(OrderTicket(),OrderOpenPrice(),STOPLOS S,TAKEPROFIT,0,Green);
}
else
{
Print("OrderSend failed with error #",GetLastError());
}
Take a look at the following forum post for more information:
http://forexforums.dailyfx.com/expert-advisor-discussion/50312-mt4-expert-advisors-2.html#post291994
I close this subject - my EA now WORKS !!!