Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1240

 

Good afternoon.

I have a strange problem.

MT4 terminal. There are about 15 indicators on each chart (standard and self-written). In some cases if I try to remove an indicator through indicator list (Ctrl + i) - the terminal hangs. At the same time, if you try to remove the same indicator by pressing the right mouse button on the line or arrow drawn by the indicator through the buffer and selecting "Remove Indicator" menu item - it is removed instantly and without problems. The most annoying is that the problem is floating: sometimes one indicator hangs on deletion, sometimes another one.... the same indicator hangs the terminal, sometimes it does not.

In this regard, I have 2 questions:

1) what can be connected with terminal hangs when deleting an indicator via indicator list?

2) what is the difference between the two methods of deleting indicators I described above?

 
satorifx:

I have a strange problem

Try running the seven indicators together first, if there are no problems, then the remaining 8 separately. If there are problems, split them in half again. This will find a culprit or two. If nothing is found, remove one at a time from 15. The black box method of trial and error will work if you have the skill and patience.
 
The MT5 event handler, CHARTEVENT_CUSTOM OnChartEvent () knows that it handles multiple threads.

Can you create thread-safe logic inside the OnChartEvent () handler?

Can you write thread-oriented code in MQL5 at all?
 
Please advise! If I call a custom indicator via iCustom in an Expert Advisor, how can I make the input parameters of this indicator be displayed in the Expert Advisor? I have the indicator source code. Is it even complicated?
 
Sayberix:
Please advise! If I call a custom indicator through iCustom in an Expert Advisor, how can I make it to display its input parameters in the Expert Advisor? I have the indicator source code. Is it even difficult?

Write in the order of enumeration of properties as in the indicator

doubleiCustom(
stringsymbol,// symbol name
inttimeframe,// timeframe
stringname,// indicator folder/user_name
... // list of the indicator input parameters
intmode,// data source
intshift// shift
);


Open "Input parameters" in the indicator and copy them in turn with the required values

Be sure to look at the type of the variable, and if it is a string, put it in quotes, we can't skip anything:

double val=iCustom(NULL,0,"SampleInd","",240,3,"",clrNONE,clrNONE,1,0);
 
Good afternoon, why do these artefacts occur? Shouldn't the emergency close code close at the first crossing? No closing errors have occurred.
if(MathAbs(Ima-Ima2) <= c && OrdersTotal() != 0)
        {
         OrderSelect(ticket, SELECT_BY_TICKET);
         int a = OrderType();
         RefreshRates();
         if(a == 0)
           {
            OrderClose(ticket, lots, Bid, 20, clrBlack);
           }
         if(a == 1)
           {
            OrderClose(ticket, lots, Ask, 20, clrBlack);
           }
         ticket = 0;
}
Files:
test.png  22 kb
 
Will RefreshRates work here?

In the function OrderSend we have a cena, but the cena was set before the cycle.


double cena=Ask;

for (int i=0; i<=10; i++)
   {
   RefreshRates();
   int t=OrderSend(OrderSymbol(),OP_BUY,0.1,cena,10,0,0); 
   if (t!=-1) break;
   }
 
igrok333:
Will RefreshRates work here?

In the function OrderSend we have a cena, but the cena was set before the cycle.


will not

 
Igor Makanu:

will not

he took the price before when the asc was still old,
and then only refreshrates changed the asc, right?
 
You guessed it. The cena variable is independent of RefreshRates.
Reason: