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

 
JuliettaRu:
Good afternoon, please direct me to where to find an explanation of my question (I assume I am not the first to ask it) and what to do. I have installed MT4 on my smartphone, but the charts it shows with a 20 min delay - I compare it with the MT4 readings on the PC.
It's a grail!
 

Help me figure this out. I can't figure out how to fix this piece of code... Or rather, what can I add to it so it won't swear?

return value of 'OrderModify' should be checked

         }    
         if (OrderOpenPrice()-Ask > Korts*Point*Multi)
         {
           if (OrderStopLoss() > Ask +(Korts)*Point*Multi) 
           {
              OrderModify(OrderTicket(),OrderOpenPrice(),Ask + (TrSt)*Point*Multi,'1', 0, Red);
           }
         }            
      }
   }   
   return(0);
 
Guaro:

Help me figure this out. I can't figure out how to fix this piece of code... Or rather, what should I add so it won't swear?

return value of 'OrderModify' should be checked

The returned value of the OrderModify() function must be assigned to a variable so that the function can be checked. Or just

if(OrderModify(OrderTicket(),OrderOpenPrice(),Ask + (TrSt)*Point*Multi,'1', 0, Red))
Print("Ордер модифицирован успешно.");
 

Help fix compile error: Magic - undeclared identifier

cat:

bool CheckExists(int Type)
{
bool Result = True;
for(int i = 0; i < OrdersTotal(); i++)
if(OrderSelect(i, SELECT_BY_POS))
if(OrderType() == Type && OrderMagicNumber() == Magic && OrderSymbol() == Symbol())
if(OrderOpenTime() >= Time[0])
Result = False;
for(i = 0; i < OrdersHistoryTotal(); i++)
{
if(OrderSelect(i, SELECT_BY_POS, MODE_HISTORY))
if(OrderType() == Type &&& OrderOpenTime() >= Time[0]
&& OrderMagicNumber() == Magic && OrderSymbol() == Symbol())
Result = False;
}

return(Result);
}

 
Abdus_Ali:

Help fix compile error: Magic - undeclared identifier

cat:

Global and user variables must be declared at the beginning of the code, in this case it is a user variable, write it like this:

input int Magic = 1;

 
ticket2=OrderSend( Symbol(),OP_SELL, lot1, Price2, 20, SL2, TP2, NULL, 2,0, clrGreen);
if (Bid>=TP1) // 1(1/0)
{

OrderModify(ticket2,?????, SL2, Price2, 0, clrNONE);

Good evening tell me how to modify ticket2 order? What price to put instead of ?????.....? Or do I have to first select this order to modify it? Although in fact I have already selected it by writing in the parameters of the OrderModify(ticket2,.....

 
bobrush:
ticket2=OrderSend( Symbol(),OP_SELL, lot1, Price2, 20, SL2, TP2, NULL, 2,0, clrGreen);
if (Bid>=TP1) // 1(1/0)
{

OrderModify(ticket2,?????, SL2, Price2, 0, clrNONE);

Good evening tell me how to modify ticket2 order? What price to put instead of ?????.....? Or do I have to first select this order to modify it? Although in fact I have already selected it by writing in the parameters of the OrderModify(ticket2,.....

Put OrderOpenPrice()
 
I can't understand why the search and close positions stops in the loop, I've already reversed the loop and increased the number of positions, in the tester it still skips (leaves) positions... tell me if you can see where and what is wrong...
int positions=PositionsTotal();
       for(int x1=-1;x1<positions;x1++) 
          {
           ulong pos_tiket11=PositionGetTicket(x1);
           if(PositionSelectByTicket(pos_tiket11))
             {
              string comment11=PositionGetString(POSITION_COMMENT);
              Print("ПОЗИЦИЯ ТИКЕТ + "+(string)pos_tiket11+" "+comment11+" ТИП "+(string)PositionGetInteger(POSITION_TYPE));
              if(pos_tiket11!=TIKET11) 
                {
                 ENUM_POSITION_TYPE type11=(ENUM_POSITION_TYPE)PositionGetInteger(POSITION_TYPE);
                 if(type11==POSITION_TYPE_BUY)
                   {
                    Print("ПОЗИЦИЯ ВЫБРАНА КОМЕНТ = "+comment11);
                    mytrade111.PositionClose(pos_tiket11,15);
                    TIKKET=0;    
                    dolivka_P1=1;
                   } 
                }
             }
          }
 
ara66676:
I can't understand why position search and closing stops in the loop, I've already reversed the loop and increased the number of positions, but in the tester it still skips (leaves) positions.

Since the question is on the mql4 forum, I assume the code is also on mql4. Or is it wrong?

In mql4 there are no positions, there are only orders.

 
AlexeyVik:

Since the question is on the mql4 forum, I assume the code is also on mql4. Or is it not?

There are no positions in mql4, only orders.

geez, there's just no such response to the request on the 5th. Alas the code is on the 5th.

Reason: