[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 478

 

Hello.

Can you please help me put in a dll -ku expression, like:

datetime FT = TimeCurrent();
int      reb=12;

Thank you in advance.

 
nemo811:

Hello.

Can you please help me put in a dll -ku expression, like:

Thank you in advance.

Withdrawn, I've got it.
 

Hello!

Has anyone had such a problem in MQL5? Sometimes (in about one instance out of a hundred) my EA cannot delete a pending order until I manually delete all the pending orders myself. In this case no errors are simply deleted. Or maybe someone else removes them? If anyone is willing to help, if needed I will send you login and password and account number with "caught orders". Thank you in advance.

void OnTick()
{
MqlTradeRequest request;
MqlTradeResult result;
MqlTradeCheckResult checkResult;
//------ delete order ------
request.action=TRADE_ACTION_REMOVE;
//request.order=OrderGetTicket(0);
request.order=8273050; // explicitly specify not to delete everything
if(OrderCheck(request,checkResult))
{
Alert(request.order);
Alert(request.action);
OrderSend(request,result);
}
else
{
Alert("Error: ",checkResult.retcode);
}
}

 
Andreyu:

Hello!

Has anyone had such a problem in MQL5? Sometimes (in about one case out of a hundred) the EA cannot delete a pending order until I manually delete all the pending orders myself. In this case no errors are simply deleted. Or maybe someone else removes them? If anyone is willing to help, if needed I will send you login and password and account number with "caught orders". Thanks in advance.

You've got the wrong forum.
 
Reshetov:
Your main problem is that iBars loads not prices, but the number of known bars for a given period. And, as I just checked, it does it quite correctly both in the tester and on the chart.

does not download, but returns the ones already downloaded.

I'm afraid you didn't read my question carefully or I misunderstood.

Can you give me the code that you used to check your statement?

 
palladin:

Anyway, here's the question,

I have a multi-period indicator.

In order to optimize the calculations, I use the following loop



// TimeFrames[i] массив с периодами

for (i=0; i<NumTimeFrames; i++)

{
if (total_bars[i] != iBars(instrument, TimeFrames[i]) )
{

// тут вычисления индиктора

total_bars[i] = iBars(instrument, TimeFrames[i]);
}

}



The main problem is that iBars does not load prices of periods other than the current one...

all MQL tricks like IndicatorCounted and RefreshRates

only work for the current period, i.e. iBars takes from the history and the history is only loaded by changing the period on the chart. What to do? Does MQL have some tool for loading bars of other periods (different from the current one) in the background?


p.s. hope I'm not rambling ((

How do you answer without knowing that NumTimeFrames TimeFrames[i] are empty or what?

Write more completely, how, or rather what to read if there is nothing. Give full code, otherwise you will most likely "gnaw the granite of science",,,,)) if(true)continue; else return("Sleep("+7*1000*60*60+")");

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int TimeFrames[]={0,1,5,15,30,60}; 
int NumTimeFrames=ArraySize(TimeFrames);
int total_bars[]; ArrayResize(total_bars,NumTimeFrames);
string instrument="EURUSD";
for(i=0; i<NumTimeFrames; i++)
  {
   if(total_bars[i]!=iBars(instrument,TimeFrames[i]))
     {
       total_bars[i]=iBars(instrument,TimeFrames[i]);
     }
  }
 
Hi, the problem is the following example at 00.00 GMT put the pending orders and at 10.00 gmt for example need to remove these orders if they have not opened. or if one opened, it should be left and the rest removed? the question is how to know if the order triggered or not?
 
Can you tell me if there is any way to make OrdersHistoryTotal() equal to zero? Is it necessary to reinstall MT4? Because if I just open a new chart, it does not help
 
CLAIN:
Can you tell me if there is any way to make OrdersHistoryTotal() equal to zero? Is it necessary to reinstall MT4? Because if I just open a new chart, it does not help

To do this you have to open a new account
 
frixer:
Hello, the problem is the following example at 00.00 GMT pending orders are placed and at 10.00 gmt for example these orders should be removed if they have not opened. Or if one has opened, it should be left and the rest should be removed? The question is how do I know if the order has worked or not?

You place a pending order, remember the ticket. If there is no pending order, but there is a market order of the type into which the pending order is converted and their tickets match, then the pending order has triggered.

For example: you place a BuyStop position. The function returns the ticket of the set order - you save it to a variable or an array.

Suppose, it has ticket 1.

You check if there is a pending BuyStop order. If it is not found, then you check whether there is a Buy position. If so, compare the noted ticket with the Buy position. If they coincide, it means that the pending BuyStop is transformed to market Buy.

Reason: