[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 411

 
kolyango:

How to make:

if Condition1 is fulfilled, then don't check it anymore at every tick, and at next ticks check Condition2 also and then Condition3 also until we declare all flags false?

bool проверять_ус1=true;
bool проверять_ус2=true;
bool проверять_ус3=true;
void start(){
      if(проверять_ус1)
         if(Open[0]>Close[1]){//условие 1
            проверять_ус1=false; //заглушка
         }
      if(проверять_ус2)
         if(Open[0]<Close[2]){//условие 1
            проверять_ус2=false; //заглушка
         }
      if(проверять_ус3)
         if(Open[0]==Close[3]){//условие 1
            проверять_ус3=false; //заглушка
         }
      if(!проверять_ус1&&!проверять_ус2&&!проверять_ус3){
            проверять_ус1=true;
            проверять_ус2=true;
            проверять_ус3=true;      
      }
}

read the code several times until it is clear what is written, and you will be happy.

 
costy_:

it reads the data of the bar that has already established (previous) i+1 remove. But the creator's algorithm will be broken (he knows better, I also work on open and generated +1 data)


As the creator says, i+1 is only for feeding data from another indicator, then the breakdown condition is checked, but all further calculations are performed on i.

The thing is that the indicator is not updated automatically, only with reloading (change of TF, change of properties).

I don't understand what is the reason.

I tried to use just i, shoving the data calculation from the required indicator on the previous bar, at the end of the cycle, but it didn't help.

 
costy_:

Still don't get it.

It's probably easier to explain in a picture.


Yes, thank you! Where you have it highlighted in blue you need to find the candle that closed above the high on D1.
 
costy_:

Read the code several times until it is clear what is written, and you will be happy.


Thanks again!
 
LOA:


As a creator I say that i+1 is only for feeding data from another indicator, then it checks for breakdown condition, but all further calculation on i.

The thing is that the indicator doesn't update automatically at all, only with reloading (changing TF, displaying properties).

I don't understand the reason.

I tried to use just i, shoving the data calculation from the required indicator on the previous bar, to the end of the cycle, but it didn't help.

you have

           int  proboy_5_UP = iCustom (NULL,0,"ME_Proboy_F5_For_EX",0,i+1);/*запрос значения индикатора 

I suspect it should be like this.

           double proboy_5_UP = iCustom (NULL,0,"ME_Proboy_F5_For_EX",0,i+1);/*запрос значения индикатора 
 
costy_:

You have

I suspect it should be like this.


no.... We do not take the price value, but the indicator reading (histogram), the value of which may be 1 or -1.
 
costy_:

Read the code several times until it is clear what is written, and you will be happy.


How do you rewrite the conditions of such code, I don't get it?

static bool Val_max, Cl_dn, Val_min; //static or global
                                        |
//+------------------------------------------------------------------+
int start()
  {
   int j;
   double bid;                                         
   bid=Bid;                                    // Текущая цена продажи
   string
   Symb=Symbol();                               // Название фин.инстр.
double Value_max=1.0000;
double Value_min=0.9980;
double Open_1=Open[1];
double Close_1=Close[1];
//----

//--------------------------------------------------------------- 4 --

double Val=iCustom(NULL, 0, "Название Польз. Индикатора",0,0);   // Присваиваем пер. Val значение польз. индикатора
if (Условие1)
{
 Val_max=true;                  // 
 Alert("Значение инд. >= Value_max (исп. 1-е усл.)");
}
if (Условие2)
{
 Cl_dn=true;
 Alert("1 бар закрылся падением (исп. 2-е усл.)");
}
if (Условие3 && Cl_dn==true)
{
 Val_min=true;
 Alert("Значение инд. <= Value_min (исп. 3-е усл.)");
}
if (Val_max==true && Cl_dn==true && Val_min==true)
  {
   for (j = 0; j < OrdersTotal(); j++)
    {
     OrderSelect(j, SELECT_BY_POS, MODE_TRADES);
     if (OrderSymbol() == Symbol())
      {
      if (OrderType() == OP_SELL) return(0);
      }
    }
   
   OrderSend(Symbol(),OP_SELL,0.1,NormalizeDouble(Bid,Digits),2,Bid+400*Point,Bid-400*Point,"",3,Red);  // Открытие SELL
   Val_max=false; Cl_dn=false; Val_min=false;
  }

//----
   return(0);
  }
 
LOA:

no.... We don't take the price value, but the indicator (histogram), which may have a value of 1 or -1.

I still can't answer, where are the invoked inds that they return int double, can they really be >1 so that int is assigned >0 and vice versa (at least *.ex4)?

ME_Proboy_F5_For_EX

ME_Order_ATR_For_EX

2011.12.07 18:10:42 Cannot open file \experts\indicators\ME_Proboy_F5_For_EX.ex4' on the AUDUSD,M30

Replaced all with MACD, everything works!

Files:
temp_1.mq4  14 kb
 
kolyango:


How do I rewrite the conditions of such code, I don't get it?

bool проверять_ус1=true;
bool проверять_ус2=true;
bool проверять_ус3=true;
void start(){
      if(проверять_ус1)
         if(Open[0]>Close[1]){//условие 1
            проверять_ус1=false; //заглушка
         }
      if(проверять_ус2)
         if(Open[0]<Close[2]){//условие 1
            проверять_ус2=false; //заглушка
         }
      if(проверять_ус3)
         if(Open[0]==Close[3]){//условие 1
            проверять_ус3=false; //заглушка
         }
      if(!проверять_ус1&&!проверять_ус2&&!проверять_ус3){
            проверять_ус1=true;
            проверять_ус2=true;
            проверять_ус3=true;      
      }
}

Read the code several times until it's clear what's written, and you'll be happy.

Why do you need flags?) You can do without them.

   if(Close[i+3]>Open[i+3]&&Close[i+2]>Open[i+3]&&Close[i+2]<Close[i+3]&&Close[i]>Close[i+3]) //открываем бай

 
costy_:

I still can't answer, where are the invoked inds that they return int double, can they really be >1 so that int is assigned >0 and vice versa (at least *.ex4)?

ME_Proboy_F5_For_EX

ME_Order_ATR_For_EX

2011.12.07 18:10:42 Cannot open file \experts\indicators\ME_Proboy_F5_For_EX.ex4' on the AUDUSD,M30

Replaced everything with MACD, everything works!


Yes, the indicator on the history works with any triggered indicator.Doesn't work in real life, checked on M1.

If I understood you correctly, I will try to replace in the conditions >0, <0 with ==1 or ==-1.