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

 
costy_:

How do you answer without knowing that NumTimeFrames TimeFrames[i] is empty or what?

Write fuller, how, or rather, what to read carefully if there is nothing. Write the full code, otherwise you will most likely "gnaw the granite of science",,,,)) if(true)continue; else return("Sleep("+7*1000*60*60+")");

You got it right.


int TimeFrames[]={5,15,30,60}; 
int NumTimeFrames=ArraySize(TimeFrames);
int total_bars[]; ArrayResize(total_bars,NumTimeFrames);
string instrument = Symbol();

// пробегаем по задданым периодам
for(i=0; i<NumTimeFrames; i++)
  {
    // пробегаем по всем барам выбранного периода, ЕСЛИ на нем появились новые бары 
    if(total_bars[i]!=iBars(instrument,TimeFrames[i]))
     {


        // тут вычисления индиктора

        total_bars[i]=iBars(instrument,TimeFrames[i]); // запоминаем число баров на данном периоде
     }


Basically, as I understood it, we can skip checking for the appearance of new bars.

Actually it can be reduced to a simple question: "on what commands and at what moment MT downloads quotes from brokerage companies?

 
palladin:

could you cite the code you used to test your statement?


//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
   Print(iBars(Symbol(), PERIOD_D1));
//----
   return(0);
  }
//+------------------------------------------------------------------+
 
Reshetov:

As I assumed you didn't understand the question.

Try this:


int start()
  {
//----
   Print(iBars(Symbol(), PERIOD_M1));
//----
   return(0);
  }
//+------------------------------------------------------------------+


Запустите на периоде М5 и подождите минуту, в логе вы обнаружите, что с каждой минутой отображается одно и то же число! Хотя оно, очевидно, должно увеличиваться с каждой минутой)

 
palladin:

As I assumed you didn't understand the question.

Try this:



Запустите на периоде М5 и подождите минуту, в логе вы обнаружите, что с каждой минутой отображается одно и то же число! Хотя оно, очевидно, должно увеличиваться с каждой минутой)



what number are you displaying ?

what is the time of this iBars bar ?

is there a story on the M1?
 

Reshetov ,sergeev ,costy_

thanks


I rechecked, it seems to work after all, and I was wrong in my assumption.

iBars seems to really work correctly, not even on the current graph


 
for(i=0;i<=OrdersTotal();i++)
    {
    if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES) == false) break;
    if(OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber)
      {
      if(OrderType() == OP_BUYSTOP)
        {
        if(OrderOpenPrice() > priceBuy)
          {
          priceBuy = OrderOpenPrice();
          }
        }
      }
    } 
  if(TakePrices1 == false)
    {  
    bTakeProfit = priceBuy + (10*2)*Point;
    TakePrices1 = true;
    }
This piece selects the highest buy order and adds 20 pips to its price, and moves the take profit to that level. But actually it's not 20 pips, it's 13 pips. Why 13, not 10, not 30, but 13? Where does this number come from?
 
sss2019:
This piece selects the highest buy order and adds 20 pips to its price, and moves the take profit to that level. But in fact it's not 20 pips, it is 13 pips. Why 13, not 10, not 30, but 13? Where does this number come from?


20-Spred

Open at Bid, close at Ask

 
Vinin:


20-Spred

Open at Bid, close at Ask


No, take profit has not triggered yet. This code finds the highest pending buy order and subtracts 20 points from its open price. The profit is simply moved to 20 points more. It seems the spread should not be taken into account here. Besides, the spread is fixed at 2 points and we are missing 7 points.
 
I don't understand what the problem is. It seems that when I print the values, the price is at the right level, but when I put this value into the order, its take profit still moves only 13 pips.
 

Tra ta ta

Reason: