Problems of setting levels

 

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:

  • 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]

 

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

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 Tutorial

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



 
Brian Lillard: 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

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]

Also, your T/P and S/L are on the opposite sides. Your S/L is above the T/P (or the T/P below the S/L) for a buy position. That can't be correct.
 
  1. Brian Lillard: Exact Error Messages:

    are meaningless since you didn't print out what the market was at that moment.

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

      1. 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?

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

      3. 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).

     

    Here's new example on setting 125 point stoploss and it fails


    2022.05.11 08:50:07.085 '77875698': modification of order #42937006 buy 0.01 USDJPY at 131.197 sl: 0.000 tp: 0.000 -> sl: 131.072 tp: 0.000 failed [Invalid S/L or T/P]



     
    Brian Lillard #: Here's new example on setting 125 point stoploss and it fails 2022.05.11 08:50:07.085 '77875698': modification of order #42937006 buy 0.01 USDJPY at 131.197 sl: 0.000 tp: 0.000 -> sl: 131.072 tp: 0.000 failed [Invalid S/L or T/P]

    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

     
    Brian Lillard #:Yes it's just manual trading. 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.

    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.


     
    Perhaps interestingly, as for example, I'd recently found out is that a stoploss may be dragged from an order to a large distance and moved to it's desired spot rather than at first and that I am then permitted to actually place a stoploss where I want on the chart. Sorry if I've confused you, so I have an EURUSD trade that I could not drag a stoploss to -200 points and instead let's say -2000, and then after I have a stoploss of -2000 placed with the broker then it would allow me to drag the stoploss to the -200 points distance. It doesn't always work and still I am yet to be certain of what freeze level is by the broker.
     
    Brian Lillard #: Perhaps interestingly, …

    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)

     
    I'm using a broker that came out of another country then America's FIFO