Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 89
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
Isn't it time to merge all threads about MT4 into one?
Each author has his own branch. It's just that one author runs it and the other author doesn't and won't. It's just a place for those who want to help. Why would I want to shove my branch into a branch of an author who is not going to help me with mql4?
Hello.
Where can I find the language description for MT4?
Hello.
Where can I find the language description for MT4?
Hello.
Help me find the price of the last order.
This function finds the price of the oldest order and I need the youngest one.
What to change?
datetime t;
double r=0;
int i, k=OrdersTotal();
if (sy=="0") sy=Symbol();
for (i=0; i<k; i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol()==sy || sy=="") {
if (OrderType()>1 && OrderType()<6) {
if (op<0 || OrderType()==op) {
if (mn<0 || OrderMagicNumber()==mn) {
if (t<OrderOpenTime()) {
t=OrderOpenTime();
r=OrderOpenPrice();
}
}
}
}
}
}
}
return(r);
}
Hello.
Help me find the price of the last order.
This function finds the price of the oldest order and I need the youngest one.
What to change?
datetime t;
double r=0;
int i, k=OrdersTotal();
if (sy=="0") sy=Symbol();
for (i=0; i<k; i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol()==sy || sy=="") {
if (OrderType()>1 && OrderType()<6) {
if (op<0 || OrderType()==op) {
if (mn<0 || OrderMagicNumber()==mn) {
if (t<OrderOpenTime()) {
t=OrderOpenTime();
r=OrderOpenPrice();
}
}
}
}
}
}
}
return(r);
}
Hello.
Help me find the price of the last order.
This function finds the price of the oldest order and I need the youngest one.
What to change?
datetime t;
double r=0;
int i, k=OrdersTotal();
if (sy=="0") sy=Symbol();
for (i=0; i<k; i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol()==sy || sy=="") {
if (OrderType()>1 && OrderType()<6) {
if (op<0 || OrderType()==op) {
if (mn<0 || OrderMagicNumber()==mn) {
if (t<OrderOpenTime()) {
t=OrderOpenTime();
r=OrderOpenPrice();
}
}
}
}
}
}
}
return(r);
}
That's how it determines the price of the last order.
Well, it is the most recent, i.e. the newest
No, the function returns the sellstop price 1.07057 and I need the price of the fourteenth sellstop order 1.06637
No, the function returns the sellstop price 1.07057 and I need the price of the fourteenth sellstop order 1.06637
double r=-1;
if (sy=="0") sy=Symbol();
for (int i=0; i<OrdersTotal(); i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol()==sy || sy=="") {
if (OrderType()>1 && OrderType()<6) {
if (op<0 || OrderType()==op) {
if (mn<0 || OrderMagicNumber()==mn) {
if (r>OrderOpenPrice() || r==-1) {
r=OrderOpenPrice();
}}}}}}}
return(r);
}