How to know if the stop price has been reached in StopLimit Orders

 

I believe a StopLimit order has 2 components

  • Stop price and
  • Limit price

I want to know if the stop price has been reached or not.

If it has, what elements of the orders has changed. E.g.

  • Can the StopLimit be modified and how? As this is not a limit order should I update the price? When accessing the order properties what change from before?
  • Can the TP be changes?
  • Can the SL be changed?
  • Are there restriction on what and when changes or cancellation of the order can be done?
Also what are the restrictions on StopLimit orders due to:
  • Stop Level restrictions
  • Freeze Level restrictions

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
 
Suminda Dharmasena:

I believe a StopLimit order has 2 components

  • Stop price and
  • Limit price

I want to know if the stop price has been reached or not.

If it has, what elements of the orders has changed. E.g.

  • Can the StopLimit be modified and how? As this is not a limit order should I update the price? When accessing the order properties what change from before?
  • Can the TP be changes?
  • Can the SL be changed?
  • Are there restriction on what and when changes or cancellation of the order can be done?
Also what are the restrictions on StopLimit orders due to:
  • Stop Level restrictions
  • Freeze Level restrictions

Do you know this: https://www.metatrader5.com/en/mobile-trading/iphone/help/trade/general_concept/order_types?

A Buy-Stop-Limit-Order becomes a Buy-Limit-Order if the higher price is reached.

You can change any (pending) order as long it hasen't become a position.

Check the way you manage all that by OrderSend().

Types of Orders - Trading Principles - MetaTrader 5 iPhone/iPad Help
Types of Orders - Trading Principles - MetaTrader 5 iPhone/iPad Help
  • www.metatrader5.com
The MetaTrader 5 mobile platform allows users to prepare and issue requests for the broker to execute trading operations. In addition, the platform...
 
Carl Schreiber #:

Do you know this: https://www.metatrader5.com/en/mobile-trading/iphone/help/trade/general_concept/order_types?

A Buy-Stop-Limit-Order becomes a Buy-Limit-Order if the higher price is reached.

You can change any (pending) order as long it hasen't become a position.

Check the way you manage all that by OrderSend().

Many thanks for the reply.

If I am to understand correctly if I call something like the following after the Open Price has been reached:

OrderSelect(ticket);
const ENUM_ORDER_TYPE WhatIsTheTypeNow = (ENUM_ORDER_TYPE)OrderGetInteger(ORDER_TYPE);
double IsThisTheOriginalStopLimit = OrderGetDouble(ORDER_PRICE_OPEN);
double IsItZeroNow = OrderGetDouble(ORDER_PRICE_STOPLIMIT);

On a StopLimit order once the initial Open Price has been reached, then:

  • Order type above will change to ORDER_TYPE_*_LIMIT
  • Open price will change to the original StopLimit price and
  • Stop limit price will become zero?
Or will the resulting limit order be a new order? If so how can the can the original or resulting order be found given one of the tickets?
 
I am interested in this as well.

Deals, orders and positions are matched by POSITION_ID. This is unique as far as I know.

Can you please share your findings?

Regards
 

What's the purpose of this topic ? Laziness ?

Just try it and you will get your answers. Eventually reading the documentation could also be useful.

 
Yes, laziness. . .
 
Alain Verleyen #:

What's the purpose of this topic ? Laziness ?

Just try it and you will get your answers. Eventually reading the documentation could also be useful.

Want to know how are the finer points on how each type of order is officially handled in MT/MQL especially StopLimits as documentation on them is very sparse.

When you try out something and figure it out this may rely on something undocumented. Also there is a risk of drawing wrong conclusion with what is observed by tinkering.  If there is a bug in the system then the conclusion from tinkering would be wrong.

Anyway anything to do what Market Micro structure and now orders are handled in the system should be better documented.

 
What I don’t understand is why anybody will create an Expert Advisor to issue pending orders… why not make it wait for the right price to issue a market order… 🙄… what is the idea of this? If have seen many threads asking different things about EA’s issuing pending orders… 
 
As far as I can tell, the difference in pending orders to market orders is the execution.

Pending orders will be executed by the broker. So you remove a whole bunch of possible interference.

A few I can think of are missed tick calls in your EA. Latency of the internet connection. Interruption of the connection. Your computer to fail in a critical moment. Execution times of your EA.

All these are legitimate reasons to use pending orders.

A pending order will be checked on every tick happening on the brokers server at the moment the tick "happens".

Edit:
Also, you can use the pending orders as a type of state storage for your EA, making it more stateless and therefore more independent of restarts. You can pick up the state from the pending orders from your broker. This way you do not need to save any state locally on the computer, making your EA unbound from the execution environment.
 

A already mentioned a pending order becomes a market order if the 'pending price' is touched. That means if the prices are jumping due to news this can happen:

  1. price at 1000.
  2. pending buy (or the stop of a sell) at 1200.
  3. NEWS  !!!
  4. Price jumps to 3000.
  5. The buy-trader sees now a buy position at 3000 (and a high risk that this exaggerated price starts falling) and the sell-trader was stopped out at 3000 suffering quite a heavy loss.
 
Can this be countered with the deviation value given to an order?

Isnt it so that if this value is given, the order will not execute if the tick is outside this "zone"?

I thought that's what it is for.