[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 218

 
ViktorF:

When the EA is running, these errors are popping up:

There were times when orders either did not close or did not open at certain points.

To what extent are the closing/opening failures related to these errors? How to avoid them (preferably without MT5 terminal replacement)?

See here and here... and here...

Why not type the name of the error into the search box and get the answer right away?

 
Roman.:


Get your broker banned from automated trading for you by frequent requests in real trade - you'll only have to trade by phone yourself.

Modify orders after a certain number of points (interval), e.g. 50 or 100 - that's with a pentameter (say, when price moves in your direction - modify the order), and everything will be fine. :-))) IMHO, of course.

Um...


Totally approve...
 

Good afternoon! Textbook quote:

One or more constants may be skipped in the initialization sequence. In this case, the corresponding array elements of numeric types are initialized with zero, and array elements of string type are initialized with string value "" (opening and closing double quote without space), i.e. empty string (not to be confused with space).

Question 1: What happens by elements of bool type when a space is omitted?

The idea is the following: we create a one-dimensional array of flags of trade opening parameters, hence

bool Open[20] {par1,par2,par3....,par20}

if (MA1>MA2) par1=true;

if (MA7>MA8) par2=true; ...

if (ma33>ma55) par20=true;

Who has encountered such solutions - advise:

2- is the direction correct?

3- how to further write parameter variants like if (Open [12] {1,0,0,1,1...,0 } ) OrderSend() etc. - right?

 
ilmur:

help please... my Expert Advisor checks open orders ...one order can be open at a time ...but when I enter a stop on a straight line at the moment of opening an order it gives out error 130...for example it was like this

if(down>0)

{

ticket=OrderSend(Symbol(),OP_SELL,dLot,Bid,3,0,Bid-TakeProfit*Point,0,16384,0,Red);

I type in a stop of size 100

ticket=OrderSend(Symbol(),OP_SELL,dLot,Bid,3,100,Bid-TakeProfit*Point,0,16384,0,Red); ...gives error 130 in the tester

alpari...maybe i should modify order after opening and place stop...advise how to do it or point me to advisor where it is done...please


Alpari does not open trades with stoplosses and takeovers
 
100yan:

The idea is as follows: create a one-dimensional array of flags of trade opening parameters, hence

bool Open[20] {par1,par2,par3....,par20}

if (MA1>MA2) par1=true;

if (MA7>MA8) par2=true; ...

if (ma33>ma55) par20=true;

Who has encountered such solutions - advise:

2 is the direction correct?

3- how to further write parameter variants like if (Open [12] {1,0,0,1,1...,0 } ) OrderSend() etc. - right?

which direction and what do you mean right?

and how can i tell you how to get it right if i don't understand the problem

 
int OrderStatus() {
   int z1=0, z2=0;  // порядок для массива
   int i, k=OrdersTotal();
      for (i=1; i<=k; i++) {
         if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
            if (OrderType()==OP_BUYSTOP && OrderSymbol()==Symbol() && OrderMagicNumber()==MG) {
            TicketBS[z1]=OrderTicket(); // присваем массиву под 1 ячейкой первый найденный ордер тикет
            z1++;
            }
            if (OrderType()==OP_SELLSTOP && OrderSymbol()==Symbol() && OrderMagicNumber()==MG) {
            TicketSS[z2]=OrderTicket();
            z2++;
            }
         }
      }
}
Who can help, why doesn't TicketBS[] and TicketSS[] assign values to TicketBS[] array ??? writes always 0...
 
eddy:

which direction and what is correct?

And how can I tell you how to write something down correctly if you don't understand the task itself?

1. Is the direction of thought correct?

2. how to compare parameter variants with a given array? I.e. create an array with correct parameters. For example, instead of writing if((MA1>MA2)&&(MA7>MA8)&& ....) we should use an array variant for opening an order of type12 Open [12] {1,1,1,0,1...,0 } where the set of parameters is respectively a condition for opening a type12 order.

 

тип12 Open [12] {1,1,1,0,1...,0 }

What is this? The elements of custom arrays are variables, but you have a body here for some reason (curly braces).

 
eddy:

What is this? The elements of custom arrays are variables, and you have a body here for some reason (curly braces)


Initialization of an array


An array can be initialized only with constants of the appropriate type. One-dimensional and multidimensional arrays are initialized with a comma-separated sequence of constants. The sequence is enclosed in curly braces:
bool Mas_b[5] = { false, true, false, true, true }

 
Do you want to remember the parameters to open an order? To do so, you would have to have several bool variables for each parameter to check if the market matches them