what is better to do in the indicator, to start a timer 1s or in OnCalculate to compare time (seconds)
it is not important where to do it, the only thing that OnCalculate is related to ticks - there will be no tick and therefore there will be no OnCalculate call
How can I compare the current chart symbol with the one I need?
case1 : // кейс для открытия Buy по AUD/USDif(Symbol() == (как обозначить нужный символ для сравнения?)) // если символ текущего графика AUD/USD открываем сделку
{
RefreshRates();
Open_Order = OrderSend("AUDUSD",OP_BUY,Lot(),Ask,0,0,0); // Открытие ордера//----------------------------------------------------------------------------------------------------
В тоже время советник запущен на другом графике и пытается произвести открытие ордера, цены не совпадают и соответственно вылетает ошибка - неверные цены
case2 : // кейс для открытия Bay по GBP/USD if(Symbol() == (как обозначить нужный символ для сравнения?))
// если символ текущего графика не AUDUSD то выходим
{
RefreshRates();
Open_Order = OrderSend("GBPUSD",OP_SELL,Lot(),Bid,0,0,0); // Открытие ордера
Т.е. надо ему дать понять, что тот или иной кейс принадлежит тому или другому графику, но чтот я пока не придумал как
I need the program to open an order on AUD/USD, so it opens the order (it works properly). However, the program tries to open the order on other open charts(the robot is running on several currency pairs) and it returns a price error for the other currency pairs where the Expert Advisor is running. I have to make a comparison and if Symbol() == is equal to the symbol on which the order should be opened, then we open it and if not, we exit. I haven't found anywhere how to set the symbol name from the terminal and make the comparison.
How can I compare the current chart symbol with the one I need?
I need the program to open an order on AUD/USD, so it opens the order (it works properly). However, the program tries to open the order on other open charts(the robot is running on several currency pairs) and it returns a price error for the other currency pairs where the Expert Advisor is running. I have to make a comparison and if Symbol() == is equal to the symbol on which the order should be opened, then we open it and if not, we exit. I haven't found anywhere how to set the symbol name from the terminal and make comparison.
There is an example of getting the right prices at the end.
2. Возвращает true или false в зависимости от успешности выполнения функции. В случае успеха значение свойства помещается в приемную переменную, передаваемую по ссылке последним параметром. Если функция используется для получения информации о последнем тике, то лучше использовать SymbolInfoTick(). Вполне возможно, что по данному символу с...
Thank you, but I don't need the right prices. The prices are fine. I need the EA not to open an order if the currency pair at which the order is opened is not the same as the current open chart to which the robot is attached. Maybe we may implement this by opening a new chart with a timeframe, open a desired order in it and then close the chart.
My program accesses the current chart, assigns to it the name of the current instrument and seals it into a variable, then compares the value of this variable to the current symbol on the chart. It actually compares it to itself)))) I need to somehow convert Sympol() to any value with which any other variable can be compared. For example:
My program accesses the current chart, assigns it the name of the current instrument and seals it into a variable, then compares the value of this variable to the current symbol on the chart. It actually compares it to itself)))) I need to somehow convert Sympol() to any value with which any other variable can be compared. For example:
AUDUSD;
(Symbol() == AUDUSD)
I've managed it somehow, until I was happy and changed everything correctly - nothing works))
My program accesses the current chart, assigns it the name of the current instrument and seals it into a variable, then compares the value of this variable to the current symbol on the chart. It actually compares it to itself)))) I need to somehow convert Sympol() to any value with which any other variable can be compared. For example:
AUDUSD;
(Symbol() == AUDUSD)
I did it somehow, and while I was rejoicing and changing everything, nothing worked anymore))
The Expert Advisor, the script, the indicator do not apply, but work in the current window. And global variables of different windows / charts do not overlap. Therefore, it should work)
string AUDUSD; // This is a text variable, which is initially empty, i.e. equals ""
(Symbol() == AUDUSD) // this string has nothing to do with variable AUDUSD.
Symbol
Возвращает имя символа текущего графика.
stringSymbol();
Возвращаемое значение
Значение системной переменной _Symbol, в которой хранится имя символа текущего графика.
But the order opening criteria should not be the same for different instruments/windows. If they are the same, they will indeed open in all windows.
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.
I don't have the slightest desire to google or read, so I opened file D:\1.txt
What is the best way to do it in the indicator, to start timer 1s or in OnCalculate to compare time (seconds)
<1sec, exit
or there are other working options?
need to update HistorySelect for the month + work with objects
or in OnCalculate compare time (seconds)
<1sec, output
seconds is not enough. The problem is with datetime - it can't be less than a second.
compare at least milliseconds
what is better to do in the indicator, to start a timer 1s or in OnCalculate to compare time (seconds)
it is not important where to do it, the only thing that OnCalculate is related to ticks - there will be no tick and therefore there will be no OnCalculate call
you need to update HistorySelect for a month + work with objects
HistorySelect is fast, but when you go to move or create objects, there may be lags, if objects over 1000 +
and you will be modifying these objects every second
(enter your code and the pitfalls will pop up ))))
a second is enough for me and less often until the tick comes
for me to display trades on the chart + result of the trade over bars, and some semi-static information such as the global trend
can price watch the change from
or time from the second option
Please tell me!
How can I compare the current chart symbol with the one I need?
I need the program to open an order on AUD/USD, so it opens the order (it works properly). However, the program tries to open the order on other open charts(the robot is running on several currency pairs) and it returns a price error for the other currency pairs where the Expert Advisor is running. I have to make a comparison and if Symbol() == is equal to the symbol on which the order should be opened, then we open it and if not, we exit. I haven't found anywhere how to set the symbol name from the terminal and make the comparison.
Please tell me!
How can I compare the current chart symbol with the one I need?
I need the program to open an order on AUD/USD, so it opens the order (it works properly). However, the program tries to open the order on other open charts(the robot is running on several currency pairs) and it returns a price error for the other currency pairs where the Expert Advisor is running. I have to make a comparison and if Symbol() == is equal to the symbol on which the order should be opened, then we open it and if not, we exit. I haven't found anywhere how to set the symbol name from the terminal and make comparison.
There is an example of getting the right prices at the end.
Thank you, but I don't need the right prices. The prices are fine. I need the EA not to open an order if the currency pair at which the order is opened is not the same as the current open chart to which the robot is attached. Maybe we may implement this by opening a new chart with a timeframe, open a desired order in it and then close the chart.
No, it doesn't work that way.
My program accesses the current chart, assigns to it the name of the current instrument and seals it into a variable, then compares the value of this variable to the current symbol on the chart. It actually compares it to itself)))) I need to somehow convert Sympol() to any value with which any other variable can be compared. For example:
AUDUSD;
(Symbol() == AUDUSD)
I've somehow managed to do it - while I was rejoicing and changing everything correctly - nothing works anymore))
No, it doesn't work that way.
My program accesses the current chart, assigns it the name of the current instrument and seals it into a variable, then compares the value of this variable to the current symbol on the chart. It actually compares it to itself)))) I need to somehow convert Sympol() to any value with which any other variable can be compared. For example:
AUDUSD;
(Symbol() == AUDUSD)
I've managed it somehow, until I was happy and changed everything correctly - nothing works))
string AUDUSD = "AUDUSD";
At least like this.
No, it doesn't work that way.
My program accesses the current chart, assigns it the name of the current instrument and seals it into a variable, then compares the value of this variable to the current symbol on the chart. It actually compares it to itself)))) I need to somehow convert Sympol() to any value with which any other variable can be compared. For example:
AUDUSD;
(Symbol() == AUDUSD)
I did it somehow, and while I was rejoicing and changing everything, nothing worked anymore))
The Expert Advisor, the script, the indicator do not apply, but work in the current window. And global variables of different windows / charts do not overlap. Therefore, it should work)
string AUDUSD; // This is a text variable, which is initially empty, i.e. equals ""
(Symbol() == AUDUSD) // this string has nothing to do with variable AUDUSD.
But the order opening criteria should not be the same for different instruments/windows. If they are the same, they will indeed open in all windows.