[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 178

 
chief2000 >> :

I had problems if I set arrays to store variable states for any "i" and

didn't define their dimensions as "[]".

If array is defined as indicator SetIndexBuffer(0,MyArray); in int init() then it doesn't need to be initialized additionally,

Otherwise, besides declaring MyArray[]; you need to initialize the size ArrayResize(MyArray,Count);,

and exactly in the function where assignment will be done.

then in

int start()
{ArrayResize( MyArray, Count);
//...
return(0);
}

.

But if size of Array is declared explicitly by number MyArray[1000];; we don't need all this.

The ArrayResize method is useful, when you don't know the size of the array beforehand, and calculate it in the program.

 
Urain >> :

If an array is defined as an indicator SetIndexBuffer(0,MyArray); in int init(), it does not need to be initialized additionally,

Otherwise, besides declaring MyArray[]; you need to initialize the size of ArrayResize(MyArray,Count);,

and exactly in the function where assignment will be done.

then into

.

But if an array's size is explicitly declared as MyArray[1000];, we don't need all that.

The ArrayResize method is useful when you don't know the size of the array beforehand, but calculate it in the program.



The answer is exhaustive! Thank you very much!

 
chief2000 >> :

The answer is exhaustive! Thank you very much!

I can't resist adding that all this and much more is written compactly and quite clearly in the textbook, and one should gradually move on from listening to the tales to reading for oneself.

 

Please explain if the switch statement can be inserted after If ?

those:

if (condition)

switch

 
chief2000 >> :

A Chukcha is fishing on the shore. An American submarine comes up, the captain emerges from it.

He looks around, shouts down a northeast course. The boat plunged and disappeared. Some time later, a Russian submarine

a Russian submarine comes up. The captain asks the Chukcha in which direction the American submarine disappeared.

Chukcha answers:
- North-east course!
- Don't get clever with me, show me with your finger!

:)

Some advice for a beginner.

There are some functions in MQL that are called to make a fish.

If this function will be rewritten as a DLL, it will be possible to call it in other programs, for example in Omega.

Thank you.

 
granit77 >> :

I can't resist adding that all this and much more is written compactly and quite clearly in the textbook, and one should gradually move on from listening to tales to reading for oneself.

It's all true, but everything takes time. And soon you'll have to study MQL5.

 

People kind help with the condition ... how to properly spell the condition such as: there is an indicator with 2 levels of 0 and 100 ... and the condition is as follows: line went below the level 0 after some time, went above 0 level and went beyond the level of 100 and the exit level of 100 condition should end.

ׂ

I can't put it in my EA... I don't know how to do it, ........?????

and is it possible to write the condition below ?


 
Infinity >> :

People kind help with the condition. How to properly spell the condition such as: there is an indicator with 2 levels of 0 and 100 ... and the condition is as follows: line went below the level 0 after some time, went above 0 level and went beyond the level of 100 and the exit level of 100 condition should end.

I can't put it in my EA... I don't know how to do it, ........?????

and is it possible to write the condition below ?


Look for an EA from Laguero, I think there were such conditions there I can't remember exactly, but yours looks a lot like it...

 
Infinity писал(а) >>

People kind help with the condition. How to properly spell the condition such as: there is an indicator with 2 levels of 0 and 100 ... and the condition is as follows: line went below the level 0 after some time, went above 0 level and went beyond the level of 100 and the exit level of 100 condition should end.

I can't put it in my EA... I don't know how to do it, ........?????

and is it possible to write the condition below ?

It's got to be something like:

if( ind[1]>0 && ind[2]<=0) flag_1 = true;
if( ind[1]<0 && ind[2]>=0) flag_1 = false;

if( flag_1 && ind[1]>100 && ind[2]<=100) { flag_2 = true; flag_1=false; }

if( flag_2 && flag_2 && ind[1]<100 && ind[2]>=100)
{
   flag_2 = false;
   // Здесь вроде бы произошло описываемое событие...
   // Но надо экспертом проверять...
}
What I meant was that you have to describe with these checkboxes then there will be less calculations, and moreover there will be no cycles...
 
Infinity >> :

People kind help with the condition. How to properly spell the condition such as: there is an indicator with 2 levels of 0 and 100 ... and the condition is as follows: line went below the level 0 after some time, went above 0 level and went beyond the level of 100 and the exit level of 100 condition should end.

I can't put it in my EA... I don't know how to do it, ........?????

and is it possible to write the condition below ?


Maybe something like this - just an idea(!) - for the Indicator:

x[ i]=iRSI(...); // <= Пусть RSI будет в качестве Примера. 

TimeStart = 0;
TimeEnd   = 0;


if( x[ i]>0   &&   x[ i+1]<=0) {
   TimeStart=Time[ i];
}
if( x[ i]>=100   &&   x[ i+1]<100){
   TimeEnd=Time[ i+1];
}

if( TimeStart!=0   &&   TimeEnd!=0   &&   TimeEnd> TimeStart) {
   Range_i_Start = iBarShift(NULL,0, TimeStart);
   Range_i_End   = iBarShift(NULL,0, TimeEnd);

   bool status = false;
   for(int k = ... Range_i_Start -> Range_i_End  ) {
      if( x[ k]<0   ||   x[ k]>100) {
         status = true;
         break;
      }
   } // for()

   if( status==false) {
      ... Done;

      TimeStart = 0;
      TimeEnd   = 0;
   }
} // if(TimeStart!=0   &&   TimeEnd!=0) {