confused - MODE_POINT, Point, Pips, 4/5decimal - page 2

 
whroeder1:
Using Points means code breaks on 4 digit brokers, exotics (e.g. USDZAR where spread is over 500 points,) and metals. Compute what a PIP is and use it, not points.
          How to manage JPY pairs with parameters? - MQL4 and MetaTrader 4 - MQL4 programming forum
          Slippage defined in index points - Currency Pairs - Expert Advisors and Automated Trading - MQL5 programming forum

Sorry I said you are multiplying by zero, which is not true. Edited previous message to make it clear, but those anomalies like sugar still need to be handled.

On my before mentioned FxPro account (5 digit broker) pip-to-points ratio varies from 0.1 to 100. USDZAR (and some others) has 7 significant digits, compared to the usual 6, with pip(1/100 of percentage point)-to-point ratio of 100.

 
Petr Nosek:

Using either Points or PIP means code breaks if you don't calculate with Tick size. In my opinion there isn't a reason for using PIP. Only Tick size is relevant.

BTW What is the effect of the spread size on PIP, Point or Tick size???

It's up to you if you want to use PIP but your code will be unpredictable on not Forex symbols.

I dare to suspect that the source of that error is a result of dealing with not pips but percentages (not percentage points). 500 points on a 4 digit broker is 0,5% so converting percentages will occasionally move the resulting pip digits down. 

 

I've bothered to read your link and you should consider to stop pasting this link because your code is wrong.

Here is your compute what a PIP is:

double dvpl = DeltaValuePerLot();
double pip  = 0.0001;
while(dvpl * pip < 5) pip *= 10;

where the function DeltaValuePerLot() is:

double  DeltaValuePerLot(string pair=""){
    if (pair == "") pair = Symbol();
    return(  MarketInfo(pair, MODE_TICKVALUE)
           / MarketInfo(pair, MODE_TICKSIZE) ); // Not Point.
}

Of course, the results are unpredictable because the Tick Value is sometime in Account currency but not rare in Base currency see: https://www.mql5.com/en/forum/227407#comment_6534385 . Your code may be works with USD Account currency but it isn't a general solution.

In my case your code calculate PIP=0.001 for USDJPY and I don't talk about indexes and metals.

Is there an universal solution for Tick value?
Is there an universal solution for Tick value?
  • 2018.02.11
  • www.mql5.com
I wonder how you manage the Tick value in your code. For some Symbols it is in the deposit currency but for some Symbols it is in another currency...
 
whroeder1:
  1. If you program n * TickSize on a 4 digit broker and then move to a 5 digit broker, or visa versa, your code breaks on Forex because TickSize equals Point. But 0.0123 equals 0.01230. If you move to one of the exotics, your code breaks because PIP is to small there.

  2. None! PIP, Point, or Ticksize are units of measure. Spread can be stated as an absolute measure (0.00123) or given in PIPs (12.3,) or in Points or Ticksize (123). [Assuming 5 digit non-JPY pair.]

  3. Which is what my code adjusts for. If you're going to specify an arbitrary constant, at least have it adjust for different symbols.
  1. I really don't understand you. If my code runs on 4 digit broker then e.g TickValue for EURUSD is 0.0001 and the code adjust my Open Price, SL, TP... to this value. If it runs on 5 digit broker than TickValue is 0.00001 and the code adjust my Open Price, SL, TP... to this value. Why should I use PIPs or points? If you mean that e.g. I want to set some distance in Points than of course there is difference between 4 or 5 digits broker and in this case you can use just for currency's Symbols PIPs. But it still won't work on others Symbols. If I move to the exotics (I don't trade the exotics) my code doesn't break. Why do you think so? Maybe you could write some examples where you need to use PIPs to understanding.
  2. I know it. But you wrote that you have to use PIPs instead of Tick Value on the exotics because there is too large spread. That makes no sense to me.
  3. Of course you have to adjust the variables for different Symbols. Do you think that I have a different opinion?
 
Petr Nosek:
  1. I really don't understand you. If my code runs on 4 digit broker then e.g TickValue for EURUSD is 0.0001 and the code adjust my Open Price, SL, TP... to this value. If it runs on 5 digit broker than TickValue is 0.00001 and the code adjust my Open Price, SL, TP... to this value. Why should I use PIPs or points? If you mean that e.g. I want to set some distance in Points than of course there is difference between 4 or 5 digits broker and in this case you can use just for currency's Symbols PIPs. But it still won't work on others Symbols. If I move to the exotics (I don't trade the exotics) my code doesn't break. Why do you think so? Maybe you could write some examples where you need to use PIPs to understanding.
  2. I know it. But you wrote that you have to use PIPs instead of Tick Value on the exotics because there is too large spread. That makes no sense to me.
  3. Of course you have to adjust the variables for different Symbols. Do you think that I have a different opinion?
I agree. There's no reason your code would break when you use tick-size. I'm not sure where all these "4 digit brokers" are (if there even are any) but the algorithm would automatically adjust because the tick-size and tick-value would be different. PIP is an obsolete concept, especially in algorithmic trading. 
 
Petr Nosek:

I've bothered to read your link and you should consider to stop pasting this link because your code is wrong.

Here is your compute what a PIP is:

where the function DeltaValuePerLot() is:

Of course, the results are unpredictable because the Tick Value is sometime in Account currency but not rare in Base currency see: https://www.mql5.com/en/forum/227407#comment_6534385 . Your code may be works with USD Account currency but it isn't a general solution.

In my case your code calculate PIP=0.001 for USDJPY and I don't talk about indexes and metals.

Either you rely on tick value, and then it's ALWAYS in account currency (but as you noted some lazy brokers provide wrong value)

or you calculate it yourself and then it's irrelevant to discuss about it.

Beside correctness of published code, which is a must, discussing about pip/point is just a lost of time, anyone is free to use what he wants. The real problem starts when someone want to impose his own "standard".

 
Petr Nosek:

I've bothered to read your link and you should consider to stop pasting this link because your code is wrong.

Here is your compute what a PIP is:

where the function DeltaValuePerLot() is:

Of course, the results are unpredictable because the Tick Value is sometime in Account currency but not rare in Base currency see:  https://www.mql5.com/en/forum/227407#comment_6534385 . Your code may be works with USD Account currency but it isn't a general solution.

In my case your code calculate PIP=0.001 for USDJPY and I don't talk about indexes and metals.

@Petr Nosek

Did you ever get this resolved in an acceptable manner?
I've been trying to follow these various discussions and I'm now left more confused than ever.

Where is the correct code to calculate CFD pip values when using a non-US account currency (or similarly a CFD, such as JP225, not using USD)?