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
At Alpari you cannot place stops immediately during market execution, you have to open a position first and then modify it
Метатестер пилит диск HDD
Version 527.
If you look in the process monitor it goes on and on with this nonsense.
No network activity, not connected to the cloud. Terminal and metatester are not running. No files are being changed.
There is no information about file names in the above screenshot.
Please attach a more detailed log in text form.
In MQL4 you could create an order with stops right away, but in MQL5 it is not possible - you have to set stops after the order creation.
Am I slow (please give me a code sample) or is this my intention?
You can also create an order with a stop and a profit.
You have in your request
reqest.sl=SL;
reqest.tp=TP;
This is an error. The SL and TP levels should be set at a distance from the market prices, so these lines should look something like this
for a buy position:
request.sl = SymbolInfoDouble(Symbol(),SYMBOL_BID) - SL * SymbolInfoDouble(Symbol(),SYMBOL_POINT);
request.tp = SymbolInfoDouble(Symbol(),SYMBOL_ASK) + TP * SymbolInfoDouble(Symbol(),SYMBOL_POINT);
reverse for a Sell position
request.sl = SymbolInfoDouble(Symbol(),SYMBOL_ASK) + SL * SymbolInfoDouble(Symbol(),SYMBOL_POINT);
request.tp = SymbolInfoDouble(Symbol(),SYMBOL_BID) - TP * SymbolInfoDouble(Symbol(),SYMBOL_POINT);
I hope I'm not mistaken anywhere...Please clarify: in Alpari, is it impossible to place an order with stops with a single OrderSend command? Or do we mean that before setting stops for an existing order, we need to call PositionSelect?
You can, why not?
In which mode do you place the order?
You can do it with a stop and a profit.
You have in your query
reqest.sl=SL;
reqest.tp=TP;
This is an error. The SL and TP levels should be set at a distance from market prices, so these lines should look like this:
Of course SL and TP are defined like yours. Moreover, I wrote above that if I just add
m_request.action = TRADE_ACTION_SLTP;
OrderSend(m_request, m_result);
then the stops will be set successfully at specified SL and TP, which will not happen if they are not defined correctly.
You can, why not?
In which mode do you place the order?
MqlTradeResult m_result;
m_request.action = TRADE_ACTION_DEAL;
m_request.symbol = Symbol();
m_request.type = ORDER_TYPE_BUY;
m_request.price = Price; // calculated in advance and true :)
m_request.sl = SL; // already calculated and correct :)
m_request.tp = TP; // calculated in advance and true :)
m_request.volume = Vol;
m_request.type_filling = ORDER_FILLING_FOK;
m_request.deviation = 10;
m_request.type_time = 0;
m_request.expiration = 0;
m_request.magic = 0;
m_request.comment = "";
OrderSend(m_request, m_result);
Please clarify: in Alpari, you cannot place an order with stops using a single OrderSend command? Or is it about calling PositionSelect before setting stops for an existing order?
Exactly right. with stops you can only do it in instant mode
Execution types
The client terminal has four modes of order execution:
In this mode, the execution of a market order is carried out at the price offered to the broker. When sending an execution request, the terminal automatically substitutes the current price for the order. In case the broker accepts the prices, the order will be executed. If the broker does not accept the requested price, then the so-called "Requote" occurs - the broker returns the prices at which the order can be executed.
In this mode, the market order is executed at the price previously received from the broker. Before sending a market order, the execution prices are requested from the broker. Once received, the execution of the order at that price can be either confirmed or rejected.
In this mode of market order execution, the decision on the execution price is made by the broker without any additional approval of the trader. Sending a market order in this mode implies an early agreement with the price at which it will be executed.
When you press the "Sell by Market" or "Buy by Market" button, an order will be created for the broker to execute a Sell or Buy deal, respectively, at the price defined by the broker.
In this mode trade operations performed in the client terminal are transferred to an external trading system (exchange). Trade operations are executed at the prices of current market bids.
The execution mode for each symbol is selected by your brokerage company.
Everything is written in the terminal help. But no one reads it.
To find out which execution type you need to request the property with the function SymbolInfoInteger() with the identifier SYMBOL_TRADE_EXEMODE
SYMBOL_TRADE_EXEMODE
Trade mode
ENUM_SYMBOL_TRADE_EXECUTION
ENUM_SYMBOL_TRADE_EXECUTION
Identifier
Description
SYMBOL_TRADE_EXECUTION_REQUEST
Trade on request
SYMBOL_TRADE_EXECUTION_INSTANT
Trade at streaming prices
SYMBOL_TRADE_EXECUTION_MARKET
Execution_execution_market
SYMBOL_TRADE_EXECUTION_EXCHANGE
Exchange execution
Thank you very much, now I understand.
And I read the help, what I didn't find was my oversight + lack of elaboration of cross-references or something like that in the help:)
When testing the Surgeon's Adviser https://www.mql5.com/ru/code/611
with a modified
[quote].
To start testing, in line 84 replace:
double Limit=SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_LIMIT);
with
double Limit= 5;
[/quote]
On a normal demo account, when the Trade tab in the Tools section is active, the terminal view changes at the end of the test.
On a demo account, this is the mess:
It keeps resetting to the beginning.
And on XAUUSD, you press F9 and then
although you can't double-click the order window in "market overview".
P.S. I know you can't trade XAUUSD).