I'm trying to have an order removed at the end of the day (or end of the daily candle) when conditions are not met.
Below is my code to add the order. I tried using "ORDER_TIME_DAY " and "ORDER_TIME_SPECIFIED_DAY " to have the order out by the end of the day without success.
Can anyone help ?
Thank you
if(Buy_Condition_1 && Buy_Condition_2 && Buy_Condition_3)
{
ZeroMemory(mrequest);
mrequest.action=TRADE_ACTION_PENDING; // pending order
mrequest.price = NormalizeDouble(mrate[previous].high,_Digits); // latest Bid price
mrequest.sl = NormalizeDouble(mrate[previous].low, _Digits); // Stop loss
mrequest.tp = NormalizeDouble(latest_price.bid + TKP*_Point,_Digits); // Take Profit
mrequest.symbol = _Symbol; // currency pair
mrequest.volume = Lot; // number of lots to trade
mrequest.magic = EA_Magic; // Order Magic Number
mrequest.type= ORDER_TYPE_BUY_STOP; // Sell Order
mrequest.type_filling = ORDER_FILLING_IOC; // Order execution type//mrequest.type_time= ORDER_TIME_DAY; // Good till current trade day order;
mrequest.type_time = ORDER_TIME_SPECIFIED_DAY; // Good till specific day
mrequest.stoplimit=NormalizeDouble(mrate[previous].high,_Digits); // Stop LimitTimeToStruct(mrate[current].time, mdate);
mdate.hour = 23;
mdate.min = 59;
mdate.sec = 59;
mrequest.expiration = StructToTime(mdate); // Specific day
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Hi All,
I'm trying to have an order removed at the end of the day (or end of the daily candle) when conditions are not met.
Below is my code to add the order. I tried using "ORDER_TIME_DAY " and "ORDER_TIME_SPECIFIED_DAY " to have the order out by the end of the day without success.
Can anyone help ?
Thank you