Gentlemen, there is an error that I don't understand. If you know what the problem is, please help me.
When compiling the code below, we get an error:'ORDER_TYPE_BUY' - cannot convert enum;'ORDER_TYPE_SELL' - cannot convert enum.
A similar code in mql4 compiles well. I have seen similar examples in other EAs using mql5. But it is not compiling at the moment. I have no idea why it is so and what has to be fixed.
//+------------------------------------------------------------------+int Fun()
{
int res;
int total=PositionsTotal(); // количество открытых позиций //--- перебор всех открытых позицийfor(int i=total-1; i>=0; i--)
{
//--- параметры ордераulong position_ticket=PositionGetTicket(i); // тикет позиции ENUM_POSITION_TYPE type=(ENUM_POSITION_TYPE)PositionGetInteger(POSITION_TYPE); // тип позиции if(type!=ORDER_TYPE_BUY && type!=ORDER_TYPE_SELL) continue;
switch(type)
{
caseORDER_TYPE_BUY:
res=1;
break;
caseORDER_TYPE_SELL:
res=2;
break;
}
return(res);
}
return(3);
}
//+------------------------------------------------------------------+
Gentlemen, there is an error that I don't understand. If you know what the problem is, please help me.
When compiling the code below, we get an error:'ORDER_TYPE_BUY' - cannot convert enum;'ORDER_TYPE_SELL' - cannot convert enum.
A similar code in mql4 compiles well. I have seen similar examples in other EAs using mql5. But it is not compiling at the moment. I have no idea why it does and what has to be fixed.
Gentlemen, there is an error that I don't understand. If you know what the problem is, please help me.
When compiling the code below, we get an error:'ORDER_TYPE_BUY' - cannot convert enum;'ORDER_TYPE_SELL' - cannot convert enum.
A similar code in mql4 compiles well. I have seen similar examples in other EAs using mql5. But it is not compiling at the moment. I have no idea why it is so and what has to be fixed.
ENUM_POSITION_TYPE type=(ENUM_POSITION_TYPE)PositionGetInteger(POSITION_TYPE); // тип позиции if(type!=ORDER_TYPE_BUY && type!=ORDER_TYPE_SELL) continue;
Gentlemen, there is an error that I don't understand. If you know what the problem is, please help me.
When compiling the code below, we get an error:'ORDER_TYPE_BUY' - cannot convert enum;'ORDER_TYPE_SELL' - cannot convert enum.
A similar code in mql4 compiles well. I have seen similar examples in other EAs using mql5. But it is not compiling at the moment. I have no idea why it does and what has to be fixed.
You are confusing the orders (in old language) and positions in MQL5.
Am I the only one with an image from this post that doesn't open in a new popup? Mozilla FireFox 59.0.2 (64bit)
That is, the image that is in the quote does not open.
I saved it to a com and looked at it. It looks like a screenshot from the forum, already with a zoom icon.
I saved it to a com and looked at it. It looks like a screenshot from the forum, already with a zoom icon.
No, it's a normal image - if you PKM and select open in a new tab/window, the image opens at full size.
Am I the only one with an image from this post that doesn't open in a new popup window? Mozilla FireFox 59.0.2 (64bit)
I mean, the image that's in the quote doesn't open.
Doesn't open, and I have chrome, which opens everything!
Doesn't open, and I have chrome, which opens everything!
It's not about Chrome, it's about the script on the website.
Gentlemen, there is an error that I don't understand. If you know what the problem is, please help me.
When compiling the code below, we get an error:'ORDER_TYPE_BUY' - cannot convert enum;'ORDER_TYPE_SELL' - cannot convert enum.
A similar code in mql4 compiles well. I have seen similar examples in other EAs using mql5. But it is not compiling at the moment. I have no idea why it is so and what has to be fixed.
Gentlemen, there is an error that I don't understand. If you know what the problem is, please help me.
When compiling the code below, we get an error:'ORDER_TYPE_BUY' - cannot convert enum;'ORDER_TYPE_SELL' - cannot convert enum.
A similar code in mql4 compiles well. I have seen similar examples in other EAs using mql5. But it is not compiling at the moment. I have no idea why it does and what has to be fixed.
Please paste the code correctly:
Your code is corrected for you in your post
Gentlemen, there is an error that I don't understand. If you know what the problem is, please help me.
When compiling the code below, we get an error:'ORDER_TYPE_BUY' - cannot convert enum;'ORDER_TYPE_SELL' - cannot convert enum.
A similar code in mql4 compiles well. I have seen similar examples in other EAs using mql5. But it is not compiling at the moment. I have no idea why it is so and what has to be fixed.
You assign the POSITION_TYPE type
and compare it with ORDER_TYPE
Gentlemen, there is an error that I don't understand. If you know what the problem is, please help me.
When compiling the code below, we get an error:'ORDER_TYPE_BUY' - cannot convert enum;'ORDER_TYPE_SELL' - cannot convert enum.
A similar code in mql4 compiles well. I have seen similar examples in other EAs using mql5. But it is not compiling at the moment. I have no idea why it does and what has to be fixed.
You are confusing the orders (in old language) and positions in MQL5.
The position type can be (ENUM_POSITION_TYPE)
Identifier
Description
POSITION_TYPE_BUY
Buy
POSITION_TYPE_SELL
Sell
That is OR "POSITION_TYPE_BUY" OR "POSITION_TYPE_SELL". There cannot be any other arrangement.
Therefore your code will take the form: