Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1380

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I assume that if the current bar has an index with its own time, then this combination will never change.
Or is it possible that as a result of history paging this index will be assigned to some historical bar and the current bar will get a new index, larger by the number of paged bars?
Also in other words:
is it correct to understand that the current bar becomes available (index, price and time) only after a full history swap and its parameters never change thereafter?
Please tell me how to get the number of rows in a MySQL table
Returns an error
Get last ID
also try this, can't get number of rows
What's wrong, why can't I get a value from the query?
If I check the query against the database, it returns as is
Right
int id= DatabaseRead(request);
Database is a bool , and id is int
How do I get the query result out?
It worked. I created an extra sql class
Several seconds elapse between unloading the indicator and calling DeInit.
Why is there a pause and can it be avoided?
I am using this block, taken from the documentation (both tp and sl)
//+------------------------------------------------------------------+
void Open_order_BUY()
{
double bid = SymbolInfoDouble(Symbol(),SYMBOL_BID),
ask = SymbolInfoDouble(Symbol(),SYMBOL_ASK);
//--- объявление и инициализация запроса и результата
MqlTradeRequest request={};
MqlTradeResult result={};
//--- параметры запроса
request.action =TRADE_ACTION_DEAL; // тип торговой операции
request.symbol =Symbol(); // символ
request.volume =0.01; // объем в 0.1 лот
request.type =ORDER_TYPE_BUY; // тип ордера
request.price =SymbolInfoDouble(Symbol(),SYMBOL_ASK); // цена для открытия
request.sl =bid-SL*SymbolInfoDouble(Symbol(),SYMBOL_POINT); // SL
request.tp =ask+TP*SymbolInfoDouble(Symbol(),SYMBOL_POINT); // TP
request.deviation=5; // допустимое отклонение от цены
request.magic =EXPERT_MAGIC; // MagicNumber ордера
//--- отправка запроса
if(!OrderSend(request,result))
PrintFormat("OrderSend error %d",GetLastError()); // если отправить запрос не удалось, вывести код ошибки
//--- информация об операции
PrintFormat("retcode=%u deal=%I64u order=%I64u",result.retcode,result.deal,result.order);
}
//+------------------------------------------------------------------+
void Open_order_SELL()
{
double bid = SymbolInfoDouble(Symbol(),SYMBOL_BID),
ask = SymbolInfoDouble(Symbol(),SYMBOL_ASK);
//--- объявление и инициализация запроса и результата
MqlTradeRequest request={};
MqlTradeResult result={};
//--- параметры запроса
request.action =TRADE_ACTION_DEAL; // тип торговой операции
request.symbol =Symbol(); // символ
request.volume =0.01; // объем в 0.2 лот
request.type =ORDER_TYPE_SELL; // тип ордера
request.price =SymbolInfoDouble(Symbol(),SYMBOL_BID); // цена для открытия
request.sl =ask+SL*SymbolInfoDouble(Symbol(),SYMBOL_POINT); // SL
request.tp =bid-TP*SymbolInfoDouble(Symbol(),SYMBOL_POINT); // TP
request.deviation=5; // допустимое отклонение от цены
request.magic =EXPERT_MAGIC; // MagicNumber ордера
//--- отправка запроса
if(!OrderSend(request,result))
PrintFormat("OrderSend error %d",GetLastError()); // если отправить запрос не удалось, вывести код ошибки
//--- информация об операции
PrintFormat("retcode=%u deal=%I64u order=%I64u",result.retcode,result.deal,result.order);
}
An order opens on every tick. How can I fix to have only one order open?
I am using this block, taken from documentation (both tp and sl)
//+------------------------------------------------------------------+
void Open_order_BUY()
{
double bid = SymbolInfoDouble(Symbol(),SYMBOL_BID),
ask = SymbolInfoDouble(Symbol(),SYMBOL_ASK);
//--- объявление и инициализация запроса и результата
MqlTradeRequest request={};
MqlTradeResult result={};
//--- параметры запроса
request.action =TRADE_ACTION_DEAL; // тип торговой операции
request.symbol =Symbol(); // символ
request.volume =0.01; // объем в 0.1 лот
request.type =ORDER_TYPE_BUY; // тип ордера
request.price =SymbolInfoDouble(Symbol(),SYMBOL_ASK); // цена для открытия
request.sl =bid-SL*SymbolInfoDouble(Symbol(),SYMBOL_POINT); // SL
request.tp =ask+TP*SymbolInfoDouble(Symbol(),SYMBOL_POINT); // TP
request.deviation=5; // допустимое отклонение от цены
request.magic =EXPERT_MAGIC; // MagicNumber ордера
//--- отправка запроса
if(!OrderSend(request,result))
PrintFormat("OrderSend error %d",GetLastError()); // если отправить запрос не удалось, вывести код ошибки
//--- информация об операции
PrintFormat("retcode=%u deal=%I64u order=%I64u",result.retcode,result.deal,result.order);
}
//+------------------------------------------------------------------+
void Open_order_SELL()
{
double bid = SymbolInfoDouble(Symbol(),SYMBOL_BID),
ask = SymbolInfoDouble(Symbol(),SYMBOL_ASK);
//--- объявление и инициализация запроса и результата
MqlTradeRequest request={};
MqlTradeResult result={};
//--- параметры запроса
request.action =TRADE_ACTION_DEAL; // тип торговой операции
request.symbol =Symbol(); // символ
request.volume =0.01; // объем в 0.2 лот
request.type =ORDER_TYPE_SELL; // тип ордера
request.price =SymbolInfoDouble(Symbol(),SYMBOL_BID); // цена для открытия
request.sl =ask+SL*SymbolInfoDouble(Symbol(),SYMBOL_POINT); // SL
request.tp =bid-TP*SymbolInfoDouble(Symbol(),SYMBOL_POINT); // TP
request.deviation=5; // допустимое отклонение от цены
request.magic =EXPERT_MAGIC; // MagicNumber ордера
//--- отправка запроса
if(!OrderSend(request,result))
PrintFormat("OrderSend error %d",GetLastError()); // если отправить запрос не удалось, вывести код ошибки
//--- информация об операции
PrintFormat("retcode=%u deal=%I64u order=%I64u",result.retcode,result.deal,result.order);
}
Resolved.
How do I extend the line to the right? Further than the current bar.
There are time and price coordinates. The price is clear, but how to set the time (I tried iTime(Symbol(), PERIOD_CURRENT, 0), but its index is zero)
How do I extend the line to the right? Further than the current bar.
There are time and price coordinates. I understand the price, but how to set the time (I tried iTime(Symbol(), PERIOD_CURRENT, 0), but its index is zero)
Good afternoon.
Here's a question:
I am writing an indicator that draws zones with DRAW_FILLING drawing style. There are several other indicators, including a lot of muwings, on the chart in addition to the drawn zone. When a zone is drawn, the lines of other indicators sharply change their colours.
The question: can we draw the zones in MT5 in such a way, that their colour does not overlap and does not change the colours of lines of other indicators?
P.S. I dug all properties of indicator buffers (methods like PlotIndexSetInteger), there is nothing similar.
P.S2. attached is a screenshot from MT5.
Good afternoon.
Here's a question:
I am writing an indicator that draws zones with DRAW_FILLING drawing style. There are several other indicators, including a lot of muwings, on the chart in addition to the drawn zone. When a zone is drawn, the lines of other indicators sharply change their colours.
The question: can we draw the zones in MT5 in such a way, that their colour does not overlap and does not change the colours of lines of other indicators?
P.S. I dug all properties of indicator buffers (methods like PlotIndexSetInteger), there is nothing similar.
P.S2. Here is a screenshot from MT5.
It all depends on the overlap sequence, who is last is on top
Define buffer withDRAW_FILLING first