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

 
Vladimirovits:
I have the entire visual studio project in my experts folder... Compile is an .exe file, right?

No, the compiled library is the ExpertSample.dll file
 
Forexman77:

The template was taken from a textbook. I'm not very good at error handling functions right now.

On order opening, there is RefreshRates(); (I replaced Bids and Asks via Market Info, as I was told)

And error handling function:

I wanted to ask. May I add the following line from 129 error to it?

129

ERR_INVALID_PRICE

Incorrect price


When you receive this error, you should review the Expert Advisor's logic. It is the Expert Advisor that sends an incorrect price in a trade order. And you have decided to bog down the server with an erroneous trade order?


The auto-trading will be switched off and that's it.

 
artmedia70:

129

ERR_INVALID_PRICE

Incorrect price


When you get this error, you need to review the logic of the EA. It is the Expert Advisor that sends the wrong price in the trade order. And you decided to bog down the server with an erroneous trade order?


Auto-trading will be disabled and that's it.

Looked through everything. Maybe when the Expert Advisor sends a request:

Ticket=OrderSend(Symb,OP_BUY,Lts,Ask,2,SL,TP);//Открытие Buy
does it remember what price to buy at?

And I had the following:

if  (iClose(Symbol(),Period(),0) <= MA_6_t) 
          {                                          
          Opn_B=true;                    
          }

if the bid is less than or equal to the MA, then we buy. We have been buying from the ask, so we are playing catch-up with the ask.

I had no problems with selling, only buying.

I found some info on this topic:

"If requested opening price was not in price stream or requested price was not normalized after decimal point, then error 129 (ERR_INVALID_PRICE) will be generated. If the requested opening price is severely out of date, an error 138 (ERR_REQUOTE) will be generated regardless of the value of the slippage parameter. If, on the other hand, the requested price is obsolete but is still present in the price flow, the position will be opened at the current price and only if the current price falls within the price+-slippage range."

If it's not bid and ask after all, then the trade should have gone through. I quote " If the requested price is out of date but still present in the price stream, then the position opens at the current price and only if the current price falls within the price+-slippage range." The price at hover was in the trading zone 100%. Close was well below the moving average.

 

Question for the Guru.

I can't get the indicator to render in some areas. The essence of the indicator, if the movement is not more than a certain value, the value remains as in the written value of MA_otshet.

When the value is exceeded, the value becomes, corresponding to the current moment.

Below is the code of the indicator with explanations:

//+------------------------------------------------------------------+
//|                                                         EMAF.mq4 |
//|                                                 Kamil Gazizullin |
//|                                             forexman77@yandex.ru |
//+------------------------------------------------------------------+
#property copyright "Kamil Gazizullin"
#property link      "forexman77@yandex.ru"
#property indicator_chart_window
#property indicator_buffers 1
#property  indicator_color1 Aqua 
//--- input parameters
//--- buffers
bool flag=true;
double ExtMapBuffer1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE,0,1);
   SetIndexBuffer(0,ExtMapBuffer1);
   IndicatorDigits(Digits+1);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----  
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
    int counted_bars=IndicatorCounted(),                      
    limit;
    double
    raznica,raznica_static,MA_1_t,MA_2_t;
    
  if(counted_bars>0)
      counted_bars--;
   limit=Bars-counted_bars;
   static double MA_otshet;  //здесь хранится информация по MA_otshet
  for(int i=0;i<limit;i++)
   {  
      MA_1_t=iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE,i+0);  
      MA_2_t=iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE,i+1); 
      raznica=MA_1_t-MA_2_t; //разница между сегодня и вчера по скользящей средней
      raznica_static=MA_1_t-MA_otshet; //разница между сегодня и MA_otshet
      RefreshRates();   
      if(raznica > -0.0035 && raznica < 0.0035 && flag) // если raznica не превышает заданное число 
          {
          MA_otshet=MA_2_t; // записываем значение MA_otshet
          ExtMapBuffer1[i]=MA_otshet; //рисуем значение индикатора, как и вчера
          flag=false; // устанавливаем флаг запрета дальнейших расчетов
          }
      if(raznica_static > -0.0035 && raznica_static < 0.0035) //если raznica_static не превышает заданное число
          {
          ExtMapBuffer1[i]=MA_otshet;  // то рисуем значение индикатора, как записанный MA_otshet
          }
      if((raznica > 0.0035) || (raznica <- 0.0035)) // если raznica превышает заданное число
          {
          ExtMapBuffer1[i]=MA_1_t; // то рисуем значение по текущей цене
          flag=true; // разрешаем дальнейшие вычисления для расчета в диапазоне от -0.0035 до 0.0035
          }
   }  
   return(0);
  }
//+------------------------------------------------------------------+

 
Forexman77:

The indicator does not get drawn in some areas. The essence of the indicator, if the movement is not more than a certain value, the value remains as in the recorded value of MA_otshet.

When the value is exceeded, the value becomes, corresponding to the current moment.

Below is the code and explanation of the indicator:


DRAW_SECTION

 
Forexman77:

I've looked through everything. Maybe when the EA sends a request:

Does it remember what price to buy at?

And I had the following:

i.e. the bid is less than or equal to the MA, then we buy. I have not had any problems with selling, but I have not had any problems with selling.

I had no problems with selling, only buying.

I found some info on this topic:

"If requested opening price was not in price stream or requested price was not normalized after decimal point, then error 129 (ERR_INVALID_PRICE) will be generated. If the requested opening price is severely out of date, an error 138 (ERR_REQUOTE) will be generated regardless of the value of the slippage parameter. If, on the other hand, the requested price is obsolete but is still present in the price flow, the position will be opened at the current price and only if the current price falls within the price+-slippage range."

If it's not bid and ask after all, then the trade should have gone through. I quote " If the requested price is out of date but still present in the price stream, then the position will open at the current price and only if the current price falls within the price+-slippage range." The price at hover was in the trading zone 100%. Kloz was well below the moving average.

Let's assume that Ask is always normalised is the price: it is not calculated and there is no point in normalising it.

So the price could be wrong why? Maybe the data is out of date? Try running RefreshRates() immediately before OrderSend().

 
Greetings, dear traders - programmers!!!
What is the meaning of AccountComany?
You can make certain conclusions from the name, but how does it relate to the MT4 programming language ???

AccountCredit?

AccountCurrency?

AccountEquity?

AccountFreeMargin?

AccountFreeMarginCheck?

AccountLeverage?

AccountStopoutLevel?

AccountStopoutMode?

ArrayBsearch?

I'm very interested to know the detailed description of each command. Please help me.

 

ArrayCopy?

ArrayCopyRates?

ArrayCopySeries?

ArrayDimension?

ArrayGetAsSeries?

 

What is an array rate?

 

What is an array rate?