
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I have a pending order and when it is executed and closed
I want to open a pending order at the exact same price as the previous closed order .. please what function I use to execute the order (MQL5)
thank you so much ..
Hi, Vladimir
I have a pending order and when it is executed and closed
I want to open a pending order at the exact same price as the previous closed order .. please what function I use to execute the order (MQL5)
thank you so much ..
An order can only be pending. Therefore, the order cannot be closed - the order can only be deleted.
As I understand it: you are placing a pending order (its price is Price # 1). Then it works -> a position appears. Then the position is closed and you want to place a pending order again at the price Price # 1? Did I understand you correctly?
Yes .. after activating the order and closing it on take profit
In this case, you need to work in steps. Step one: catch the moment of closing the transaction.
Transactions can be (by type of entry / exit): ENUM_DEAL_ENTRY
ENUM_DEAL_ENTRY
Identifier
Description
DEAL_ENTRY_IN
Entry in
DEAL_ENTRY_OUT
Entry out
DEAL_ENTRY_INOUT
Reverse
DEAL_ENTRY_OUT_BY
Close a position by an opposite one
We need to catch the deal DEAL_ENTRY_OUT - make it easy in OnTradeTransaction. Procedure: catches the transaction TRADE_TRANSACTION_DEAL_ADD (adding a deal to history ) and see that it is a deal with type DEAL_ENTRY_OUT
Code example:
Please practice starting this advisor.
OK..
Step 1 # Open and execute a pending order at price# 1
Step 2 #: Close the position at price# 2 (m_deal.Price ())
Step 3 # Open a new pending order at a price #1
Please help me in a step#3
thank you very much.. best wishes
OK..
Step 1 # Open and execute a pending order at price# 1
Step 2 #: Close the position at price# 2 (m_deal.Price ())
Step 3 # Open a new pending order at a price #1
Please help me in a step#3
thank you very much.. best wishes
Yes, of course I will help.
You just say: Have you figured out how the code works in # 54 ? Do you understand how to catch a deal closing?
Good day, Mr. Vladimir
The code #54 gives us the transaction information that was closed
But m_deal.Price () == the deal's closing price
Where can I find the deal opening price?
Best regards
Good day, Mr. Vladimir
The code #54 gives us the transaction information that was closed
But m_deal.Price () == the deal's closing price
Where can I find the deal opening price ?
Best regards
When a pending order is triggered, a deal of the type 'DEAL_ENTRY_IN' appears.
We’ll slightly change the OnTradeTransaction procedure, now we can catch two deals: enter the market (DEAL_ENTRY_IN) and exit the market (DEAL_ENTRY_OUT).
Thank you very much for helping me
This is only one way - catching online transactions.
And there is at least a way to work with trading history. You can determine what led to the 'OUT' deal - Stop Loss triggering or Take Profit triggering ...
But at this stage, I think you just need to use the idea from # 58