Questions from Beginners MQL5 MT5 MetaTrader 5 - page 298

 
pako:

poll the buffer, for example like this

Doesn't work. No matter what buffer number you set, only the last calculated extremum is written anyway(
 
mavar:

How can I see the bollinger on the chart exactly in the parameters that are in the code? where are the required indicator parameters configured.


The bollinger is running, but it reads some wrong values.

I mean I can build a chart starting from high or low, along the exponent, etc. How to regulate it in the code and see it on a chart to visually control the EA?

When I run Metatrader5, indicators that are used in the strategy tester are drawn automatically.
 
LBatters:
In metatrader5 when I run my EA, in the strategy tester, the indicators that you use are drawn.

I don't have them drawn! What am I doing wrong?

Here is my code:


//+------------------------------------------------------------------+
//|                                                         test.mq5 |
//|                                                           Andrey |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Andrey"
#property link      "http://www.mql5.com"
#property version   "1.00"

int BolBandsHandle;                // хэндл индикатора Bolinger Bands
double BBUp[],BBLow[],BBMidle[];   // динамические массивы для хранения численных значений Bollinger Bands
//--- входные параметры
input int bands_period= 20;        // Период Bollinger Bands
input int dema_period= 20;         // Период DEMA
input int bands_shift = 0;         // Смещение относительно графика
input double deviation= 2;         // Стандартное отклонение
int demaHandle;                    // хэндл индикатора DEMA

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   printf("test string");
   
     //---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   printf("test string3");
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---

//Переменная типа MqlTick позволяет за один вызов функции SymbolInfoTick() получить значения time, Ask, Bid, Last и Volume.
      MqlTick last_tick;
      //---
      if(SymbolInfoTick(Symbol(),last_tick))
        {
         Print(last_tick.time,": Bid = ",last_tick.bid,
               " Ask = ",last_tick.ask,"  Volume = ",last_tick.volume, "  LastPrice = ",last_tick.last );
        }
      else Print("SymbolInfoTick() failed, error = ",GetLastError());
      //---
      
        //---Читаем свечку
   MqlRates rates[];
   ArraySetAsSeries(rates,true);
   int copied=CopyRates(Symbol(),0,0,1,rates);
   if(copied>0)
     {
      //Print("Скопировано баров: "+copied);
      string format="open = %G, high = %G, low = %G, close = %G, volume = %d";
      string out;
      int size=fmin(copied,10);
      for(int i=0;i<size;i++)
        {
         //out=i+":"+TimeToString(rates[i].time);
         out=out+" "+StringFormat(format,
                                  rates[i].open,
                                  rates[i].high,
                                  rates[i].low,
                                  rates[i].close,
                                  rates[i].tick_volume);
         Print(out);
         Print(rates[i].open - rates[i].close );
        }
     }
   else Print("Не удалось получить исторические данные по символу ",Symbol());

//---=======-----\_____BOLLINGER____/--------========--//
//--- получить хэндл индикатора Bollinger Bands и DEMA
   BolBandsHandle=iBands(NULL,PERIOD_M30,bands_period,bands_shift,deviation,PRICE_CLOSE);
   demaHandle=iDEMA(NULL,PERIOD_D1,dema_period,0,PRICE_CLOSE);
   
//--- копируем новые значения индикаторов используя хэндлы
   if(CopyBuffer(BolBandsHandle,0,0,3,BBMidle)<0 || CopyBuffer(BolBandsHandle,1,0,3,BBUp)<0
      || CopyBuffer(BolBandsHandle,2,0,3,BBLow)<0)
     {
      Alert("Ошибка копирования буферов индикатора Bollinger Bands - номер ошибки:",GetLastError(),"!!");
      return;
     }
//********** это цикл надо добавить в код советника, выводит значения при наступлении нового бара
   for(int nbar=0; nbar < 1; nbar++)
     Print("nbar=", nbar, "  BBLow[nbar]=", DoubleToString(BBLow[nbar], _Digits), "  BBMidle[nbar]", DoubleToString(BBMidle[nbar], _Digits),
                    "  BBUp[nbar]=", DoubleToString(BBUp[nbar], _Digits));

  }
//+------------------------------------------------------------------+
//| BookEvent function                                               |
//+------------------------------------------------------------------+
void OnBookEvent(const string &symbol)
  {
//---
   printf("test string 1 ");
 
   
  }
//+------------------------------------------------------------------+


 
C-4:
The last championship organised by MetaQuotes was in 2012. There are no such championships now. But many brokers still hold their own championships. You can take part in them.
This is a good site, I take part in it myself. In most of them EAs are banned, but there are some with EAs and even free ones with prize. _http://contestsarena.com/xm/ru#/login/
 
LBatters:
It doesn't work. It doesn't matter what buffer number you set, it still says only the last extremum calculated(
That's what it says, the last extremum
 

how do I get the EA to draw bollinger lines on startup?

I have (code above) outputs some bollinger values, but need to observe the parameters visually.

 

Help!!!

I downloaded and installed metatrader 4 build 711

I downloaded and installeddemo account on InstaForex-Demo.com

I cannot subscribe to free signals neither through the terminal nor through the website

I have entered the password and login into"Community" tab in the terminal

balance shows

I have connection

in terminal:

2014.10.15 23:35:16.541 Virtual Hosting: failed to connect to server 'www.mql5.com' (www.mql5.com:443 failed)


2014.10.15 23:08:20.101 MQL5.community: authorization failed

2014.10.15 23:08:01.847 Signal: '61447950': failed getting list of signals,connection error
2014.10.15 23:03:19.887 MQL5.community: authorization failed
2014.10.15 23:03:01.696 Signal: '61447950': failed to get list of signals,connection error

Please help to understand...

 
xscanerx:

H 2014.10.15 23:08:20.101 MQL5.community: authorisation failed

This indicates an incorrect password. Possible errors - you insert a space; you miss the "_" sign; you mix up the case when you enter it.
 
Can you tell me how to make an EA increase the lot in an already open position? MQL5. Thanks already.
 
ArkFatalist:
Can you tell me how to make an EA increase the lot in an already open position? MQL5. Thanks already.
Open an additional position with a lot equal to the increase and with the same direction as the already open position. MT5 will merge both positions into one cumulative position by itself.