[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 673

 
artmedia70:
I.e. I need to add a call to display information in indicator window in init()?


try writing in init()

int init()
{
Alert("I can't find your box, I'm out of here, although I was called in the init() section");
return(0);
}

 
IgorM:


Well, try writing in init()

int init()
{
Alert("I can't find your box, I'm out of here, although I was called in the init() section");
return(0);
}

:) Are you plagiarizing? :)
 

Help me deal with this problem! If I have a losing trade, I need to change the lot, if not - no. I do so ......

//====================================================
// Расчет размера позиции
//====================================================
double CalculateLots(){
   double Res=dLots;
   bool bProfit=true;
   int PrevTime=-1;
   double tmpLots;
   for (int i=0;i<OrdersHistoryTotal();i++){
      if (!OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)) continue;
      if (OrderSymbol()!=Symbol())                    continue;
      if (OrderMagicNumber()!=MAGIC)                  continue;
      if (OrderCloseTime()<PrevTime)                  continue;
      PrevTime=OrderCloseTime();
      if (OrderProfit()>0) bProfit=true; else bProfit=false;
      tmpLots=OrderLots();
   }
   double Lots_Step=MarketInfo(Symbol(), MODE_LOTSTEP);
   if (!bProfit) Res=tmpLots+Lots_Step;
   return(Res);
}

I have to change the lot if I want to change it, but I will not. The thing is that when I change lot I already have a pending order (with other lots). I need to delete these orders and change the number of lots in them (to a new one), but the parameters remain the same !


 


Dear programmers,
Please answer the following question:

Can you tell me why data from a string is not correctly entered into the array?

extern string Sessions_begin="15:31;14:11";
extern string Sessions_end="22:32;18:12"; 

int mas_time_begin[10][2], mas_time_end[10][2];  //первый - № сессии,
            // второй время[][1]-первый элемень время(часы), [][2]-минуты.

//
str_len_begin=StringLen(Sessions_begin)

Print("Длина str_len_begin="+str_len_begin);
  for (n=1,i=0; i<=str_len_begin; i+=6,n++)
  {
   mas_time_begin[n][1]=StrToInteger(StringSubstr(Sessions_begin,i,2));
   mas_time_begin[n][2]=StrToInteger(StringSubstr(Sessions_begin,i+3,2));
   mas_time_end[n][1]=StrToInteger(StringSubstr(Sessions_end,i,2));
   mas_time_end[n][2]=StrToInteger(StringSubstr(Sessions_end,i+3,2));
  Print("n= "+n);
  Print("i= "+i);

  Print("Начало сессии "+n+" в(вывод через Print) "+StringSubstr(Sessions_begin,i,2)+":"+StringSubstr(Sessions_begin,i+3,2)); 
  Print("Конец сессии "+n+" в (вывод через Print) "+StringSubstr(Sessions_end,i,2)+":"+StringSubstr(Sessions_end,i+3,2));
  Print("Начало сессии "+n+" в(вывод через Массив) "+mas_time_begin[n][1]+":"+mas_time_begin[n][2]);
  Print("Конец сессии "+n+" в(вывод через Массив) "+mas_time_end[n][1]+":"+mas_time_end[n][2]);
  }

Here's what I've got now:

http://savepic.ru/1410881.gif

 

Господа, не подскажете ли? Есть проблема в сортировке ордеров при включении или (наложении) отремонтированного советника на имеющиеся уже, выставленные отложки. Я тут пытался соорудить коды для поиска, распознавания и переприсвоения имеющихся номеров ордеров, чтоб советник воспринимал их как свои, но результат какой-то неопределённый. Советник при включении начинает лупить некоторые отложки в тоже место с теми же параметрами.....Может у кого есть коды или мысли по этой теме, для многих ордеров?

Thank you to those who responded.

 
Hedin:


Dear programmers,
please answer the following question:

Can you tell me why the data from the string is not correctly entered into the array?

This is what I get now:

http://savepic.ru/1410881.gif

The array size in the second dimension is not set correctly:

int mas_time_begin[10][2], mas_time_end[10][2];  //первый - № сессии,

Array elements start with 0, and you are in these entries

mas_time_begin[n][2]=StrToInteger(StringSubstr(Sessions_begin,i+3,2));
mas_time_end[n][2]=StrToInteger(StringSubstr(Sessions_end,i+3,2));
want to write data to cell 3 (0, 1, 2), although the second dimension is set with two (only the indices 0, 1 can be used).

Solution: Either enlarge the array in the second dimension

int mas_time_begin[10][3], mas_time_end[10][3];  //первый - № сессии,

or rewrite the indexes when writing the values

mas_time_begin[n][0]=StrToInteger(StringSubstr(Sessions_begin,i,2));
mas_time_begin[n][1]=StrToInteger(StringSubstr(Sessions_begin,i+3,2));
mas_time_end[n][0]=StrToInteger(StringSubstr(Sessions_end,i,2));
mas_time_end[n][1]=StrToInteger(StringSubstr(Sessions_end,i+3,2));
 
rosomah:

Gentlemen, can you advise? I have a problem with sorting orders when I enable or (superimpose) a repaired EA on already placed pending orders. I have tried to build codes to search for and re-assign available order numbers so that the EA recognizes them as its own ones, but the result is indefinite. When I enable it, the EA starts to place some pending orders in the same place with the same parameters..... - Does anybody have any codes or suggestions on this topic for many orders?

Thank you for your feedback.

It depends on how the EA defines "owl - alien", if by magic number then there is nothing you can do with already placed pending orders as this parameter cannot be changed for an already placed order.
If it stores tickets, let us assume, in global variables, then it is already easier, the tickets already existing can be "added to the base". So this is the main question for you at this stage. How does it determine?
 
ToLik_SRGV:

It depends on how the EA defines "owl - alien". If it is set by magic number then there is nothing to do with already placed pending orders, as this parameter cannot be changed for an already placed order.

Yes, and if there is a grid of different pending orders, with holes formed because some pending orders were triggered, some moved, etc. They need to be recognised, renumbered and filled by a "new" Expert Advisor. Of course, we can do it manually, but... Then why bother with MTS? For one order, we can at least get it from N.Morzhov:

int poisk;

if(poisk==0)

{ int k;

for(k=0; k<OrderTotal();k++)

{ if(OrderSelect(k,SELECT_BY_POS,MODE_TRADES)==false)break;

if(OrderSymbol()!=Symbol()||OrderMagicNumber()!=Magic)cjntinue

ticket_buy1=OrderTicket();

poisk=1; }}

but how to deal with a set of orders?

 
Who knows when the mql5 tutorial is scheduled to come out?
 
Abzasc:
Who knows when the mql5 tutorial is scheduled to come out?

https://www.mql5.com/ru/forum/491