Invalid Stops, Failed to modify open position - page 2

 

Forum on trading, automated trading systems and testing trading strategies

Tick size vs Point(), can be a little tricky in Multicurrency EA

Fernando Carreiro, 2022.03.09 12:11

Tick Size and Point Size can be very different especially on stocks and other symbols besides forex.

Always use Tick Size to adjust and align your prices, not the point size. In essence, make sure that your price quotes, are properly aligned to the Tick size (see following examples).

...
double tickSize = SymbolInfoDouble( _Symbol, SYMBOL_TRADE_TICK_SIZE );
...
double normalised_price = round( price / tick_size ) * tick_size;
...
// Or use a function
double Round2Ticksize( double price )
{
   double tick_size = SymbolInfoDouble( _Symbol, SYMBOL_TRADE_TICK_SIZE );
   return( round( price / tick_size ) * tick_size );
};

Articles

The checks a trading robot must pass before publication in the Market

MetaQuotes, 2016.08.01 09:30

Before any product is published in the Market, it must undergo compulsory preliminary checks in order to ensure a uniform quality standard. This article considers the most frequent errors made by developers in their technical indicators and trading robots. An also shows how to self-test a product before sending it to the Market.
 
Javier Santiago Gaston De Iriarte Cabrera #: WHAT NUMBER OF POINTS DO I HAVE TU USE TO CHANGE THE PROFIT LEVEL?
  1. Don't SHOUT at us, that is RUDE!

  2. You can't move stops (or pending prices) closer to the market than the minimum: MODE_STOPLEVEL * _Point or SymbolInfoInteger(SYMBOL_TRADE_STOPS_LEVEL).
              Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial

    On some ECN type brokers, the value might be zero (the broker doesn't know). Use a minimum of two (2) PIPs.

    The checks a trading robot must pass before publication in the Market - MQL5 Articles (2016)

 

ticket closed, managed to make it work ... it was modified before, that's why it had the same limits.

You where right, the sl and tp must be different.

and sorry ...


this is wierd, coz I only have errors in the sell (and use similar expressions for buy)

this is what I get

2023.06.18 02:44:20.381 Core 01 2023.06.07 12:00:00   Modify #116 EURUSD POSITION_TYPE_SELL

2023.06.18 02:44:20.381 Core 01 2023.06.07 12:00:00   failed modify #116 sell 0.14 EURUSD sl: 1.06965, tp: 1.06677 -> sl: 1.06771, tp: 1.06676 [Invalid stops]


2023.06.18 02:44:20.381 Core 01 2023.06.07 12:00:00   OrderSend error 4756

2023.06.18 02:44:20.381 Core 01 2023.06.07 12:00:00   retcode=10016  deal=0  order=0


why invalid stops?


I also got this errrors ... what can I be missing?


2023.06.18 03:07:16.283 Core 01 2022.09.02 08:00:00   failed modify #28 sell 0.16 EURUSD sl: 0.99980, tp: 0.99103 -> sl: 0.99315, tp: 0.99102 [Invalid stops]

2023.06.18 03:07:22.386 Core 01 2022.09.14 13:30:00   failed modify #32 sell 0.15 EURUSD sl: 1.00578, tp: 0.99551 -> sl: 0.99801, tp: 0.99550 [Invalid stops]

2023.06.18 03:07:46.801 Core 01 2022.11.22 05:30:01   failed modify #40 sell 0.16 EURUSD sl: 1.03389, tp: 1.02219 -> sl: 1.02383, tp: 1.02218 [Invalid stops]

2023.06.18 03:07:46.801 Core 01 2022.11.30 07:30:00   failed modify #42 sell 0.16 EURUSD sl: 1.03878, tp: 1.03186 -> sl: 1.03336, tp: 1.03185 [Invalid stops]

2023.06.18 03:07:52.904 Core 01 2023.01.04 06:30:01   failed modify #44 sell 0.16 EURUSD sl: 1.06435, tp: 1.05188 -> sl: 1.05370, tp: 1.05187 [Invalid stops]

2023.06.18 03:07:59.008 Core 01 2023.01.31 20:30:00   failed modify #46 sell 0.16 EURUSD sl: 1.08760, tp: 1.08014 -> sl: 1.08270, tp: 1.08013 [Invalid stops]

2023.06.18 03:08:05.111 Core 01 2023.02.16 04:00:00   failed modify #50 sell 0.16 EURUSD sl: 1.07094, tp: 1.06598 -> sl: 1.06767, tp: 1.06597 [Invalid stops]

2023.06.18 03:08:17.318 Core 01 2023.03.27 16:30:00   failed modify #62 sell 0.16 EURUSD sl: 1.08041, tp: 1.07365 -> sl: 1.07582, tp: 1.07364 [Invalid stops]

2023.06.18 03:08:23.421 Core 01 2023.04.10 11:30:01   failed modify #64 sell 0.15 EURUSD sl: 1.09185, tp: 1.08756 -> sl: 1.08902, tp: 1.08755 [Invalid stops]

2023.06.18 03:08:23.421 Core 01 2023.04.18 09:00:00   failed modify #68 sell 0.15 EURUSD sl: 1.09881, tp: 1.09085 -> sl: 1.09211, tp: 1.09084 [Invalid stops]

2023.06.18 03:08:23.421 Core 01 2023.04.26 08:30:01   failed modify #70 sell 0.15 EURUSD sl: 1.09891, tp: 1.09635 -> sl: 1.09706, tp: 1.09634 [Invalid stops]

2023.06.18 03:08:29.524 Core 01 2023.05.02 19:00:00   failed modify #72 sell 0.15 EURUSD sl: 1.10119, tp: 1.09414 -> sl: 1.09622, tp: 1.09413 [Invalid stops]

2023.06.18 03:08:29.524 Core 01 2023.05.10 05:30:01   failed modify #74 sell 0.15 EURUSD sl: 1.10176, tp: 1.09405 -> sl: 1.09523, tp: 1.09404 [Invalid stops]


 

Don't start a new thread for continuation of a related topic. I have removed the new thread and copied the text over to your previous post.

You are still ignoring advice given — post #11 — To summarise ... align your prices to the ticks size, and check your Stops Level.

 
Fernando Carreiro #:
s to the ticks size

Thanks !!

 
Javier Santiago Gaston De Iriarte Cabrera #: Thanks !!
Please note that Stops Level is not your T/P or S/L prices, it is something else ... Setting the TakeProfit and StopLoss levels within the SYMBOL_TRADE_STOPS_LEVEL minimum level
 

I've ticksized eaven sl, and tp 

and still have an error, what else could I try?


2023.06.18 04:05:19.232 Core 01 2023.02.10 12:06:30   failed modify #20 sell 0.14 EURUSD sl: 1.08474, tp: 1.06685 -> sl: 1.07014, tp: 1.06684 [Invalid stops]

2023.06.18 04:05:55.990 Core 01 2023.05.16 18:09:54   failed modify #28 sell 0.14 EURUSD sl: 1.09813, tp: 1.08445 -> sl: 1.08574, tp: 1.08444 [Invalid stops]


 
Javier Santiago Gaston De Iriarte Cabrera #:

I've ticksized eaven sl, and tp 

and still have an error, what else could I try?

2023.06.18 04:05:19.232 Core 01 2023.02.10 12:06:30   failed modify #20 sell 0.14 EURUSD sl: 1.08474, tp: 1.06685 -> sl: 1.07014, tp: 1.06684 [Invalid stops]

2023.06.18 04:05:55.990 Core 01 2023.05.16 18:09:54   failed modify #28 sell 0.14 EURUSD sl: 1.09813, tp: 1.08445 -> sl: 1.08574, tp: 1.08444 [Invalid stops]

Show your code. We cannot read your mind nor see your computer.

Are you checking the Stops Level and Freeze Level as well as current Bid/Ask at the time?

Are you applying the checks that in the Article I referenced? — The checks a trading robot must pass before publication in the Market

The checks a trading robot must pass before publication in the Market
The checks a trading robot must pass before publication in the Market
  • www.mql5.com
Before any product is published in the Market, it must undergo compulsory preliminary checks in order to ensure a uniform quality standard. This article considers the most frequent errors made by developers in their technical indicators and trading robots. An also shows how to self-test a product before sending it to the Market.
 
Fernando Carreiro #:

Show your code. We cannot read your mind nor see your computer.

Are you checking the Stops Level and Freeze Level as well as current Bid/Ask at the time?

Are you applying the checks that in the Article I referenced? — The checks a trading robot must pass before publication in the Market

Hi, I don't know what freeze level are?

I managed to not get errors, but when uploading the expertadvisor, it gives lots of errors

test on EURUSD,M1 (netting) 2019.02.01 04:24:00 failed instant sell 0.2 EURUSD at 1.14436 sl: 1.14452 tp: 1.14373 [Invalid stops] 2019.02.01 05:15:00 failed instant sell 0.2 EURUSD at 1.14435 sl: 1.14440 tp: 1.14395 [Invalid stops] 2019.02.01 08:19:00 failed instant sell 0.2 EURUSD at 1.14384 sl: 1.14406 tp: 1.14339 [Invalid stops] 2019.02.01 08:25:00 failed instant sell 0.2 EURUSD at 1.14400 sl: 1.14405 tp: 1.14340 [Invalid stops] 2019.02.01 22:09:00 failed instant sell 0.2 EURUSD at 1.14619 sl: 1.14647 tp: 1.14573 [Invalid stops] 2019.02.01 22:31:00 failed instant sell 0.2 EURUSD at 1.14609 sl: 1.14632 tp: 1.14576 [Invalid stops] 2019.02.01 23:15:00 failed instant sell 0.2 EURUSD at 1.14606 sl: 1.14607 tp: 1.14571 [Invalid stops] 2019.02.04 07:52:00 failed instant sell 0.2 EURUSD at 1.14455 sl: 1.14480 tp: 1.14423 [Invalid stops] 2019.02.04 07:56:00 failed instant sell 0.2 EURUSD at 1.14460 sl: 1.14478 tp: 1.14426 [Invalid stops] 2019.02.04 08:23:00 failed instant sell 0.2 EURUSD at 1.14447 sl: 1.14462 tp: 1.14415 [Invalid stops] 2019.02.04 08:54:00 failed instant sell 0.2 EURUSD at 1.14430 sl: 1.14445 tp: 1.14392 [Invalid stops] 2019.02.05 06:50:00 failed instant sell 0.2 EURUSD at 1.14335 sl: 1.14359 tp: 1.14302 [Invalid stops] 2019.02.05 07:13:00 failed instant sell 0.2 EURUSD at 1.14335 sl: 1.14353 tp: 1.14303 [Invalid stops] 2019.02.06 00:18:00 failed instant sell 0.2 EURUSD at 1.14071 sl: 1.14087 tp: 1.14009 [Invalid stops] 2019.02.06 00:48:00 failed instant sell 0.2 EURUSD at 1.14065 sl: 1.14077 tp: 1.14019 [Invalid stops] 2019.02.06 01:04:00 failed instant sell 0.2 EURUSD at 1.14065 sl: 1.14072 tp: 1.14029 [Invalid stops] 2019.02.06 10:27:00 failed instant sell 0.2 EURUSD at 1.13910 sl: 1.13916 tp: 1.13816 [Invalid stops] 2019.02.06 14:17:00 failed instant sell 0.2 EURUSD at 1.13877 sl: 1.13901 tp: 1.13827 [Invalid stops] 2019.02.06 14:26:00 failed instant sell 0.2 EURUSD at 1.13889 sl: 1.13899 tp: 1.13827 [Invalid stops] 2019.02.06 17:25:00 failed instant sell 0.2 EURUSD at 1.13868 sl: 1.13878 tp: 1.13791 [Invalid stops] 2019.02.06 19:01:00 failed instant sell 0.2 EURUSD at 1.13807 sl: 1.13825 tp: 1.13743 [Invalid stops] there are no trading operations

I've tested in the same period, and I don't get those errors.

what can I do here?

 
Javier Santiago Gaston De Iriarte Cabrera #: Hi, I don't know what freeze level are? what can I do here?

Then do the research. I have provided the links. I have provided a graphic for easier understanding. So read up on the links, study it, apply it. Do your research. Put in the effort.

EDIT: And if you can't do it, then hire someone to code it for you.

Reason: