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

 
evillive:
#property icon "\\\\Images\\\\xxx.ico";

And, after compilation, the icon file will be embedded in the *.ex4 file and there will be no need to move the icon file after the compiled file.
 
thank you)))
 
roymax:
and it was not fixed in any way?

As you can see.

However, the most logical and easiest way to proxy is to prohibit the MT window tool change. So I suggest that we consider it a bug :)

 
My Expert Advisor analyses charts for a number of months, but there are charts that return the entire history on a minute chart, and there are charts that do not show more than a month and a half, and even that is if you scroll the chart back manually, it does not even scroll past a certain date.
 
pycha:
My Expert Advisor analyses the chart for a certain number of months, but there are charts that return the entire history in the minute chart, and there are charts that do not want to return more than a month and a half, and even that's if you scroll the chart back manually, even beyond a certain date it does not scroll manually.
The broker decides exactly how much history to give. If the maximum number of bars is set in the terminal settings, and there are less of them on the chart, then the broker will not give more.
 
I get it, thank you.
 

Hello Dear forum users. I would like to make a request. Would someone be able to post a piece of code with a working iEnvelopesOnArray() function? My all my attempts to tame it so far have been unsuccessful. I suspect it is the developers' fault. Here is an indicator to check its work.

//+------------------------------------------------------------------+
//|                                            Tester_EnvOnArray.mq4 |
//|     Copyright 2005 г. до нашей эры, MetaQuotes Software Company. |
//|                                              https://www.mql4.com |
//+------------------------------------------------------------------+
#property copyright   "2005 г. до нашей эры, MetaQuotes Software Company."
#property link        "https://www.mql4.com"
#property description "Пример индикатора для проверки работы функции iEnvelopesOnArray()"
#property strict

//--- indicator settings
#property  indicator_chart_window
#property  indicator_buffers 2
#property   indicator_color1  Green
#property   indicator_color2  Red

//--- indicator buffers
double     ExtEnvBuffer[];
double     ExtPriceBuffer[];

//--- bars minimum for calculation
#define  DATA_LIMIT  100

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
void OnInit(void)
  {
  IndicatorShortName("EnvOnArr");
  
  //--- 1 additional buffer are used for counting.
  IndicatorBuffers(2);
  IndicatorDigits(Digits + 2);
  
  //--- drawing settings
  SetIndexStyle(0, DRAW_LINE);
  SetIndexDrawBegin(0, DATA_LIMIT);
  
  SetIndexStyle(1, DRAW_NONE);
  SetIndexDrawBegin(1, DATA_LIMIT);
  
  //--- all indicator buffers mapping
  SetIndexBuffer(0, ExtEnvBuffer);
  SetIndexBuffer(1, ExtPriceBuffer);
  
  //--- name for DataWindow and indicator subwindow label
  SetIndexLabel(0, NULL);
  SetIndexLabel(1, NULL);
  }
  
//+------------------------------------------------------------------+
//| EnvelopesOnArray                                                 |
//+------------------------------------------------------------------+
int OnCalculate (const int rates_total,
                 const int prev_calculated,
                 const datetime & time[],
                 const double & open[],
                 const double & high[],
                 const double & low[],
                 const double & close[],
                 const long & tick_volume[],
                 const long & volume[],
                 const int & spread[])
  {
  int    i, limit;
  double prev = 0.0, Deviation = 1;
  
  //--- check for rates total
  if(rates_total <= DATA_LIMIT)
    return(0);
    
  //--- last counted bar will be recounted
  limit = rates_total - prev_calculated;
  
  if(prev_calculated > 0)
    {
    limit++;
    }
    
  //--- price counted in the 2-nd additional buffer
  for(i=0; i<limit-1; i++)
    ExtPriceBuffer[i] = close[i];
                       
  //--- price counted in the 1-st additional buffer
  for(i=0; i<limit-1; i++)
    ExtEnvBuffer[i] = iEnvelopesOnArray(ExtPriceBuffer, 0, 5, MODE_SMA, 0, 1, MODE_UPPER, i);
  
  //--- done
  return(rates_total);
  }
  
//+------------------------------------------------------------------+
 

Hi all. I am getting errors during the test:

2014.12.25 18:04:31.125 2014.11.03 00:00 Test3 EURUSD,H4: invalid ticket for OrderModify function

