You have to verify that your stops abide by the Stops Level and Freeze Level conditions set by your broker.
Forum on trading, automated trading systems and testing trading strategies
HELP, failed cancel order [Invalid stops] problem!
Fernando Carreiro, 2022.02.08 14:35
Also read the following in detail ... The checks a trading robot must pass before publication in the Market
Especially these points:
Setting the TakeProfit and StopLoss levels within the SYMBOL_TRADE_STOPS_LEVEL minimum level Attempt to modify order or position within the SYMBOL_TRADE_FREEZE_LEVEL freeze level Forum on trading, automated trading systems and testing trading strategies
ERROR: Modification failed due to order or position being close to market
William Roeder, 2020.09.23 13:57
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 TutorialOn some ECN type brokers the value might be zero (broker doesn't know.) Use a minimum of two (2) PIPs.
1. the spread was settled down and, 2. there could have been atleast 100 points distance from order's open price Sadly it also seemed too difficult for setting though I know an EA could do it
Exact Error Messages:
- 2022.05.10 12:54:43.273 '77875698': modification of order #42949333 buy 0.01 GBPUSD at 1.23999 sl: 0.00000 tp: 1.23799 -> sl: 1.23913 tp: 1.23799 failed [Invalid S/L or T/P]
- 2022.05.10 12:54:46.666 '77875698': modification of order #42949333 buy 0.01 GBPUSD at 1.23999 sl: 0.00000 tp: 1.23799 -> sl: 1.23860 tp: 1.23799 failed [Invalid S/L or T/P]
- 2022.05.10 12:54:55.019 '77875698': modification of order #42949333 buy 0.01 GBPUSD at 1.23999 sl: 1.22558 tp: 1.23799 -> sl: 1.23738 tp: 1.23799 failed [Invalid S/L or T/P]
- 2022.05.10 12:55:03.356 '77875698': modification of order #42949333 buy 0.01 GBPUSD at 1.23999 sl: 1.22558 tp: 1.23799 -> sl: 1.23791 tp: 1.23799 failed [Invalid S/L or T/P]
- 2022.05.10 13:15:19.586 '77875698': modification of order #42893065 buy 0.04 NZDUSD at 0.64260 sl: 0.00000 tp: 0.00000 -> sl: 0.64004 tp: 0.00000 failed [Invalid S/L or T/P]
- 2022.05.10 14:04:10.387 '77875698': modification of order #42948741 buy 0.01 AUDUSD at 0.70225 sl: 0.00000 tp: 0.00000 -> sl: 0.70107 tp: 0.00000 failed [Invalid S/L or T/P]
- 2022.05.10 14:04:13.995 '77875698': modification of order #42948741 buy 0.01 AUDUSD at 0.70225 sl: 0.00000 tp: 0.00000 -> sl: 0.69917 tp: 0.00000 failed [Invalid S/L or T/P]
- Brian Lillard: Exact Error Messages:
are meaningless since you didn't print out what the market was at that moment.
- Brian Lillard: at 1.23999 sl: 0.00000 tp: 1.23799 -> sl: 1.23913 tp: 1.23799
You are trying to set the SL 8.6 PIPs from the open price. Are you using that (Ask)?
You buy at the Ask and sell at the Bid. Pending Buy Stop orders become market orders when hit and open at the Ask.
-
Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid / OrderClosePrice reaches it. Using Ask±n, makes your SL shorter and your TP longer, by the spread. Don't you want the specified amount used in either direction?
-
Your sell order's TP/SL (or Buy Stop's/Buy Limit's entry) will be triggered when the Ask / OrderClosePrice reaches it. To trigger close to a specific Bid price, add the average spread.
MODE_SPREAD (Paul) - MQL4 programming forum - Page 3 #25 -
The charts show Bid prices only. Turn on the Ask line to see how big the spread is (Tools → Options (control+O) → charts → Show ask line.)
Most brokers with variable spreads widen considerably at end of day (5 PM ET) ± 30 minutes. My GBPJPY shows average spread = 26 points, but average maximum spread = 134 (your broker will be similar).
-
Is this a manual operation or via EA? If manual, then please show a screenshot of your trading panel setup for the modification. If EA, then please show the code that tries to modify the position.
I'm only able to set stoploss a great distance from the order price of 131.197 @ 129.493
I am unable to set stoploss for 130.500 with 0 stops level and I don't know about freeze level
2022.05.11 16:45:41.348 '77875698': modification of order #42939060 buy 0.01 USDJPY at 130.999 sl: 0.000 tp: 0.000 -> sl: 130.500 tp: 0.000 failed [Invalid S/L or T/P]
Thanks
It may be that your broker's contract specification is reporting an incorrect value for the Stops Level or Freeze Level. It may report "0" points for them but actually implement some other value. Verify with the broker or have a look at the Contract Specification on their website to see if it is the same or not.
Also, the Freeze Level does not seem to be reported on the Specifications sheet from the Market Watch window, but if you view the specifications from the strategy tester when selecting that symbol for testing, you will be able to see what the Freeze Level is set at.
Because of US FIFO rules when you open multiple orders; SL must be further than all other existing ones.
Since 2009, hedging is not permitted for US traders.
NFA Enforces FIFO Rule, Bans Forex Hedging in US Forex Accounts - Trading Heroes (September 12, 2016)
FAQ: FIFO in the Forex Market - BabyPips.com (May 31, 2011)
"Hedging" in Forex trading -Why do it? - Trading Systems - MQL5 programming forum (2017)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Greetngs
Have issues with setting order levels on chart from dragging and dropping a stoploss or takeprofit
It's actually saying invalid market levels but it makes no sense as
1. the spread was settled down
and, 2. there could have been atleast 100 points distance from order's open price
Sadly it also seemed too difficult for setting though I know an EA could do it
Thx
Exact Error Messages: