Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 359

 
pako:


IndexMaMax = ArrayMaximum( ArrayMa,30,1) look for max 30 bars

IndexMaMin = ArrayMinimum( ArrayMa,30, 1) look for a minimum of 30 bars

ArrayMa[1] < ArrayMa[IndexMaMax] went down

ArrayMa[1] > ArrayMa[IndexMaMin] go up

oh-ho-ho, it couldn't be simpler ))) the min/max is the price ? at the line - segments, I take it, cool

so now the problem with the indexes, which index is needed ?

 
bergkamp.:

oh-ho-ho, it couldn't be simpler )))) min mah is the price ? at line - segments, i guess, cool

so now the problem with the indices, which one do i need ?


you have a segment of 10,or don't know how many bars, if the value is the same, i.e. a straight line, ma[1]=ma[2], once the condition is false, it goes up or down

ma[1]>ma[2] up

ma[1]<ma[2] down

 
If the robot works well in the tester, it does not mean it will work as well in the real world.
 
If the robot works well in the tester, it does not mean it will work as well in the real world.
 
artmedia70:
And here it should be made clear that GVs are terminal variables, not EA variables.


I think some of the owls had such a line, I sometimes go in to understand something, but I don't understand anything.
 
Good evening. Could you please tell me the code. With which. It would be possible to get a number (in currency). About last day's profits. Spas.
 
Zolotai:
Good evening. Could you please tell me the code. With which. It would be possible to get a number (in currency). About last day's profits. Thanks.
Easy!!!
 

I have a childish question. Variables are declared in the code header. They are supposed to be global. But I don't understand the difference

int i;

from

static int i;

if this variable is declared in the header. Ideally, by scope of the variable. But in both cases it is visible inside the function. I made a test (script):

int a = 10;
static int b = 10;
int start(){
   Alert(StringConcatenate("st: a = ", a, ", b = ", b));//st: a = 10, b = 10
   f1();
   Alert(StringConcatenate("f1: a = ", a, ", b = ", b));//f1: a = 11, b = 11
   f2(a, b);
   Alert(StringConcatenate("f2: a = ", a, ", b = ", b));//f2: a = 12, b = 12
   f3(a, b);
   Alert(StringConcatenate("f3: a = ", a, ", b = ", b));//f3: a = 12, b = 12
   return(0);
}
void f1(){a++; b++; return;}
void f2(int& a, int& b){a++; b++; return;}
void f3(int a, int b){a++; b++; return;}

- Didn't notice any differences. Can you explain their difference, because I don't understand it.

 
gyfto:

I have a childish question. Variables are declared in the code header. They're supposed to be global.

- I didn't notice any differences. Can you explain their difference, because I don't understand it.


Yes, that's right, more precisely according to the documentation.

static moves the variable to the global memory pool and the scope remains depending on where it's declared.

The place of declaration is the "code header", that's where the properties are transferred:

A variable declared outside of all functions is placed in the global scope. Such variables can be accessed from anywhere in the program. Such variables are placed in the global memory pool, so their lifetime is the same as the lifetime of the program.

Local variables can be declared with the static access specifier. In this case, the compiler stores such a variable in the global memory pool. Therefore, lifetime of a static variable coincides with the lifetime of the program. The scope of such a variable is limited by the limits of the block in which it is declared.

 
gyfto:

I have a childish question. Variables are declared in the code header. They are supposed to be global. But I don't understand the difference

from

if this variable is declared in the header. Ideally, by scope of the variable. But in both cases it is visible inside the function. I made a test (script):

- Didn't notice any differences. Can you explain their difference, because I don't understand it.

There's an extra statik in there. It will also work without it. It makes sense to declare statics inside functions. The scope of the function block only.