[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 419

 
7777877:

Unlatch... Result is the same:

WITHOUT "+2":


With value "+2" in line int bar_number=iBarShift(NULL,0,Time_bar,true):


Note: the vertical red line on the left (last screenshot of the chart) marks the bar from which you wanted to take the screenshot, but without "+2" in the line int bar_number=iBarShift(NULL,0,Time_bar,true).

P.S. I'm just starting to lose my mind(((




It shoots everything correctly, you have Time_bar=D'2012.10.04 14:00' which is 33 bars on the hourly chart, +2 35 bars, something like that.

I too would like to see such a screenshot..... from the red line.

 

Maybe someone has encountered this problem - only 20 MT4 platforms can be opened and that's it, no more opening. CPU and RAM are not loaded andshould allow opening. How to solve this problem?

 
abeiks:

Maybe someone has encountered this problem - only 20 MT4 platforms can be opened and that's it, no more opening. CPU and RAM are not loaded andshould allow opening. How to solve this problem?

https://forum.mql4.com/ru/18526
 
Vinin:

Of course you can, but if the trades are much less than planned, you can look for another condition

Hello! If you do not mind, I have a minute, look what is wrong here, everything seems to be going fine in tests. I put it on a real chart and wait, but it does not put pending orders!

#property copyright "Copyright 2012, MetaQuotes Software Corp.
#property link "http://www.metaquotes.net"

double tral;
double cena;
double tp;
double y;
double x;
int m=1;
int n=10;
//+------------------------------------------------------------------+
//| expert initialisation function |
//+------------------------------------------------------------------+
int init()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialisation function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+

int start()
{
//----
int tiket;


if ( TimeMinute(TimeCurrent())==m && TimeSeconds(TimeCurrent())==n)
{
x=Open[1];
y=Low[1];
tral=x-y;
cena=(x+tral)-0.0006;
tp=cena+0.0005;
if (tral>0.0013 && tral<0.0020 && Close [1]<Open [1])
{
tiket=OrderSend(Symbol(), OP_BUYSTOP,0.7, NormalizeDouble (cena,4), 3, 0, NormalizeDouble (tp,4),NULL, 0, 0, CLR_NONE)
}
}
//----
return(0);
}

 
 

Hi all. Help with code newZZ. It looks like this, but it doesn't work.

            //---------------------------
            //NewZigZag M15
            //---------------------------
            int k, i, ke;
            double zz15;
            k=iBars(NULL, TimeFrame[tf]);                                                
            ke=0;                                                                                           //число найденых екстремумов
            for (i=1; i<k; i++)                                                                             //Пошли по барам
            {
                zz15=iCustom(NULL, TimeFrame[tf], "ZigZag", dp, dv, bs, 0, i);                              //значения ЗЗ
                if (zz15!=0)                                                                                //если ЗЗ неравно 0                
                {                       
                  ke++;                                                                                     //увеличиваем число найденых екстремумов
                  if (ke==2)                                                                                //если число найденых екстремумов повно 2
                     double Curr_zz15 = zz15;                                                                      //
                }
               break;                                                                                       //выходим с цикла
           } 
           
           if(Curr_zz15!=double Prev_zz15)
           {
                Print("newZZ_15=",Curr_zz15);           //Для тестирования                                                   
                //*************************
                //ВЫЧИСЛЕНИЯ
                //*************************
                Prev_zz15=Curr_zz15;
           
           }                                            
 
gince:

Hi all. Help with code newZZ. It looks like this, but it doesn't work.

for (i=1; i<k; i++)                                                                             //Пошли по барам
            {
                zz15=iCustom(NULL, TimeFrame[tf], "ZigZag", dp, dv, bs, 0, i);                              //значения ЗЗ
                if (zz15!=0)                                                                                //если ЗЗ неравно 0                
                {                       
                  ke++;                                                                                     //увеличиваем число найденых екстремумов
                  if (ke==2)                                                                                //если число найденых екстремумов повно 2
                     double Curr_zz15 = zz15;                                                                      //
                }
               break;                                                                                       //выходим с цикла
           } 

On the first i=1 there will always be a break and the loop will end
 
ilunga:
on the first i=1 there will always be a break and the loop will end

Thank you for your reply.
So where do I insert break ?

               if (zz15!=0)                                                                                //если ЗЗ неравно 0                
                {                       
                  ke++;                                                                                     //увеличиваем число найденых екстремумов
                  if (ke==2)                                                                                //если число найденых екстремумов повно 2
                     {
                        double Curr_zz15 = zz15;                                                                      //
                        break;

                     }
                }

Here ?

 
gince:

Thanks for the reply.
So where do I put the break ?

This way ?

If you want to stop the loop after finding two extrema, then yes
 

Spasibo

Reason: