Hi everyone, I'm new in MQL5/Metatrader, I'm wiritng my first EA and I'm a bit confused with Takeprofit calculation. I want to place a buy order with 60pips take profit target, looking at some example and documentation I thought the code below was correct, but it creates orders with take profit of 6 pips. What am I doing wrong? I'm working on GBPUSD
//global vars
static double tp_pips = 60;
static double sl_pips = 30;
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
double p = NormalizeDouble(SymbolInfoDouble(_Symbol, SYMBOL_ASK), _Digits);
double tp = p + (tp_pips * _Point);
double sl = p - (sl_pips * _Point);
trade.Buy(LotSize, _Symbol, p, sl, tp, NULL);
trade_error_code = trade.ResultRetcode();
Please use code formating.
For your question, if 60 gives 6 pips. What about 600?
- gippo37It: but it creates orders with take profit of 6 pips. What am I doing wrong?
-
Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum
Messages Editor -
A PIP is not a point.
-
PIP, Point, or Tick are all different in general.
What is a TICK? - MQL4 programming forum -
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
Slippage defined in index points - Currency Pairs - Expert Advisors and Automated Trading - MQL5 programming forum
-
-
- Nelson Wanyama: What about 600?Only fixes for that symbol, that broker. № 1.2.3
Please use code formating.
For your question, if 60 gives 6 pips. What about 600?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi everyone, I'm new in MQL5/Metatrader, I'm wiritng my first EA and I'm a bit confused with Takeprofit calculation. I want to place a buy order with 60pips take profit target, looking at some example and documentation I thought the code below was correct, but it creates orders with take profit of 6 pips. What am I doing wrong? I'm working on GBPUSD