Questions from Beginners MQL5 MT5 MetaTrader 5 - page 164
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Gentlemen, please tell me what to write in the last two lines when modifying a pending order if its lifetime is set. (e.g. 6 hours - ).
request.type_time = ORDER_TIME_SPECIFIED; // the order will be valid until the expiry date
request.expiration = TimeCurrent()+6*3600;// last known server time + count*hours
If the lifetime doesn't change, can we not write anything at all when modifying? By default it will die by itself.
And if you need to change its lifetime?
Modify Pending Order
Trade request to modify pending order price levels. 7 fields are required:
-action
-order
-price
-sl
-tp
-type_time
-expiration
These are the two lines in the Handbook that I can't get into:
type_time
Type of order at expiration time. Value can be one of the values ENUM_ORDER_TYPE_TIME
expiration
Expirationtime of the pending order (for orders of the ORDER_TIME_SPECIFIEDtype )
You can omit these two lines altogether.
You can write one, for example: request.type_time = ORDER_TIME_DAY; in this case the order will be deleted after 1 day,
other options: https://www.mql5.com/ru/docs/constants/tradingconstants/orderproperties#enum_order_type_time
Stringrequest.expiration = TimeCurrent()+6*3600;//last known server time + number of hours*hours
you specify the expiry time of the order.
https://www.mql5.com/ru/articles/481
Help for a newbie, please.
I have installed Alpari MT5, the optimization is working as it should be, i.e. all the charts are drawing and reports are being generated, and the history is fine. After I have installed MT5 on the same PC with Insta, I have downloaded some test history there and now I have no charts and optimization results both in Insta and Alpari. After I have dismounted everything and only Alpari has been installed, optimization works perfectly again. However, after installing Insta on another computer in the local network, optimization results are again lost.
Same EA in all cases, log is flooded with best resalt messages, only local agents are being used.
Does anybody use two or more mt5 at the same time on one computer or on the local network, or maybe have faced such a problem?
These two lines may not be written at all.
You can write one, for example: request.type_time = ORDER_TIME_DAY; in this case the order will be deleted after 1 day,
I see. That's what I thought, when modifying.
request.type_time =ORDER_TIME_DAY - I think it is the same as -
input int t = 24;
request.expiration = TimeCurrent()+t*3600;
I see. That's what I thought, when modifying.
request.type_time =ORDER_TIME_DAY - I guess it is the same as -
input int t = 24;
request.expiration = TimeCurrent()+t*3600;
I gave you the linkhttps://www.mql5.com/ru/docs/constants/tradingconstants/orderproperties#enum_order_type_time that 4 variants can be used forrequest.type_time :
ORDER_TIME_GTC
The order will be in the queue until the
ORDER_TIME_DAY
Order will only be active during the current trading day
ORDER_TIME_SPECIFIED
Order will be valid until the expiry date
ORDER_TIME_SPECIFIED_DAY
The order will be in effect until 00:00 on the specified date. If that time does not fall on a trading session, the expiration will be at the nearest trading time.
And gave you the link to https://www.mql5.com/ru/articles/481 , which gives the code of the trade request when modifying an order using the ready-made CTrade class https://www.mql5.com/ru/docs/standardlibrary/tradeclasses/ctrade.
The code is this:
Read about time in MQL5 here:https://www.mql5.com/ru/articles/599 .
Use search and read articles and documentation.
Hello all!
Please don't throw stones, but I couldn't find any...
no positions open on the EA... It says this
2013.12.23 03:00:01 Core 1 2013.12.20 23:30:00 failed instant buy 1.00 EURUSD at 1.36720 sl: 1.06720 tp: 1.46720 [Invalid request]
и
2013.12.23 03:00:01 Core 1 2013.12.20 23:30:00 Alert: Request to place Buy order failed - error code:4756
What could it be?
mrequest.action = TRADE_ACTION_DEAL; // immediate execution
mrequest.price = NormalizeDouble(latest_price.ask,_Digits); // latest ask price
mrequest.sl = NormalizeDouble(latest_price.ask - STP*_Point,_Digits); // Stop Loss
mrequest.tp = NormalizeDouble(latest_price.ask + TKP*_Point,_Digits); // Take Profit
mrequest.symbol = _Symbol; // symbol
mrequest.volume = Lot; // number of lots to trade
mrequest.magic = EA_Magic; // Magic Number
mrequest.type = ORDER_TYPE_BUY; // buy order
mrequest.type_filling = ORDER_FILLING_FOK; // order type - all or nothing
mrequest.deviation=100; // slippage from the current price
//----send order
OrderSend(mrequest,mresult);
Armen, please. paste the code into the code frame. Ctrl+"5". Better yet, press the SRC button in the editor, paste into the box and press [ok].
It's not clear. :(
Armen, please. paste the code into the code frame. Ctrl+"5". Better yet, press the SRC button in the editor, paste into the box and press [ok].
It's not clear. :(
Hello all!
Please don't throw stones, but I couldn't find any...
no positions open on the EA... It gives this
2013.12.23 03:00:01 Core 1 2013.12.20 23:30:00 failed instant buy 1.00 EURUSD at 1.36720 sl: 1.06720 tp: 1.46720 [Invalid request]
и
2013.12.23 03:00:01 Core 1 2013.12.20 23:30:00 Alert: Request to place Buy order failed - error code:4756
What could it be?
mrequest.action = TRADE_ACTION_DEAL; // немедленное исполнение
mrequest.price = NormalizeDouble(latest_price.bid,_Digits); // последняя цена Bid
mrequest.sl = NormalizeDouble(latest_price.bid + STP*_Point,_Digits); // Stop Loss
mrequest.tp = NormalizeDouble(latest_price.bid - TKP*_Point,_Digits); // Take Profit
mrequest.symbol = _Symbol; // символ
mrequest.volume = Lot; // количество лотов для торговли
mrequest.magic = EA_Magic; // Magic Number
mrequest.type = ORDER_TYPE_SELL; // ордер на продажу
mrequest.type_filling = ORDER_FILLING_FOK; // тип исполнения ордера - все или ничего
mrequest.deviation=100; // проскальзывание от текущей цены
//--- отсылаем ордер
OrderSend(mrequest,mresult);
Hi all!
Please don't throw stones, but I couldn't find any...
no positions open on the EA... it gives this...
The problem is that I need to redo (a bit) the ready-made owl.