[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 23

 
TarasBY:

1th: your philosophy of changing the array size is defective from the very beginning, you can do with 10 cells to process indicator readings in 99 out of 100 cases;

2nd: to recalculate these readings on every tick is a whim of an uninformed brain.


Igor, either you start giving sensible advice on how to get out of the situation, or don't post at all.
 

Rough, but to the point) After experimenting, I realised that data on the number of points can be summed up in one cell. This is sufficient.

 
FAQ: Igor, either you start giving sensible advice on how to get out of the situation, or don't post at all.
I'll translate the point I was making into "sound advice" - the man is heading in a dead-end direction.
 

So point him in the right direction, not just stating the fact of deadlock.

This is a thread...

 
Fox_RM: Rough, but to the point) After experimenting, I realised that data on the number of points can be summed up in one cell. This is sufficient.
Without the slightest thought of offending or insulting.
 

It's OK! Helping people on this forum is invaluable! A month or two ago I didn't know how to work with arrays at all)

 
Fox_RM:

If the array is heterogeneous, you should probably convert all elements to string type and then search for the required one using

StringFinde(https://www.mql5.com/ru/forum/138609/page22#613148). Correct me if I'm wrong.


Thank you. I found the function.

I just don't understand how to use it correctly.

It returns only a place in string where the searched part starts, but not a part.

I need a part of a string.

 
Snegovik:


Thanks. I found the function.

I just haven't figured out how to use it correctly yet.

It only returns the place in the string where the searched part starts. but not the part.

I need a part of the string.

StringSubstr().
 
TarasBY:
StringSubstr ().


Just what I need.

Thank you very much.

 

Good evening, everyone!

The problem: I can't figure out how to use the function for finding the intersection point of two lines (I've tried Kim's function too, but the result is the same).

The point is that sometimes the crossover is detected in the wrong place.

Here's what happens:


The red horizontal line is the price level calculated by the function. The yellow one is a level that should be.

What is interesting, this bug does not always happen: often the intersection is defined as it should be...

Below I am pasting the code of the function.

//+----------------------------------------------------------------------------+
void Middle(string nm1,string nm2)
  {
  //double M;
  double x1, x2, x3, x4;
  double y1, y2, y3, y4;
  double k1, k3;
  
  if(ObjectFind(nm1)==0 && ObjectFind(nm2)==0)
    {
    y1=ObjectGet(nm1, OBJPROP_PRICE1);
    y2=ObjectGet(nm1, OBJPROP_PRICE2);
    x1=ObjectGet(nm1, OBJPROP_TIME1);
    x2=ObjectGet(nm1, OBJPROP_TIME2);
    
    y3=ObjectGet(nm2, OBJPROP_PRICE1);
    y4=ObjectGet(nm2, OBJPROP_PRICE2);
    x3=ObjectGet(nm2, OBJPROP_TIME1);
    x4=ObjectGet(nm2, OBJPROP_TIME2);
    
    k1=(y2-y1)/(x2-x1); 
    k3=(y4-y3)/(x4-x3);
    
    if(k1 != k3)
      {
      T = (y1 - y3 + k3*x3 - k1*x1)/(k3 - k1);
      M = y1 + k1*(T - x1);
      Tt = T;
      }
    }
  return(0);
  }
//+----------------------------------------------------------------------------+

The trailer contains an Expert Advisor for testing it.

Please advise what I am doing wrong!

Thank you very much in advance)

Files:
proba_per.mq4  11 kb
Reason: