5 digits detection - page 4

 
jjc:

Phy has published an MT4 listing for the 10-year T-Note future which is quoted to 5DP: https://www.mql5.com/en/forum/109552/page3#195885. Anything up to 7DP potentially exists, i.e. is an attribute of a widely traded financial instrument.

I didn't know CB restarted the 'What is a tick' thread!! Thanks! some very useful stuff there... :)
 
cameofx:

- I have this idea : given the fact that Usd based pairs has a tickvalue of $US 10.00 fixed [..

The tick value is only fixed if your deposit currency is USD (or, as a generalisation, if the symbol's quote currency matches your deposit currency). For example, if your deposit is in GBP, then the tick value of EURGBP is fixed whereas GBPUSD is floating.

 
jjc:

The tick value is only fixed if your deposit currency is USD (or, as a generalisation, if the symbol's quote currency matches your deposit currency). For example, if your deposit is in GBP, then the tick value of EURGBP is fixed whereas GBPUSD is floating.

How do we 'anchor' it then if everything is relative and floating ?? This is what I have so far...:
int start()
  {
   double validPoint = validPoint(Point);
   int SL = Ask - 25 * validPoint;
   int TP = Ask + 25 * validPoint;
   
   int ticket = OrderSend(Symbol(),OP_BUY,1,Ask,3,SL,TP,"My order",1234,0,Green);
   Print("ticket = ", ticket);

   return(0);
  }
  
double  validPoint(double p){

   int digitPoint = 0; int dP = 0; double vP = 0.0;
   double anchor_value; 
   
   for(double i=1.0; i>p; i/=10){
         digitPoint ++;
         if(i * MarketInfo(Symbol(),MODE_TICKVALUE) > anchor_value)
         {vP = i; dP = digitPoint; }
   }
   return(vP);
}
digitPoint is supposed to be used to identify how many digit(s) after point our validPoint occurs.
anchor_value : I'm still not sure how to calculate this or if this makes sense for that matter...

EDIT : the loop was in the wrong direction...
 
Ok, now I've found an example whilst trading Gold (XAUUSD). Not, admittedly, an example of Tick Size changing spontaneously, but it exhibits the implication that concerned me enough at the time that prompted me to post here.


Point is 0.01, Tick Value is 5.00, however Tick Size is 0.05.

So in order to have a universal formula for calculating position sizes and reporting risk, I've substituted...

MarketInfo(Symbol(),MODE_TICKVALUE)

with

(MarketInfo(Symbol(),MODE_TICKVALUE)*Point)/MarketInfo(Symbol(),MODE_TICKSIZE)

...in the various formulae that I use.

It works like a dream, and I now have EAs which perform risk management correctly across all instruments.

CB

I quoted this from CB's post in 'What is a TICK' this is interesting maybe this should replace the simple Tickvalue call in the equation...

PS : 7Bit, don't mean to 'hijack' your thread... Hope you don't mind... :))

 
Hmm.. either nobody think this is important or I may have wandered off topic a little to far.... please help :(
 
does anyone else besides me think this is worthwhile? I think it will be convenient for all of us if we could find a solution... or do I need to post separate topic ? ... please advice
 
cameofx:
does anyone else besides me think this is worthwhile? I think it will be convenient for all of us if we could find a solution... or do I need to post separate topic ? ... please advice

The only thing that MQL4 uses Pips for is in coding Spread value in Order requests. Everything else is specified in terms of rate. One alternative to consider is to use currency rate differences as Input Parameters for T/P, S/L etc. For example, specify 0.0050 for a 50 Pip S/L. This works regardless of Digits, and only needs scaling by 100 when detecting "JPY" in Symbol() as the quote currency. This is viable for all the 21 major pairs (all USD, EUR, GBP, JPY, CHF, CAD, AUD combinations) and likely for minor pairs too (which few trade due to higher spreads). If you are really worried about "bullet proofing", you could supply a currency string and multiplier as Input Parameters (like JPY and 100). This can be extended for exotics too with different brokers.

I really think this is largely a mute point with most MQL4 coders; when they successfully implement and debug a profitable trading algorithm, they will use it on their own Live account. Few will want to sell it or give it away because the market will likely adjust to counteract the algorithm.

 
andydcoles:

The only thing that MQL4 uses Pips for is in coding Spread value in Order requests. Everything else is specified in terms of rate. One alternative to consider is to use currency rate differences as Input Parameters for T/P, S/L etc. For example, specify 0.0050 for a 50 Pip S/L. This works regardless of Digits, and only needs scaling by 100 when detecting "JPY" in Symbol() as the quote currency. This is viable for all the 21 major pairs (all USD, EUR, GBP, JPY, CHF, CAD, AUD combinations) and likely for minor pairs too (which few trade due to higher spreads). If you are really worried about "bullet proofing", you could supply a currency string and multiplier as Input Parameters (like JPY and 100). This can be extended for exotics too with different brokers.

I really think this is largely a mute point with most MQL4 coders; when they successfully implement and debug a profitable trading algorithm, they will use it on their own Live account. Few will want to sell it or give it away because the market will likely adjust to counteract the algorithm.

This. Personally I don't work in pips, I work in points. All the price data is given in points. The difference between two price values is in points. My stoploss and my exit point are all in points...they are a specific market price. The notion of pips is an interesting one but as most here can attest to once you try and bridge the notion of pips to that of points you lose rigor and robustness, and for what?

I've never had to deal with broker's shifting the number of significant digits in price because I coded all my equations to be self-consistent with the broker's marketinfo specifications. I don't think of stoploss in terms of pips, for me it is in terms of percents and actual market-determined prices and values.

I started out my forex life thinking about pips, naturally, since the mantra is prevalent in just about every piece of online literature and educational source you come across. But once I started challenging myself and the notion that pips was a necessary mental construct in order to manage my trading I then found it was more a barrier that stifled my creativity and options.

A pip is not something fundamental to trading, it is a crutch to get one started but if you never come back to it and investigate the purpose of its existence then you rob yourself the opportunity to move beyond that first tier on the forex learning curve (just my opinion of course).

 

This is the biggest subject which dominates this forum by far. I don't get it and probably never will. Whats a point or pip? Who cares. One reason I'm starting to like  like programming is because if you cannot define something, it becomes near imposable to program it IMO. If a group of programmers are going through 3 pages of post to define a pip/point. Then I better stay away from it for now.

 

The definition would seem important for a developer who want to program a commercial standard program and want the user to have the flexibility of imputing exactly how much dollars whey want to risk. For the most of us, our money management purposes however in combination with optimum stop losses does not provide such flexibility.

 

Example: I'm starting with $2000 and wanna risk exactly 2% of that capital. However the system I just optimized have a stop loss of 130 points. And lowest lot i can work with is 10,000 where point = $1. We have a real dilemma here. I'll either have to find a broker who offers smaller lots or wait till I have more money to trade. And even then the only thing I can control is lot size. I'd almost never be able to match exactly 2% of any bankroll with my system stop loss. All I can do is specify lot size in a round about way.

 
ubzen:

If a group of programmers are going through 3 pages of post to define a pip/point [...] Whats a point or pip? Who cares?

...Not quite fair. It's more that everyone has a different opinion, and the 3 pages consist of lots of different two-line answers.

You and phillip both make a very valid point, with one exception - but an exception which I think is why 7bit opened the topic in the first place.

If you are building a system for other people to use, not just for yourself, then the ability to enter values in pips is a major ease-of-use consideration. The average punter knows what they mean by 50 pips, but has to think quite a lot, and double-check, whether they mean a value of 0.005 rather than 0.0005 or 0.05 or whatever. The ability to enter parameters in pips matches how most end-users think in the forex world, and reduces errors. It also offers the prospect of being able to use the same parameter values on 2/3 and 4/5 digit symbols. I don't have much exposure to the mass-market commercial EAs, but I've never seen one where such parameters were entered as a price differential rather than a pip value.
Reason: