Question about "pip" and Error 130?

 

Hello, I have two questions.

1. What is the actual definition of "pip." On the EUR/USD, I always thought 1 pip referred to the 4th decimal place. But I'm seeing when changing the inputs of an EA that it seems to sometimes refer to the 4th, and sometimes to the 5th. For example, when I change the "Spread" input in the "Settings" tab of Strategy Tester, it refers to the 5th decimal place. But in the settings when I click on "Expert Properties" and change the values... according to the person I bought the EA from, he is saying that in SL, that a pip is the 4th decimal place, and for TP, it's the 5th. (He says that an input of 70 for SL = 7 pips, and an input of 10 for TP = 10 pips.) So I don't understand why it goes back and forth between 4th and 5th decimal. Also, I've always thought it was the 4th even before I knew what an EA was or tried to get into auto-trading.


Also, I keep getting an OrderSend Error 130. Google tells me that this is a result of the TP or SL being at places that are impossible for whatever reason. I can fix this partially by adjusting some or all of the SL, TP, Spread, and Trade Gap values. Can someone tell me a simple formula to remember to avoid this issue? For example, does the trade gap plus the TP need to be greater than the bid/ask spread (or something like this?)? Is there any such formula that is possible (even if my example is way off).


Thanks.
 
  1. farmerjohn: 1. What is the actual definition of "pip." On the EUR/USD, I always thought 1 pip referred to the 4th decimal place.

    Correct. Second decimal on JPY pairs.

    PIP, Point, or Tick are all different in general.
              What is a TICK? - MQL4 programming forum 2014.08.03

    Unless you manually adjust your SL/TP for each separate symbol, using Point 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 programming forum 2017.02.09
              Slippage defined in index points - Expert Advisors and Automated Trading - MQL5 programming forum 2018.01.15


  2. farmerjohn: I keep getting an OrderSend Error 130.

    This could be many things. Likely You used NormalizeDouble, It's use is usually wrong.

    1. Floating point has infinite number of decimals, it's your not understanding floating point and that some numbers can't be represented exactly. (like 1/10.)
                Double-precision floating-point format - Wikipedia, the free encyclopedia

      See also The == operand. - MQL4 programming forum

    2. Print out your values to the precision you want with DoubleToString - Conversion Functions - MQL4 Reference.

    3. SL/TP (stops) need to be normalized to tick size (not Point) — code fails on metals. (On 5Digit Broker Stops are only allowed to be placed on full pip values. How to find out in mql? - MQL4 programming forum) and abide by the limits Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial and that requires understanding floating point equality Can price != price ? - MQL4 programming forum

    4. Open price for pending orders need to be adjusted. On Currencies, Point == TickSize, so you will get the same answer, but it won't work on Metals. So do it right: Trailing Bar Entry EA - MQL4 programming forum or Bid/Ask: (No Need) to use NormalizeDouble in OrderSend - MQL4 programming forum

    5. Lot size must also be adjusted to a multiple of LotStep and check against min and max. If that is not a power of 1/10 then NormalizeDouble is wrong. Do it right.

    6. MathRound() and NormalizeDouble() are rounding in a different way. Make it explicit.
                MT4:NormalizeDouble - MQL5 programming forum
                How to Normalize - Expert Advisors and Automated Trading - MQL5 programming forum

    7. Prices you get from the terminal are already normalized.


Reason: