[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 166

 

//+------------------------------------------------------------------+
//| nax.mq4 |
//| Evgenio |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Evgenio"
#property link "http://www.metaquotes.net"

//---- input parameters
extern int Fast_MACD=12;
extern int Slow_MACD=24;
extern int Signal_MACD=6;
double a,mas_1[];
int i=1;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
a=NormalizeDouble(iMACD(Symbol(),NULL,Fast_MACD,Slow_MACD,Signal_MACD,PRICE_CLOSE,MODE_MAIN,0),5);
if (a>0)
{
Print ("MACD выше 0 начинаю считывать бары");
while (NormalizeDouble(iMACD(Symbol(),NULL,Fast_MACD,Slow_MACD,Signal_MACD,PRICE_CLOSE,MODE_MAIN,i),5)>0)
{
mas_1[i]=NormalizeDouble(iMACD(Symbol(),NULL,Fast_MACD,Slow_MACD,Signal_MACD,PRICE_CLOSE,MODE_MAIN,i),5);
Print (GetLastError());
i++;
}
Print ("В массив добавлено "+ArrayRange(mas_1,0)+" баров");
}
return(0);
}
//+------------------------------------------------------------------+

what is wrong, why is nothing being added to the array ?
 
evgenio писал(а) >>
what is wrong, why nothing is added to the array ?

Where is the definition of an array size?

 
Vinin >> :

Where is the definition of an array size?

and if the size of the array is not known before, how ?

 
evgenio писал(а) >>

If the size of the array is not known beforehand, how?

Then it is necessary to make dynamic and if necessary to increase its size.

 
Vinin >> :

Then make it dynamic and increase its size if necessary.

can you tell me where to find it?

 
found
 
Hello again! Can you tell me how to identify the ticket or item number?
 
ArtY0m >> :
Hello again! Can you please tell me how to determine the ticket or item number?

int OrderTicket( )

Returns the ticket number for the currently selected order.
The order must be pre-selected using the OrderSelect() function.

 
Alex5757000 >> :

int OrderTicket( )

Returns the ticket number for the currently selected order.
The order must be pre-selected using OrderSelect().

And if the number is not known. There is only type, lot, magic number, position currency... We also know that this order was opened first on this magic number...

 
int init()
  {
   return(0);
  }
int deinit()
  {
   return(0);
  }
int start()
if (OrdersTotal()==0)
   {
      if (iRSI(NULL,0,14,PRICE_CLOSE,1)>71 && iDeMarker(NULL,0,13,1)>0.71)
      OrderSend(Symbol(),OP_SELL,lot,Bid,3,Bid+0.001,Bid-0.01,"",666,0,Green);
      if (iRSI(NULL,0,14,PRICE_CLOSE,1)<29 && iDeMarker(NULL,0,13,1)<0.29)
      OrderSend(Symbol(),OP_BUY,lot,Ask,3,Bid-0.001,Bid+0.01,"",666,0,Blue);
   }
else
  
      for (int i=1; i<= OrdersTotal(); i++)
      {
        if (OrderSelect(i-1,SELECT_BY_POS)==true)
         {
            if(OrderType()==OP_SELL)
               {
               if ((OrderStopLoss()- 0.001) < Bid)
                  {
                   if (OrderStopLoss()>OrderOpenPrice()) {
                   OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice(),OrderTakeProfit(),Green);}
                   else
                   OrderModify(OrderTicket(),OrderOpenPrice(),(OrderStopLoss()-0.001),OrderTakeProfit(),Green);
                  }
               }
         }
         else
         {
             if(OrderType()==OP_BUY)
                {
                if ((OrderStopLoss()+0.001) < Bid)
                   {
                    if (OrderStopLoss()<OrderOpenPrice()){
                    OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice(),OrderTakeProfit(),Blue);}
                    else
                    OrderModify(OrderTicket(),OrderOpenPrice(),(OrderStopLoss()+0.001),OrderTakeProfit(),Blue);
                   }
                }  
         }        
   } 
return(0);
} 

Code for my first EA, works on RCAI and Dem. The problem is that it won't move orders i.e. stops... it always swears for wrong stops... Even found other codes to move stops ... still the same error.

Thanks in advance.

Reason: