Please advise how to organise or which way to look:
Here, in order not to perform the calculation of bars, buffers were invented. With every new tick only the last bar is checked (as I understand it). When a new bar appears, calculation will start with this bar only.
Thanks to the buffer, the lines are not re-drawn on the whole history, but an additional segment is added to the last edge. There are 8 buffers in total.
What if I need to do a calculation a hundred times (let's say 100 times to draw a line, changing only one variable), and then draw the best result. And at a new tick or timer do the same thing, but with the existing "history" of results (drawings). Where and how do I store this information, so that I don't have to recalculate the entire history?
Or, more simply, how to increase the number of buffers in the indicator? Perhaps write them separately to a file? What is better
Please advise how to organise or which way to look:
Here, in order not to perform the calculation of bars, buffers were invented. With every new tick only the last bar is checked (as I understand it). When a new bar appears, calculation will start with this bar only.
Thanks to the buffer, the lines are not re-drawn on the whole history, but an additional segment is added to the last edge. There are 8 buffers in total.
What if I need to do a calculation a hundred times (let's say 100 times to draw a line, changing only one variable), and then draw the best result. And at a new tick or timer do the same thing, but with the existing "history" of results (drawings). Where and how do I store this information, so that I don't have to perform these calculations over the entire history?
Or, to put it more simply, how do I increase the number of buffers in an indicator? Maybe write separately to a file? What is the best way to
Please explain what his mistakes are. Can you briefly summarise what to pay attention to? And, if the code works, what would be its "bugs"?
//+------------------------------------------------------------------+//| Функция IsMainPendingOrder (установлен отложенный ордер): |//| возвращает истину, если в советнике не установлен отложенный |//| ордер, в противном случае возвращает ложь. |//| Применим для функции тип данных bool, чтобы хранить |//| логические значения true (истина) или false (ложь). |//+------------------------------------------------------------------+bool IsMainPendingOrder()
{
int orders_total=OrdersTotal(); // количество установленных отложенных ордеров//--- перебираем все установленные отложенные ордераfor(int i=orders_total-1; i>=0; i--)
{
ulong order_ticket=OrderGetTicket(i); // тикет ордера/* если отложенного ордера нет, значит и у нашего советника отложенного ордера нет */if(OrderSelect(i)==false)
returntrue; // поэтому возвращаем значение истинаelse// в противном случаеreturnfalse; // возвращаем значение ложь
}
/* если отложенный ордер уже есть и его мэджик совпадает с мэджиком нашего советника */if(OrderGetInteger(ORDER_MAGIC)==Magic_Number)returntrue; // то возвращаем истину/* в противном случае, если отложенный ордер уже есть, но его мэджик не совпадает с мэджиком нашего советника */elsereturnfalse; // значит это чужой ордер, поэтому возвращаем значение ложь
From the documentation... the inbox should have a ticket, not an index
boolOrderSelect(
ulong ticket // тикет ордера
);
If there are several orders for different symbols and the one we are looking for is the second in the list, we will not find it. Or there is only one magik, but we need to find it by another symbol, we will get an incorrect answer from the function...
from the documentation... the inbox should have a ticket, not an index
Thanks Alexey for the tip! Very bad influence on me from sitting at the computer at night. I thought I started with the order ticket yesterday and had already written a line in the code:
//+------------------------------------------------------------------+//| Функция IsMainPendingOrder (установлен отложенный ордер): |//| возвращает истину, если установлен отложенный ордер, |//| в противном случае возвращает ложь. |//| Применим для функции тип данных bool, чтобы хранить |//| логические значения true (истина) или false (ложь). |//+------------------------------------------------------------------+bool IsMainPendingOrder()
{
int orders_total=OrdersTotal(); // количество установленных отложенных ордеров//--- перебираем все установленные отложенные ордераfor(int i=orders_total-1; i>=0; i--)
{
ulong order_ticket=OrderGetTicket(i); // тикет ордера/* если отложенного ордера нет, значит и у нашего советника отложенного ордера нет */if(order_ticket==0)
returnfalse; // поэтому возвращаем значение ложьelse// в противном случаеreturntrue; // возвращаем значение истина
}
/* если отложенный ордер уже есть и его мэджик совпадает с мэджиком нашего советника */if(OrderGetInteger(ORDER_MAGIC)==Magic_Number)
returntrue; // то возвращаем истину/* в противном случае, если отложенный ордер уже есть, но его мэджик не совпадает с мэджиком нашего советника */elsereturnfalse; // значит это чужой ордер, поэтому возвращаем значение ложь
}
I have not touched Magic yet because the code is intended for a one-character EA.
Thank you, Alexei, for the tip! Very bad influence on me from sitting in front of the computer at night. I thought I started with the order ticket yesterday and already wrote a line in the code:
and then "moved off" it.
Alexey, may this variant of code be acceptable?
I have not touched Magic yet because the code is intended for a one-character EA.
Sincerely, Vladimir.
This approach is not acceptable for me. Add a check for Magik and a symbol, two lines of code and you will get a normal approach to solving a task in return. And if you ignore my principles, the code is not quite right.
This is more logical.
//+------------------------------------------------------------------+//| Функция IsMainPendingOrder (установлен отложенный ордер): |//| возвращает истину, если установлен отложенный ордер, |//| в противном случае возвращает ложь. |//| Применим для функции тип данных bool, чтобы хранить |//| логические значения true (истина) или false (ложь). |//+------------------------------------------------------------------+bool IsMainPendingOrder()
{
int orders_total=OrdersTotal(); // количество установленных отложенных ордеров//--- перебираем все установленные отложенные ордераfor(int i=orders_total-1; i>=0; i--)
{
ulong order_ticket=OrderGetTicket(i); // тикет ордера/* если отложенный ордер есть */if(order_ticket > 0)
returntrue;// поэтому возвращаем истину
}
returnfalse;// если нет открытого отложенного ордера…
}
And in this code, all you have to do is replace the blank check
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.
Please advise how to organise or which way to look:
Here, in order not to perform the calculation of bars, buffers were invented. With every new tick only the last bar is checked (as I understand it). When a new bar appears, calculation will start with this bar only.
Thanks to the buffer, the lines are not re-drawn on the whole history, but an additional segment is added to the last edge. There are 8 buffers in total.
What if I need to do a calculation a hundred times (let's say 100 times to draw a line, changing only one variable), and then draw the best result. And at a new tick or timer do the same thing, but with the existing "history" of results (drawings). Where and how do I store this information, so that I don't have to recalculate the entire history?
Or, more simply, how to increase the number of buffers in the indicator? Perhaps write them separately to a file? What is betterPlease advise how to organise or which way to look:
Here, in order not to perform the calculation of bars, buffers were invented. With every new tick only the last bar is checked (as I understand it). When a new bar appears, calculation will start with this bar only.
Thanks to the buffer, the lines are not re-drawn on the whole history, but an additional segment is added to the last edge. There are 8 buffers in total.
What if I need to do a calculation a hundred times (let's say 100 times to draw a line, changing only one variable), and then draw the best result. And at a new tick or timer do the same thing, but with the existing "history" of results (drawings). Where and how do I store this information, so that I don't have to perform these calculations over the entire history?
Or, to put it more simply, how do I increase the number of buffers in an indicator? Maybe write separately to a file? What is the best way toThe indicators have 512 buffers.
There are 512 buffers in the indicators.
Oh, wow. Thank you. I must have been looking in the wrong place. I'll keep trying.
ERROR FOUND BY MYSELF!!!
Here's a normally working code. May be useful for someone. Regards, Vladimir.
It won't be useful for anybody. There are gross errors in your code. And there is no sense in correcting them.
You don't even bother to learn the basics of the language and try to write something.
Either take it seriously or give it up.
No one can use it. There are gross errors in your code. And there is no point in correcting them.
You don't even bother to learn the basics of the language, and you're trying to write something.
Either get serious or give it up.
Any questions from newbies on MQL4 and MQL5, help and discussion on algorithms and codes
and wait for help here.
Regards, Vladimir.
Good morning! Yes, you are absolutely right. You need to quit this pointless business, which is to apply to the
Any questions from newbies on MQL4 and MQL5, help and discussion on algorithms and codes
and wait here for help.
Sincerely, Vladimir.
You're right, give it up.
You didn't even understand what I wrote in Russian.
Why do you want to get into programming?
No one can use it. There are gross errors in your code. And there is no point in correcting them.
You don't even bother to learn the basics of the language, and you're trying to write something.
Either take it seriously or give it up.
Please explain what his mistakes are. Briefly, in a nutshell, what you should pay attention to. And if the code works, what are its "bugs"?
Please explain what his mistakes are. Can you briefly summarise what to pay attention to? And, if the code works, what would be its "bugs"?
From the documentation... the inbox should have a ticket, not an index
If there are several orders for different symbols and the one we are looking for is the second in the list, we will not find it. Or there is only one magik, but we need to find it by another symbol, we will get an incorrect answer from the function...
from the documentation... the inbox should have a ticket, not an index
Thanks Alexey for the tip! Very bad influence on me from sitting at the computer at night. I thought I started with the order ticket yesterday and had already written a line in the code:
and then "moved off" it.
Alexey, may this variant of code be acceptable?
I have not touched Magic yet because the code is intended for a one-character EA.
Regards, Vladimir.
Thank you, Alexei, for the tip! Very bad influence on me from sitting in front of the computer at night. I thought I started with the order ticket yesterday and already wrote a line in the code:
and then "moved off" it.
Alexey, may this variant of code be acceptable?
I have not touched Magic yet because the code is intended for a one-character EA.
Sincerely, Vladimir.
This approach is not acceptable for me. Add a check for Magik and a symbol, two lines of code and you will get a normal approach to solving a task in return. And if you ignore my principles, the code is not quite right.
This is more logical.
And in this code, all you have to do is replace the blank check
to check for a magician and a character
and it's already a more universal function...