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));
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.
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.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
poll the buffer, for example like this
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?
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 ");
}
//+------------------------------------------------------------------+
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.
It doesn't work. It doesn't matter what buffer number you set, it still says only the last extremum calculated(
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
Please help to understand...
H 2014.10.15 23:08:20.101 MQL5.community: authorisation failed
Can you tell me how to make an EA increase the lot in an already open position? MQL5. Thanks already.