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

 
hoz:

http://photoload.ru/data/c4/9a/b1/c49ab15e130c84a1ca9c51711fcf423a.jpg I still don't understand the logic of indicators. For example, if you take a standard Moving Average indicator.

It is in the start:

Everything is logical here, the next step is the call of the function selected by the user... from the window that has appeared when stretching on the indicator chart. Right?

There is a piece of code in INIT that I commented out:

And yet in the DataWindow the name is written. Here's a screenshot:

The question arises. Why does INIT need this piece of code at all?


Delete the graph from the window (at all) and run it again, the name will disappear. Reinitialisation on subwindows only goes like this.
 
alsu:

Remove the graph from the window (altogether) and run it again, the name will disappear. Reinitialisation on subwindows only goes like this.

Indeed. It's all clear now.
 
TarasBY:
The easiest way to make sense of your writing is to become aware of every line of code (by signing). And it's very likely that an epiphany will come!..!
P.S. It's also a good idea to learn how to insert code into your post by pressing the "SRC" button.

Thank you I will take it into account.
 

Hello!

Have you seen a semi-automatic Fibonacci Equation Expert Advisor, I draw and it trades. It helped me with bi and Fibonacci code embedded in MQ4.

Thank you.

 
Can you tell me how to time the transformation of a pending order into a market order?
 
Please explain the question itself in the code comment
 { int buys=0,sells=0;
 {
  
    for (int i=0;i>OrdersTotal();i++)                            //цикл перебора ордеров ????
  {
   if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false)break;     // если есть ордер ????
      if(OrderSymbol()==Symbol() && OrderMagicNumber()==MAGIC)   // определяем принадлежность ордера к инструменту и маджику  ????
      {
         if(OrderType()==OP_BUY)  buys++;               // что означает buys++  ????????? присвоивает переменной новое значение?
         if(OrderType()==OP_SELL) sells++;             // и sell++     ?????????????
        }
        }
 
novator:
Please explain the question in the code comments

The variable that accumulates buy orders is incremented by 1 (programmer stuff)
 
YOUNGA:

the variable that accumulates buy orders is incremented by 1 (programmer stuff)
Thank you,
i.e. if there are more orders than 0 the function is exited ?
 {
   int buys=0,sells=0;
//----
   for(int i=1;i>OrdersTotal();i++)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
      if(OrderSymbol()==Symbol() && OrderMagicNumber()==MAGICMA)
        {
         if(OrderType()==OP_BUY)  buys++;
         if(OrderType()==OP_SELL) sells++;
        }
     }
//---- 
   if(buys>0) return(buys);
   else       return(-sells);
 

Hello!

How can I fix the code to not only look for highs and lows within a day, but also for a set interval in a few days?

Here's what I have:

if(StartHour<=EndHour)

{

delta=(EndHour*3600+EndMinute*60)-(StartHour*3600+StartMinute*60);

timeStart=iTime(NULL,PERIOD_D1,0)+StartHour*3600+StartMinute*60;

timeEnd =timeStart+delta;

}

if(StartHour>EndHour)

{

delta=(1440*60-(StartHour*3600+StartMinute*60))+(EndHour*3600+EndMinute*60);

timeEnd=iTime(NULL,PERIOD_D1,0)+EndHour*3600+EndMinute*60;

timeStart =timeEnd-delta;

 
Legeo777:

Hello!

How can I fix the code to not only look for highs and lows within a day, but also for a set interval in a few days?

Here's what I have:

if(StartHour<=EndHour)

{

delta=(EndHour*3600+EndMinute*60)-(StartHour*3600+StartMinute*60);

timeStart=iTime(NULL,PERIOD_D1,0)+StartHour*3600+StartMinute*60;

timeEnd =timeStart+delta;

}

if(StartHour>EndHour)

{

delta=(1440*60-(StartHour*3600+StartMinute*60))+(EndHour*3600+EndMinute*60);

timeEnd=iTime(NULL,PERIOD_D1,0)+EndHour*3600+EndMinute*60;

timeStart =timeEnd-delta;


In my opinion, it's easier to use the standard time-series array and for statement.