How do I retrieve data from an indicator? - page 3

 
Retabs:

Explain what I understand correctly and what I don't.

double val=iCustom(NULL,0,"RegressionPolynomial",13,1,0);

...
You have to pass all parameters to the indicator, not only the first one. And they must be passed in the same sequence as in the indicator.
 
Retabs:

Explain what I understand correctly and what I don't.

double val=iCustom(NULL,0,"RegressionPolynomial",13,1,0);

double - so the variable val will be a real number containing a fractional part.

val - the variable we named val

= - assign values to the variable val

iCustom - Call the function which will assign a numeric value to the variable

( - marker spec ifying theiCustom function parameters

NULL - iCustom function will calculatethe variable val from the current currency pair

0 - iCustom function will calculate the variable val from thecurrentchart period

"RegressionPolinomynal" - the name of the indicator from which iCustomfunction will calculate the variable val

13 - input parameter(the numeric value of the first parameter that is displayed in the indicator properties window)

1 - Not clear :( (they write the index of the indicator line)

0 - Not clear :( (they write the index of the value received from the indicator buffer)

) - marker that parameters of the iCustom function will be listed up to here

; - end of the code fragment responsible for assigning the value to the variable val

Use the "scientific method". I should add that 13 - this is from the indicator properties window, and if there are a lot of these parameters (in the code of the indicator extern), you can pass them, separated by commas, from the Expert Advisor, which will calculate these parameters. You can not pass them at all. You can pass some of them the same way, and calculate some of them. This is an owner's business. The line indicator index can be viewed in arrays that are assigned to the indicator (in the code), or it can be calculated in the data window, starting from zero (I wrote above). The resulting index is to indent to the left the necessary number of ticks, if the current value is not needed, or perform some operations with indicator data in the Expert Advisor (past and current ones or something else). Well, the rest, except for val, seems to be true.
 
evillive:
You must pass all parameters to the indicator, not only the first one, you must have 6. You must pass them in the same sequence as in the indicator.

Thank you. 6 Parameters. The final form of the code line takes the form double val=iCustom(NULL,0,"RegressionPolynomial",13,10000,55,5,2,0,1,0);

You have to pass ALL parameters to the indicator...

What indicator? I understand that I take the parameters (External, Extern) from the RegressionPolynomial indicator , and pass them to iCostum function for calculating the variable val

 
Retabs:

Thank you. 6 Parameters. The final form of the code line takes the form double val=iCustom(NULL,0,"RegressionPolynomial",13,10000,55,5,2,0,1,0);

You have to pass ALL parameters to the indicator...

What indicator? I understand that I take the parameters (External, Extern) from the RegressionPolynomial indicator , and pass them to iCostum function for calculating the variable val

Create a script that displays the value of val.

You will understand the meaning of the iCustom function by the fitting method.

P./S.: If you don't understand something, type iCustom into the search box on the website and look up the codes.


 
_new-rena:
Use the method of "scientific gut feeling". I will add that 13 is from the indicator properties window, and if there are a lot of parameters (in the code of the indicator extern), they can be passed through a comma from the Expert Advisor that calculates these parameters. You can not pass them at all. You can pass some of them the same way, and calculate some of them. This is an owner's business. The line indicator index can be viewed in arrays that are assigned to the indicator (in the code), or it can be calculated in the data window, starting from zero (I wrote above). The index of the resulting value - is to indent to the right the necessary number of ticks, if the current value is not needed, or perform some operations with the indicator data in the Expert Advisor (past and current, or something else). Well, the rest, except for val, seems to be true.


1. Thank you. Yes! I am using "scientific fieldwork" method in coding EA. But I get so much satisfaction from this process of learning ! Which I never even dreamed of when working with the help.

2. ...you can pass in a comma from the EA that calculates these parameters... - from which EA, if it's just in the process of creation?

3. ...starting from zero (written above)... "1 is the number in order in the window I asked you to open (you call "row of numbers"). In this case - 1 is 2nd from top to bottom" - yes. only read it while I was writing another post, you had time to reply, so it came out late. Thanks. I make sure I read ALL of them. But still don't understand what exactly it is " Indicator Line Index"

 
Retabs:


But I still don't understand what exactly it is "Indicator line index"

Put a screenshot of the data window. Let's look at an example.
 
Retabs:

Thank you. 6 Parameters. The final form of the code line takes the form double val=iCustom(NULL,0,"RegressionPolynomial",13,10000,55,5,2,0,1,0);

You have to pass ALL parameters to the indicator...

What indicator? I understand that I take parameters (External, Extern) from the RegressionPolynomial indicator and pass them to iCostum function for calculating of the val variable

Ok, I'll give you an example:
//В индикатор передаются параметры, инача называемые "внешние переменные":
//Вот эти параметры в коде индикатора:

extern int history = 10000; //1
extern int period  = 55;    //2
extern int signal  = 5;     //3
extern int degree  = 2;     //4
extern int price   = 0;     //5
extern bool drowArrow=true; //6

//В скрипте или советнике в котором наша iCustom никто не мешает такие же точно переменные завести, те же 6 строк вышеуказанных, а потом вызывая иКустом, просто вписывать их туда:

double Line=iCustom(NULL,0,"RegressionPolynomial", history , period , signal , degree , price , drowArrow , 0/*это первый буфер индикатора*/, 0);
double Signal=iCustom(NULL,0,"RegressionPolynomial", history , period , signal ,degree ,price , drowArrow , 1/*это второй буфер индикатора*/, 0);

//ЧТО ТУТ СЛОЖНО ПОНЯТЬ???
 
не обязательно передавать все параметры можно без параметров
 

Vladon:

it is not necessary to pass all parameters you can do it without parameters


Yes, you can. But if you want to pick up parameters in optimizer, you have to. And you will want to, I know it by my own experience)))
 

Read and reread all the previous posts. Got a lot of insights. Thanks to ALL for the help and encouragement in learning MQL4 through your helpful replies. At this stage it's just a matter of figuring out if I've got it right. I will try to explain how I see it, and ask for correction/completeness where I'm wrong. So, what I have understood for myself:

1. The "RegressionPolynomial" indicatordraws 2 lines. It means that it has 2 buffers. In them new values are written with every tick. The previous values are written into the archive.

2. Using the iCostum function we can assign these values to our variables.

To make the function work it needs to specify the Parameters which will be used as the basis for its operation. Namely:

3a. Which currency pair we are going to operate with. (NULL-with the current one)

3b. From which chart period to operate. ( 0-current)

3c. Name of the indicator which to operate with. (in my case, RegressionPolynomial)

3d. Values of all input parameters of the indicator in the queue they are displayed in the properties window of the indicator.(in my

in my case ,55,5,2,0).

3e. Indicator line index (serial number of indicator line in the data window) - index of line to operate with. (in my case if the first line then 1,

if the second line then 2)

3f. Index ofthe value from the indicator buffer(serial number of buffer values) to operate with.

(0 from current buffer value, 1 from previous buffer value etc. )

4. After execution of the iCostum function, the preset variable is assigned a numeric value, which equals the size of the price at the moment

specified moment.

5. The signal of crossing of lines of the indicator is calculated only by mathematical formulas, because the indicator itself cannot explicitly

indicate this moment explicitly.