Point vs pips Oanda

To add comments, please log in or register
SirFency
173
SirFency  
I'm writing a script for MT4 on the Oanda platform and I'm a bit confused. Normally with a 3 or a 5 digit value you would need to convert a Point to a pip by multiplying by 10. When I do this however, I end up getting 10 times the amount of pips. So when I want to set my take profit to 50 pips. it sets my take profit to 500 pips. I need to know if Oanda is using the term "pip" properly or if they are returning the Point value == pips. because to solve the issue I just multiply the Point value by my take profit value and Oanda seems to display the proper amount of pips. I'm attaching my script for review. 
//+------------------------------------------------------------------+
//|                                                PurchaseOrder.mq4 |
//|                                               Erick_Fenstermaker |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Erick_Fenstermaker"
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
#include <stdlib.mqh>
#property show_inputs
extern int TakeProfit = 50;
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
  //Setting the proper pip size for each currency
  //double pips = Point;
  //if (Digits == 3 || Digits == 5)pips *= 10;
      int err = 0; //Declaration of a variable for error checking
      
      //Sending an order to purchase a contract with a 50 pip take proffit and no stop loss.
      int  TicketNumber = OrderSend(Symbol(), OP_BUY, .01, Ask, 30, 0, 0, NULL, 1, 0, clrGreen);     
      //Printing out solution for specific error to journal
      if(err == ERR_TRADE_NOT_ALLOWED)Alert("YOU NEED TO ENABLE YOUR AUTOTRADING BUTTON!");
      //checking to see if the contract was sent for purchase
      if(TicketNumber == -1)
      {
      err = GetLastError();//if the order was not sent this is where we find out why
      Print("Could not send order due to error, " ,err, ErrorDescription(err));
      }
      else //if the order was sent we check to see if the ticket was selected
         if (!OrderSelect(TicketNumber, SELECT_BY_TICKET))
         {
         err = GetLastError();//if the order was not selected this is where we find out why
         Print("Could not select order due to error, " ,err, ErrorDescription(err));
         }
         else//if the order was selected we check to see if it was modified
            if (!OrderModify(TicketNumber, OrderOpenPrice(), NULL, OrderOpenPrice() + (TakeProfit*Point), 0, clrGreen))
            {
            err = GetLastError();//if the order was not modified this is where we find out why
            Print("Could not modify order due to error, " ,err, ErrorDescription(err));
            }
  }
  
  
  
  
//+------------------------------------------------------------------+
William Roeder
20210
William Roeder  
SirFency: . Normally with a 3 or a 5 digit value you would need to convert a Point to a pip by multiplying by 10. When I do this however, I end up getting 10 times the amount of pips. So when I want to set my take profit to 50 pips. it sets my take profit to 500 pips. I need to know if Oanda is using the term "pip" properly
  1. Oanda isn't using any term, and the terminal has no concept of a PIP.

  2. 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

  3. extern int TakeProfit = 50;
    ... OrderOpenPrice() + (TakeProfit*Point),
    Your code as written is setting the TP to 50 points not 50 pips.
SirFency
173
SirFency  
whroeder1:
  1. Oanda isn't using any term, and the terminal has no concept of a PIP.

  2. 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

  3. Your code as written is setting the TP to 50 points not 50 pips.
I understand that I'm setting it to 50 Points but this is seeming to equal the same as pips in Oanda. When I mouse over my take profit line in the graph it says 50 pips. This happens on 5 digits and 3 digits and Oanda does not seem to have 4 or 2 digit currency pairs. According to them the 5th decimal place or the 3rd decimal place depending on the currency pair should be considered a pipette but like I said when I place a trade with this script written just like this its showing me that my take profit is actually correct. It's confusing me because its a entier decimal place off.
To add comments, please log in or register