Invalid stops

 

FYI all,


I am using a copy trader and for some reason wheter i use the signal providers stop loss or a do my own custom stop loss i see the below in the journal


Signal

XAUUSD buy

ENTRY 2035.25-2035.50

SL  2030.35

TP1 2036.25

TP2 2036.75

TP3 2037.50


In MT5 it says the below:

Trades '565564': market buy 0.01 XAUUSD

KM 0 20:33:42.861 Trades '565564': accepted market buy 0.01 XAUUSD

ED 0 20:33:42.864 Trades '565564': market buy 0.01 XAUUSD placed for execution

RR 0 20:33:42.865 Trades '565564': order #49732921 buy 0.01 / 0.01 XAUUSD at market done in 130.143 ms

GR 2 20:33:42.866 Trades '565564': failed modify order #49732921 buy 0.01 XAUUSD at market sl: 0.00000 tp: 0.00000 -> market, sl: 2030.35000 tp: 0.00000 [Invalid request]

NL 2 20:33:42.866 Trades '565564': failed modify order #49732921 buy 0.01 XAUUSD at market sl: 0.00000 tp: 0.00000 -> market, sl: 0.00000 tp: 2036.25000 [Invalid request]

MG 0 20:33:43.214 Trades '565564': deal #46796602 buy 0.01 XAUUSD at 2035.05 done (based on order #49732921)

To me it seems as though for some reason in the stop loss it is adding the extra zeros and that is why the request is invalid. I have tried everything to fix and can't seem to see what the issue is..? Any help would be appreciated 

 
You need to always normalize prices to tick size/point.

Your sl and tp have 5 digits with is surely wrong for gold.
 

You can use this function to normalize prices:

double NormalizePrice(double price, string symbol)
{
   double points=SymbolInfoDouble(symbol, SYMBOL_POINT);
   int digits=SymbolInfoInteger(symbol, SYMBOL_DIGITS);
   return NormalizeDouble(floor(price/points)*points, digits);
}