Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 239

 
r772ra:


What's the problem, it works.


The error really wasn't in the code, I should have just put "All ticks" instead of "By opening prices" as the testing model. It's a long time to test like that, of course.

Thanks more for the help! Sorry for taking my time with such stupidity)

 
Antonius:


The error was really not in the code, I should have just put "All ticks" instead of "By opening prices" as the testing model. It's a long time to test, of course.

Thanks more for the help! Sorry for taking my time with such stupidity)

To test on opening prices, replace 0 with 1 in the lines to check candle direction. But then it will look at the first bar to see the direction. With 0, you just have equal open and close prices.
 

Tell me how to teach the expert how to extract the data correctly:

I ask him to find the value of the last price. It finds it, but it outputs it with four decimal places, and rounds off the fifth. The fifth character should be taken into account for the correct robot operation.

It also rounds up the average price a little bit. It also rounds up the average price to the fourth character.

I get different numbers with the calculator.

NormalizeDouble() has tried to apply however I haven't got any results yet.

int Oldticketnumber;
double Unused = 0;
int Ticketnumber = 0;
RefreshRates();
for(int cnt = OrdersTotal()-1; cnt >= 0; cnt --)               //Для всехоткрытых ордеров
 {
  if (OrderSelect (cnt, SELECT_BY_POS, MODE_TRADES))  // Выбираем со всего масива ордеров
  if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber)//Выбирам ордера експерта
   {
   if(OrderType()==OP_BUY)                                              
    {

     BuyAP += OrderOpenPrice()*OrderLots();          // Средневзвешаная цена всех позиций  
  
     Oldticketnumber = OrderTicket();                               // присваиваем тикеты
     if (Oldticketnumber > Ticketnumber)                         //  ищем последний тикет 
      {
      LastPrise = OrderOpenPrice();                         // присваиваем последнюю цену
      Unused = LastPrise;                                       // задаем цену переменной
      Ticketnumber = Oldticketnumber;                          // последный заданый тикет
      }
// далее по  тексту---------------------------------------------------------------------

if (BuyLots != 0)       // Если есть ордера BUY, то вычисляется их средняя цена открытия
    BuyAP /= BuyLots;      

 
Limita:

Tell me how to teach the expert how to extract the data correctly:

I ask him to find the value of the last price. It finds it, but it outputs it with four decimal places, and rounds off the fifth. The fifth character should be taken into account for the correct robot operation.

It also rounds up the average price a little bit. It also rounds up theaverage price to the fourth character.

I get different numbers with the calculator.

NormalizeDouble() has tried to apply however I haven't got any results yet.

Where do you see all this?
 
artmedia70:
Where do you see all this?


There's no getting away from rounding. But the question of what rounding from the 5th or 4th digit
in the code below:

Comment("Средняя цена Buy ",BuyAP, " Sell ",SellAP, " Последняя цена " ,LastPrise);
                                                                              // принтуем
 
Limita:


There's no getting away from rounding. But the question is whether to round from the 5th or 4th digit
in the code below:

I tried it this way

Comment("Средняя цена Buy ",DoubleToStr(BuyAP,5), " Sell ",DoubleToStr(SellAP,5), " Последняя цена " ,DoubleToStr(LastPrise,5));

string DoubleToStr( double value, int digits)
Converts a numeric value to a text string, containing character representation of number in specified accuracy format.

 

Hi all, I have this task:

Determine the appearance of a new bar (synthetic), using a minimum of code and not using variables tied to the opening time of the bar. The solution is as follows:

if (Bid>Open[0] || Bid<Open[0]) return;
What are the possible pitfalls when using in tester and in demo?
 
dmitriy086:

Hi all, I have this task:

Determine the appearance of a new bar (synthetic), using a minimum of code and not using variables tied to the opening time of the bar. I solved it in the following way:

What are the possible pitfalls of using it in the tester and in the demo?


When trading synthetics you don't have a single bar for this instrument, but a set of instruments for each of which you can try to identify a new bar. The more instruments in trade, the more probable error or slippage in time, because the EA hangs on one pair and sees other ticks only when a tick for this instrument arrives.
You can use global variables, but it doesn't help much because if you tracked a new tick on another currency pair without the robot, you still can't trade because there is no tick on your pair. If you don't have a lot of instruments, the easiest way is to write a robot, taking into account that it will be present everywhere at once.

Does anybody know if it's possible not to display all buffers values in a separate indicator window? It's that white line in the upper left corner of the indicator window, it's annoying to see so many unnecessary digits in the 8 buffers used.

 
Desead:


Does anyone know if it is possible not to display all buffers in a separate indicator window? This is the white line that is written in the upper left corner of the indicator window, it is annoying to see so many unnecessary numbers when 8 buffers are used.


Inite SetIndexLabel(...,"), but the buffer will also disappear from the data window.
 
Integer:

Init SetIndexLabel(...,"), but the buffer will disappear from the data window as well.

Not an option, all buffers are used and named. Well, it's still a whim, not a need. Thank you.