Maybe your brokerage company does not allow to explicitly specify take and stop positions, check it - put zeros in their places in the opening order function.
That's not a bad idea either, I will check it for sure, thanks
It returns the closing price of the selected order. The order must be pre-selected using the OrderSelect() function.
Example:
if(OrderSelect(10,SELECT_BY_POS,MODE_HISTORY)==true) { datetime ctm=OrderOpenTime(); if(ctm>0) Print("Open time for the order 10 ", ctm;
ctm=OrderCloseTime(); if(ctm>0) Print("Close time for the order 10 ", ctm); } else Print("OrderSelect failed error code is",GetLastError();
But there is no example of "OrderClosePrice()" itself ?
Let's say it returned the closing value of a selected order, but how do I know if it was a stop or profit position?
Returns the close price of the selected order. The order must be pre-selected using the OrderSelect() function.
Example:
But there is no example of "OrderClosePrice()" itself ?
Let's say it returned the closing values of a selected order, but how do I know it was a stop or profit position?
This is a mess!!! I'm sorry, but this is the first time I see such a monstrous inattention, laziness to think and a complete lack of logical thinking. I don't think you should do programming... IMHO of course. No offense, but on the previous page, at the very beginning of it, I inserted the code you required, which returns the flag of closing the last position by a stop. Anticipating your question about what is the previous page, I will give it to you here:
//+----------------------------------------------------------------------------+//| Автор : Ким Игорь В. aka KimIV, http://www.kimiv.ru |//+----------------------------------------------------------------------------+//| Версия : 19.05.2008 |//| Описание : Возвращает флаг закрытия последней позиции по стопу. |//+----------------------------------------------------------------------------+//| Параметры: |//| sy - наименование инструмента ("" - любой символ, |//| NULL - текущий символ) |//| op - операция (-1 - любая позиция) |//| mn - MagicNumber (-1 - любой магик) |//+----------------------------------------------------------------------------+bool isCloseLastPosByStop(string sy="", int op=-1, int mn=-1) {
datetime t;
double ocp, osl;
int dg, i, j=-1, k=OrdersHistoryTotal();
if (sy=="0") sy=Symbol();
for (i=0; i<k; i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)) {
if (OrderSymbol()==sy || sy=="") {
if (OrderType()==OP_BUY || OrderType()==OP_SELL) {
if (op<0 || OrderType()==op) {
if (mn<0 || OrderMagicNumber()==mn) {
if (t<OrderCloseTime()) {
t=OrderCloseTime();
j=i;
}
}
}
}
}
}
}
if (OrderSelect(j, SELECT_BY_POS, MODE_HISTORY)) {
dg=MarketInfo(sy, MODE_DIGITS);
if (dg==0) if (StringFind(OrderSymbol(), "JPY")<0) dg=4; else dg=2;
ocp=NormalizeDouble(OrderClosePrice(), dg);
osl=NormalizeDouble(OrderStopLoss(), dg);
if (ocp==osl) return(True);
}
return(False);
}
If you can, you can figure it out. There's a search for an order and its selection, and a comparison of the close price with its StopLoss value...
It's a total fucking mess!!! Forgive me, but this is the first time I've seen such monstrous inattention, laziness to think and a complete lack of logical thinking. I don't think you should do programming... IMHO of course. No offense, but on the previous page, at the very beginning of it, I inserted the code you required, which returns the flag of closing the last position by a stop. Anticipating your question about what is the previous page, I will give it to you here:
If you can, you can figure it out. There's a search for an order and its selection, and a comparison of the closing price with its StopLoss value...
Although... I guess - doesn't help...
Everyone has started once and hasn't been that stupid yet, the mate just might not be awake yet...
Although you forgot to add that it returns a flag, but not the one that flies on buildings and ships... :-)
I would always be interested to know how you are thanked for your help. I've certainly received it a couple of times, maybe more. Who knows what kind of thank yous there are?
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.
what errors does it give when it does not open a position? You can try this
Okay, I'll give it a shot, thanks.
If at least one position is open (any - by hand, by another EA) this EA will not work
I know this, I'm not a fool, then I wouldn't have set total<1, I'm trying to program it myself,
I'm naturally trying to figure out what I'm writing in the EA, but thanks for that)
Maybe your brokerage company does not allow to explicitly specify take and stop positions, check it - put zeros in their places in the opening order function.
That's not a bad idea either, I will check it for sure, thanks
The documentation says that:
The order must be pre-selected using the OrderSelect() function.
if(OrderSelect(10,SELECT_BY_POS,MODE_HISTORY)==true) { datetime ctm=OrderOpenTime(); if(ctm>0) Print("Open time for the order 10 ", ctm; ctm=OrderCloseTime(); if(ctm>0) Print("Close time for the order 10 ", ctm); } else Print("OrderSelect failed error code is",GetLastError();
But there is no example of "OrderClosePrice()" itself ?
Let's say it returned the closing value of a selected order, but how do I know if it was a stop or profit position?
The documentation says that:
The order must be pre-selected using the OrderSelect() function.
But there is no example of "OrderClosePrice()" itself ?
Suppose it returns the close values for a selected order, but how do I know it was a stop or profit position?
Here is the answer to many of your questions http://www.vedikhin.ru/2006/06/expert-advisors-overview.html
The trailer is the same but in Word format.
The documentation says that:
The order must be pre-selected using the OrderSelect() function.
But there is no example of "OrderClosePrice()" itself ?
Let's say it returned the closing values of a selected order, but how do I know it was a stop or profit position?
This is a mess!!! I'm sorry, but this is the first time I see such a monstrous inattention, laziness to think and a complete lack of logical thinking. I don't think you should do programming... IMHO of course. No offense, but on the previous page, at the very beginning of it, I inserted the code you required, which returns the flag of closing the last position by a stop. Anticipating your question about what is the previous page, I will give it to you here:
If you can, you can figure it out. There's a search for an order and its selection, and a comparison of the close price with its StopLoss value...
Although... I don't think it will help...
It's a total fucking mess!!! Forgive me, but this is the first time I've seen such monstrous inattention, laziness to think and a complete lack of logical thinking. I don't think you should do programming... IMHO of course. No offense, but on the previous page, at the very beginning of it, I inserted the code you required, which returns the flag of closing the last position by a stop. Anticipating your question about what is the previous page, I will give it to you here:
If you can, you can figure it out. There's a search for an order and its selection, and a comparison of the closing price with its StopLoss value...
Although... I guess - doesn't help...
Everyone has started once and hasn't been that stupid yet, the mate just might not be awake yet...
Although you forgot to add that it returns a flag, but not the one that flies on buildings and ships... :-)
Here we go.... I'd better take it down before you go on for eight pages.
I would always be interested to know how you are thanked for your help. I've certainly received it a couple of times, maybe more. Who knows what kind of thank yous there are?
A classic phrase: My gratitude will be limitless within reason.
Hello, folks.
I searched and couldn't find anything. I'm asking for help.
Need to calculate the average candle per period and the average Zigzag swing.
I need a link. I've been looking... This is the only one I could find.
I wish I had some turkeys...