Useful features from KimIV - page 64

 

The StringToArrayInt() function.

This function splits the string into its component integers, and each number is added to the array as a separate element. As many integers as there are in the string, the same number of elements will be added to the array. A comma is recognized as a separator. The StringToArrayDouble() function returns the number of array elements, and takes the following mandatory parameters:

  • st - Comma separated string of integer values.
  • ai - Integer array.
//+----------------------------------------------------------------------------+
//|  Автор    : Ким Игорь В. aka KimIV,  http://www.kimiv.ru                   |
//+----------------------------------------------------------------------------+
//|  Версия   : 01.09.2005                                                     |
//|  Описание : Перенос целочисленных значений из строки в массив              |
//+----------------------------------------------------------------------------+
//|  Параметры:                                                                |
//|    st - строка целочисленных значений через запятую                        |
//|    ai - целочисленный массив                                               |
//+----------------------------------------------------------------------------+
//|  Возврат:                                                                  |
//|    Количество элементов в массиве                                          |
//+----------------------------------------------------------------------------+
int StringToArrayInt(string st, int& ai[]) {
  int    i=0, np;
  string stp;

  ArrayResize( ai, 0);
  while (StringLen( st)>0) {
    np=StringFind( st, ",");
    if ( np<0) {
      stp= st;
      st="";
    } else {
      stp=StringSubstr( st, 0, np);
      st=StringSubstr( st, np+1);
    }
    i++;
    ArrayResize( ai, i);
    ai[ i-1]=StrToInteger( stp);
  }
  return(ArraySize( ai));
}

ZS. Attached is a script to test the StringToArrayInt() function.

 

Good day to all!

Can you advise a newbie, is there a function that would give the maximum price time of a bar? I've looked all over, I can't find it..... and I need it badly!

 
KimIV >> :

For you, Dima, I can offer a feature like this:

if (cci1<=+100 && cci0>+100) bs=+1;

>> Hail Igor.

please tell me why you put "+" ????

 

Igor, good afternoon!

Can you tell me if there is a script that would display a price line on the chart that looks like an analog of the line that can be selected in the chart properties by checking the box: "Show Ask line". What would it be possible to delete this line above or below the current price by a specified number of points in the settings?

 
satop писал(а) >>

Dear Igor

please tell me why you put "+" ????

If there was a "-" there too, it was for symmetry... or maybe I was just aligning lines by length... I like nice code... when everything's straight and true...

 
KimIV >> :

If there was also a "-" there, it was for symmetry... or maybe I was just aligning lines by length... I like nice code... I like to keep it straight...

Got it, thanks.

 

Igor,

could you please tell me

If you can, please, give me the function :

sign to convert a pending order to a market order

If it goes to Buy, it returns 1 and if it goes to Sell, it returns -1.


Thank you.

 

Igor, could you tell me if there is a script that would display a price line on the chart that looks like an analog of the line that can be selected in the chart properties by checking the box: "Show Ask line". What would it be possible to move this line above or below the current price by a specified number of points?

 
Odinochka >> :

Igor, could you tell me if there is a script that would display a price line on the chart that looks like an analog of the line that can be selected in the chart properties by checking the box: "Show Ask line". What would be the possibility in the settings to shift the line above or below the current price by the set amount of points?

https://www.mql5.com/ru/forum/113401
Files:
dcoxtqe_2.mq4  2 kb
 

Igor Thanks for the functions !!!

Is there by any chance a function for determining the loss of an open position..... or did I miss it

Reason: