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

 
Basicprof:

Why when I create an arrow.Create(0, "ArrowCheck",0,TimeCurrent(),1.14565) fromMQL5Standard Library the object is created and immediately deleted.

Most likely, you haven't disconnected(Detach()) the graphical object from the arrow object.
 

Hello all!

The task is to find an analogue of rates_total in an Expert Advisor.

Transferring an array from an indicator to an Expert Advisor. Numbering according to the bar number in the history 1 -> rates_total

ArraySetAsSeries(Lx_Indikator,false);

The problem: When the parameter - bars does not correspond to the array size in the indicator, the values get mixed up in the output.

 int bars=Bars(_Symbol,_Period);
 int copy=CopyBuffer(MA_handle,0,0,bars,Lx_Expert);

Although by logic, I need data starting fromLx_Expert[1], so then the copied array size doesn't matter, but it turns out it does.

2017.10.09 20:35:03.055 Indicator (EURUSD,M5) range = 14165
2017.10.09 20:35:04.303 Indicator (EURUSD,M5) LxIndikator[1] 1507552800.0
2017.10.09 20:35:04.303 Indicator (EURUSD,M5) LxIndikator[2] 1.173416294117647
2017.10.09 20:35:04.304 Indicator (EURUSD,M5) LxIndikator[3] 1.0
2017.10.09 20:35:04.304 Expert (EURUSD,M5) bars = 14000
2017.10.09 20:35:04.304 Expert (EURUSD,M5) LxExpert[1] 1.17194
2017.10.09 20:35:04.304 Expert (EURUSD,M5) LxExpert[2] 14152.0

2017.10.09 20:35:04.304 Expert (EURUSD,M5) LxExpert[3] 85.0



 
Top2n:

Problem: when the parameter - bars does not correspond to the size of the array in the indicator, the output is confused by the values.

Do you synchronise the number of bars between the indicator and the Expert Advisor?

 

Hi, could you tell me how to select the last order in the order loop?

for(int i=1; i<OrdersTotal(); i++)                                           // Цикл перебора ордер
   {
    if(OrderSelect(i,SELECT_BY_POS))                                           // Если есть следующий
     {

This is how you select the first one if there is a next one. How do I select the last order? If anyone knows, please write!

 
vikzip:

Hi, could you tell me how to select the last order in the order loop?

This is how you select the first one if there is a next one. How do I select the last order? If anyone knows, please write!


Try to go this way.

for(int i=OrdersTotal(); i>=1; i--)                                           // Цикл перебора ордер
   {
    if(OrderSelect(i,SELECT_BY_POS))                                           // Если есть следующий
     {

Doesn't the last one work that way?

if(OrderSelect(OrdersTotal(),SELECT_BY_POS))  
 
Aleksey Vyazmikin:

Try it this way

Doesn't the last one work like that?

At least advise correctly... You need OrdersTotal()-1.
 
Alexey Kozitsyn:
At least advise correctly... You need OrdersTotal()-1.

So I clarified whether it works that way or not ;)

I don't know exactly, for I have never dealt with warrants myself - I work with a class by order.

 
Aleksey Vyazmikin:

So I clarified whether it works that way or not ;)

I don't know exactly, as I haven't dealt with warrants myself - I work with a class by order.

For you and the person you wanted to help: it doesn't work that way. You will get an error.

And it's desirable to deal with it, because it's the basis of working with all arrays in mql.

 

Thank you for your help! So the right thing to do would be to write?

for(int i=OrdersTotal(); i>=1; i--)                                           // Цикл перебора ордер
   {
if(OrderSelect(OrdersTotal()-1,SELECT_BY_POS))                   //Выбор последнего??
   {    
 
vikzip:

Thank you for your help! So the right thing to do would be to write?

Find the code you need here

Только "Полезные функции от KimIV".
Только "Полезные функции от KimIV".
  • 2011.02.18
  • www.mql5.com
Все функции взяты из этой ветки - http://forum.mql4...
Reason: