Hello, in mt4 android for tablet need to download the terminal for each server separately ? login as on pc via file login is not possible ? Also, do you know if autoclick can be installed on an android tablet to trade in mt4 ?
Good afternoon! I can't get this condition to work:
OrderCloseTime()!=hour()
I want no more than one order to be opened in an hour!
But all the same orders are opened! What can it be?
First of all: OrderCloseTime() - this is the time of order closing. If the order is not closed, it is equal to zero. You need to look at the time of opening.
Secondly: Hour() - this is the hour of start of the EA, and this hour does not change during the execution of the program. You need to compare it with the time of the last quote arrival - TimeCurrent()
This function returns the number of seconds after the last position of the current symbol was opened:
//+----------------------------------------------------------------------------+datetime SecondsAfterOpenLastPos(int op, int mn) {
datetime t=0;
int i, k=OrdersTotal();
for (i=0; i<k; i++) {
if (OrderSelect(i, SELECT_BY_POS)) {
if (OrderSymbol()!=Symbol()) continue;
if (OrderType()!=op) continue;
if (OrderMagicNumber()!=mn) continue;
if (t<OrderOpenTime()) t=OrderOpenTime();
}
}
return(TimeCurrent()-t);
}
//+----------------------------------------------------------------------------+
I.e., to check the number of seconds after the opening of the last Buy position with Magic, you need
if (SecondsAfterOpenLastPos(OP_BUY, Magic)>3600) {
// Можно открывать следующий
}
Hello, when you open the terminal again, after the weekend, all the charts, including the working charts with EAs, disappeared on a cent account. Instead of the chart there is a grey field, although the open positions, balance and funds were saved at the bottom. I had to re-download the terminal and re-install working charts with Expert Advisors. After that everything was OK. Please tell me what it is about and how can I eliminate this problem in the future in the most painless way?
First: OrderCloseTime() is the time to close the order. If the order is not closed, it is equal to zero. You need to watch the open time.
Second: Hour() - this is the hour of start of the Expert Advisor, and this hour does not change during the execution of the program. You need to compare it with the time of the last quote arrival - TimeCurrent()
This function returns the number of seconds after the last position of the current symbol was opened:
//+----------------------------------------------------------------------------+datetime SecondsAfterOpenLastPos(int op, int mn) {
datetime t=0;
int i, k=OrdersTotal();
for (i=0; i<k; i++) {
if (OrderSelect(i, SELECT_BY_POS)) {
if (OrderSymbol()!=Symbol()) continue;
if (OrderType()!=op) continue;
if (OrderMagicNumber()!=mn) continue;
if (t<OrderOpenTime()) t=OrderOpenTime();
}
}
return(TimeCurrent()-t);
}
//+----------------------------------------------------------------------------+
I.e., to check the number of seconds after the opening of the last Buy position with Magic, you need
if (SecondsAfterOpenLastPos(OP_BUY, Magic)>3600) {
// Можно открывать следующий
}
thank you for the function! don't you have another one?! so that only one order is opened per bar?!
lowech: thank you for the feature! don't you have another one?! so that only one order opens per bar?!
//+----------------------------------------------------------------------------+datetime BarsAfterOpenLastPos(int op, int mn) {
datetime t=0;
int i, k=OrdersTotal();
for (i=0; i<k; i++) {
if (OrderSelect(i, SELECT_BY_POS)) {
if (OrderSymbol()!=Symbol()) continue;
if (OrderType()!=op) continue;
if (OrderMagicNumber()!=mn) continue;
if (t<OrderOpenTime()) t=OrderOpenTime();
}
}
return((TimeCurrent()-t)/60/Period());
}
//+----------------------------------------------------------------------------+
//+----------------------------------------------------------------------------+datetime BarsAfterOpenLastPos(int op, int mn) {
datetime t=0;
int i, k=OrdersTotal();
for (i=0; i<k; i++) {
if (OrderSelect(i, SELECT_BY_POS)) {
if (OrderSymbol()!=Symbol()) continue;
if (OrderType()!=op) continue;
if (OrderMagicNumber()!=mn) continue;
if (t<OrderOpenTime()) t=OrderOpenTime();
}
}
return((TimeCurrent()-t)/60/Period());
}
//+----------------------------------------------------------------------------+
Maybe so:
Other thoughts don't come...
You're reading between the lines. Anyway, look at what you put in the loop in the first place. The loop's action area...
Good afternoon! I can't get this condition to work:
OrderCloseTime()!=hour()
I want no more than one order to be opened in an hour!
All the same orders are opened!
Good afternoon! I can't get this condition to work:
OrderCloseTime()!=hour()
I want no more than one order to be opened in an hour!
But all the same orders are opened! What can it be?
First of all: OrderCloseTime() - this is the time of order closing. If the order is not closed, it is equal to zero. You need to look at the time of opening.
Secondly: Hour() - this is the hour of start of the EA, and this hour does not change during the execution of the program. You need to compare it with the time of the last quote arrival - TimeCurrent()
This function returns the number of seconds after the last position of the current symbol was opened:
I.e., to check the number of seconds after the opening of the last Buy position with Magic, you need
First: OrderCloseTime() is the time to close the order. If the order is not closed, it is equal to zero. You need to watch the open time.
Second: Hour() - this is the hour of start of the Expert Advisor, and this hour does not change during the execution of the program. You need to compare it with the time of the last quote arrival - TimeCurrent()
This function returns the number of seconds after the last position of the current symbol was opened:
I.e., to check the number of seconds after the opening of the last Buy position with Magic, you need
thank you for the function! don't you have another one?! so that only one order is opened per bar?!thank you for the feature! don't you have another one?! so that only one order opens per bar?!
same thing, only check for the number of bars, not seconds
same thing, only check for number of bars, not seconds
It works! But when i close an order by TP, a new one will open right away!
same thing, only check for the number of bars, not seconds
it works! But when an order closes on TP, a new one opens instantly! How can we fix it?
So we need to do another check: for the number of bars after the last order was closed: