Proper usage of CTrade OrderOpen method

 

Im confused by the parameters of the CTrade OrderOpen method. I'm not sure how to to skip the "limit_price" parameter and send a simple pending order (not the buy_stop_limit kind for example)

this is the way I'm sending a buy stop order and Im not sure If I'm doing it the right way. please do not offer alternative approaches since I know them. and yes I've already RTFM

m_trade.OrderOpen(_Symbol, ORDER_TYPE_BUY_STOP, 0.01, NULL, open_price, sl, tp, 0, 0, NULL);

as you can see I used NULL for the limit_price. could someone please clarify me on it's purpose and how to omit the input?

 

For all orders you need only one price m_request.price except for (https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties#enum_order_type):

ORDER_TYPE_BUY_STOP_LIMIT

Upon reaching the order price, a pending Buy Limit order is placed at the StopLimit price

ORDER_TYPE_SELL_STOP_LIMIT

Upon reaching the order price, a pending Sell Limit order is placed at the StopLimit price


and in bool CTrade::OrderOpen(..) you can find:

m_request.stoplimit   =limit_price;
Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Order Properties
Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Order Properties
  • www.mql5.com
Order Properties - Trade Constants - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Carl Schreiber #:

For all orders you need only one price m_request.price except for (https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties#enum_order_type):

ORDER_TYPE_BUY_STOP_LIMIT

Upon reaching the order price, a pending Buy Limit order is placed at the StopLimit price

ORDER_TYPE_SELL_STOP_LIMIT

Upon reaching the order price, a pending Sell Limit order is placed at the StopLimit price


and in bool CTrade::OrderOpen(..) you can find:

Thank you sir, so it makes no harm using NULL as the parameter I assume!? I've read over here and there about NULL being a bad guy, yet I was afraid to use 0 to skip just like what we do with SL and TP
 
Your topic has been moved to the section: Expert Advisors and Automated Trading
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893