2014.12.25 18:04:31.125 2014.11.03 00:00 Test3 EURUSD,H4: OrderModify error 4051

I double-checked it many times, there is no error (as far as I think).

Failure occurs in this part of program:

ModifyBuy, ModifySell, SelectBuy, SelectSell - have type bool

SendBuy, SendSell-int , int TP = 30


while(true)

 {

  

  SPREAD=MarketInfo(Symb,MODE_SPREAD);

  SelectBuy=OrderSelect(OrderTicketBuy,SELECT_BY_TICKET);//buy

  RefreshRates();

  if(NormalizeDouble(OrderOpenPrice()+TP*Point,Digits)<NormalizeDouble(Ask,Digits))

  {

  ModifyBuy=OrderModify(OrderTicket(),OrderOpenPrice(),Bid-(10-SPREAD)*Point,Bid+(30- SPREAD)*Point,0,0); 

  R=1;

  break;

  }//if2

    

  Timen=OrderCloseTime();

  if(Timen>0)

  {

  //--------------------------  

    Stop=StopLevel(Symb);

   StopLong();//значение Long2

   StopLoss_Func();//значение SL

//--------------------------  

   SendBuy=OrderSend(Symb,OP_BUYSTOP,Lote,Ask+Long2*Point,1,Bid-SL*Point,NULL);

   for(i=1;i>OrdersTotal();i++)

  {

   if(OrderSelect(i-1,SELECT_BY_POS,MODE_TRADES)==true)//Проверяем есть ли ордер

    {

     if(OrderSymbol()!=Symb) continue;     

     if(OrderType()==4)

      {

      OrderTicketBuy=OrderTicket();

      break;

      }

      else

      {

      continue;

      } 

     }

    }   

    continue;  

  }//if2

  

  SelectSell=OrderSelect(OrderTicketSell,SELECT_BY_TICKET,MODE_TRADES);//sell

  RefreshRates();

  if(NormalizeDouble(OrderOpenPrice()-TP*Point,Digits)>NormalizeDouble(Bid,Digits))

  {

   

   ModifySell=OrderModify(OrderTicket(),OrderOpenPrice(),Ask+(10-SPREAD)*Point,Ask-(30- SPREAD)*Point,0,0);

   R=2;

   break; //спред

  }//if2

  

   Timen=OrderCloseTime();

  if(Timen>0)

  {

 //--------------------------  

    Stop=StopLevel(Symb);

   StopLong();

   StopLoss_Func();

//--------------------------  

   SendSell=OrderSend(Symb,OP_SELLSTOP,Lote,Bid-Long2*Point,1,Ask+SL*Point,NULL);

    for(i=1;i>OrdersTotal();i++)

  {

   if(OrderSelect(i-1,SELECT_BY_POS,MODE_TRADES)==true)//Проверяем есть ли ордер

    {

     if(OrderSymbol()!=Symb) continue;     

     if(OrderType()==6)

      {

      OrderTicketSell=OrderTicket();

      break;

      }

      else

      {

      continue;

      } 

     }

    }   

    continue; 

  }//if2

}//while1



If you need the whole code, here


Files:
test3_1.mq4  15 kb
 
Gentlemen! Can you tell me the code that will stop testing an EA when there is not enough margin to open a position?
Thank you!
 


Hello, could you help me please - I have a problem: Robot enters a position and on the next tick it modifies its stop-loss to the previous low and I need that stop-loss is modified only when the candle closes on which the position was opened

void TrailingStop()
{  
  for(int i=0;i<OrdersTotal();i++)
  {
  if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true);
    {
    if (OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
      {  
      if (OrderType()==OP_BUY)             
        {              
            double LOW_1 = iLow(NULL,0,1);       
            bool res=OrderModify(OrderTicket(),OrderOpenPrice(),LOW_1,OrderTakeProfit(),0,White);                
            if(!res)  Print("Ошибка модификации ордера. Код ошибки=",GetLastError());         
        }               
       if (OrderType()==OP_SELL)              
        {                  
            double HIGH_1 = iHigh(NULL,0,1);                    
            res=OrderModify(OrderTicket(),OrderOpenPrice(),HIGH_1,OrderTakeProfit(),0,White);                
            if(!res)  Print("Ошибка модификации ордера. Код ошибки=",GetLastError());          
        }                      
      }
    } 
  }     
 return;                   
}