why sell limit not work ??

 

Hi guys  i have  a  big long  script , in practical this  script  create a edit box  in chart  i insert a  price inside at  this edit box  and after i press button  it should  send  a sell limit  but  return me  error  invalid price 1.05414460 for OrderSend function,  Obviously the price when i  push button is 1.05333  less than my value , i  send  my part of  code  if  anyone  can look  if  exist some  error , is welcome  , thanks

 if (StringToDouble(BT2PriceInsert_1) != 0.0 ) 
            {
                  if (BT2PriceInsert_1 < Bid)  // sell 1
                  {
                     // Fai qualcosa con il valore letto dall'EditBox

                      SElLmt2 = OrderSend(Symbol(), OP_SELLLIMIT, StringToDouble(BT2Lotto), StringToDouble(BT2PriceInsert_2), 3, 0, 0,  Magik+"_OCO_Sell2LMT", Magik, clrNONE, clrNONE);

                  //   ObjectDelete(0, "Price_2_Line"); 
                     Print(BT2StpLoss1+" SELL LIMIT  ---> "+BT2TkProf1);
                  }

i think , i have compose ordersend  in good mode  anyone  can confirm ? thanks   , i tryed  to use normilizedouble  5  in price  but  i have the same  effect

Documentation on MQL5: Trade Functions / OrderSend
Documentation on MQL5: Trade Functions / OrderSend
  • www.mql5.com
OrderSend - Trade Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 

Hi

entry price of Sell limit must higher Ask + MarketInfo(_Symbol,MODE_STOPLEVEL)

 
faustf:

Hi guys  i have  a  big long  script , in practical this  script  create a edit box  in chart  i insert a  price inside at  this edit box  and after i press button  it should  send  a sell limit  but  return me  error  invalid price 1.05414460 for OrderSend function,  Obviously the price when i  push button is 1.05333  less than my value , i  send  my part of  code  if  anyone  can look  if  exist some  error , is welcome  , thanks

i think , i have compose ordersend  in good mode  anyone  can confirm ? thanks   , i tryed  to use normilizedouble  5  in price  but  i have the same  effect

Try this 

OrderSend(Symbol(), OP_SELLLIMIT, StringToDouble(BT2Lotto), NormalizeDouble(StringToDouble(BT2PriceInsert_2),_Digits), 3, 0, 0,  Magik+"_OCO_Sell2LMT", Magik, clrNONE, clrNONE);
 
Lorentzos Roussos #:
OrderSend(Symbol(), OP_SELLLIMIT, StringToDouble(BT2Lotto), NormalizeDouble(StringToDouble(BT2PriceInsert_2),_Digits), 3, 0, 0,  Magik+"_OCO_Sell2LMT", Magik, clrNONE, clrNONE);

2023.10.13 13:42:09.119    OCO_EA EURUSD,M1: orderSendReliable(): Permanent Error: 130 invalid stops. giving up.

Trinh Dat #:

Hi

entry price of Sell limit must higher Ask + MarketInfo(_Symbol,MODE_STOPLEVEL)

yea  i just try also with ask and  also (BT2PriceInsert_1 > MarketInfo(Symbol(), MODE_BID))  and  also (BT2PriceInsert_1 > MarketInfo(Symbol(), MODE_ASK))  in this mode  but not  work , not  work  


 
faustf #:

2023.10.13 13:42:09.119    OCO_EA EURUSD,M1: orderSendReliable(): Permanent Error: 130 invalid stops. giving up.

yea  i just try also with ask and  also (BT2PriceInsert_1 > MarketInfo(Symbol(), MODE_BID))  and  also (BT2PriceInsert_1 > MarketInfo(Symbol(), MODE_ASK))  in this mode  but not  work , not  work  


You sent 0,0 sl,tp and it says invalid stops ? 

What is the MarketInfo(_Symbol,MODE_STOPLEVEL) ? 

Is the price distance less than the figure above ? 

Also increase the slippage 

 
Lorentzos Roussos #:
MarketInfo(_Symbol,MODE_STOPLEVEL)

retrun 0

 
faustf #:

retrun 0

and SymbolInfoInteger(_Symbol,SYMBOL_TRADE_STOPS_LEVEL) ?

also the price must be above ask for a Sell Limit

 
Lorentzos Roussos #:

and SymbolInfoInteger(_Symbol,SYMBOL_TRADE_STOPS_LEVEL) ?

also the price must be above ask for a Sell Limit

i  donwt  know  where  is  a fu.....  problem   return now  this  2 invalid price 1.05297220 for OrderSend function  but  the price  is  ask and bid  is 1.05109
    but  nothing

Reason: