Hi all, just a quick refresher on the thread: There's a question in the code:
int stoplevel;
int MinimumUseStopLevel;
// Calculate stoplevel as max of either STOPLEVEL or FREEZELEVEL
stoplevel = fmax(SymbolInfoInteger(_Symbol,MODE_FREEZELEVEL), SymbolInfoInteger(_Symbol,SYMBOL_TRADE_STOPS_LEVEL));
// Then calculate the stoplevel as max of either this stoplevel or MinimumUseStopLevel
stoplevel = fmax(MinimumUseStopLevel, stoplevel);
When compiling, it generates a warning:"possible loss of data due to type conversion ...". What does he need? It's not so critical, but I'd like to know.
Часто возникает необходимость преобразовать один числовой тип в другой. Не каждый числовой тип допустимо преобразовать в другой, допустимые преобразования в MQL5 показаны на схеме: Сплошные линии со стрелками обозначают преобразования, которые выполняются без потери информации. Вместо типа char может выступать тип bool (оба занимают в памяти 1...
Hi all, just a quick refresher on the thread: There's a question in the code:
When compiling, it generates a warning:"possible loss of data due to type conversion ...". What does he need? It's not that crucial, but I'd like to know.
You have not only a warning but an error as well. Are you sure it's this particular code you're compiling?
That's how it should be:
int stoplevel=0;
int MinimumUseStopLevel=0;
// Calculate stoplevel as max of either STOPLEVEL or FREEZELEVEL
stoplevel = int(fmax(SymbolInfoInteger(_Symbol,SYMBOL_TRADE_FREEZE_LEVEL), SymbolInfoInteger(_Symbol,SYMBOL_TRADE_STOPS_LEVEL)));
// Then calculate the stoplevel as max of either this stoplevel or MinimumUseStopLevel
stoplevel = int(fmax((int)MinimumUseStopLevel,(int)stoplevel));
It's just without digging into the code - so you don't get errors and warnings.
And if you think about it, you're mixing the warm and the wet
2. Возвращает true или false в зависимости от успешности выполнения функции. В случае успеха значение свойства помещается в приемную переменную, передаваемую по ссылке последним параметром. Если функция используется для получения информации о последнем тике, то лучше использовать SymbolInfoTick(). Вполне возможно, что по данному символу с...
How can I make my EA open positions irrespective of positions opened manually or other positions opened by another EA? I tried to do it with magic, but it did not work. I tried to do it with magic, but it did not work:
datetime some_time=TimeCurrent();
externstring Symbol3 = ""; //Инструмент (""текущий по умолчанию)externint P=1; //Таймфреймexternint MagicNumber = 100500;
int start()
{
int send;
double SL=50;
double TP=50;
double Lots=3;
//&&(OrderMagicNumber() == MagicNumber)//&&(OrdersTotal() ==0)&& if ((Close[0]>High[1])&&(OrderMagicNumber() != MagicNumber))
{
send=OrderSend(Symbol3,OP_BUY,Lots,Ask,3,Bid-SL*Point,Bid+TP*Point,MagicNumber);
}
if ((Close[0]<Low[1])&&(OrderMagicNumber() != MagicNumber))
{
send=OrderSend(Symbol3,OP_SELL,Lots,Bid,3,Ask+SL*Point,Ask-TP*Point,MagicNumber);
}
return(0);
}
How can I make my EA open positions irrespective of positions opened manually or other positions opened by another EA? I tried to do it with magic, but it did not work. Here is the code:
You are missing fields and no order is selected to check number
int n = 0;
for(int i = OrdersTotal(); i >= 0; i--) {
if(!OrderSelect(i, SELECT_BY_POS, MODE_TRADES))continue;
if(OrderSymbol() != _Symbol)continue;
if(OrderMagicNumber() != magic)continue;
n++;
}
if(n == 0){
OrderSend(_Symbol, _type, lot, price, 0, sl, tp, comment, magic, 0, clrNONE);
}
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.
Hi all, just a quick refresher on the thread: There's a question in the code:
When compiling, it generates a warning:"possible loss of data due to type conversion ...". What does he need? It's not so critical, but I'd like to know.
Hi all, just a quick refresher on the thread: There's a question in the code:
When compiling, it generates a warning:"possible loss of data due to type conversion ...". What does he need? Not so critical, but would like to know.
The site engine itself inserted a link to the answer, and there is an example of explicit type conversion .........
Hi all, just a quick refresher on the thread: There's a question in the code:
When compiling, it generates a warning:"possible loss of data due to type conversion ...". What does he need? It's not that crucial, but I'd like to know.
You have not only a warning but an error as well. Are you sure it's this particular code you're compiling?
That's how it should be:
It's just without digging into the code - so you don't get errors and warnings.
And if you think about it, you're mixing the warm and the wet
Not only do you have a warning, you also have an error. Are you sure this is the code you are compiling?
That's the way it should be:
It's just without digging into the code - so you don't get errors and warnings.
And if you think about it, you're mixing things up.
Thank you.
Don't scold me, I'm just learning - trying to understand other people's code. Seems to me it's the quickest way to learn.
I don't understand why he needs type conversion, if all variables are int and return values via symbolinfointeger ?
Thank you.
Don't scold me too much, I'm just learning - trying to make sense of other people's code. Seems to me this is the fastest way to learn.
I don't understand why it needs type conversion, if all variables are int and return values via symbolinfointeger ?
Good day dear programmers!
How can I make my EA open positions irrespective of positions opened manually or other positions opened by another EA? I tried to do it with magic, but it did not work. I tried to do it with magic, but it did not work:
Good day dear programmers!
How can I make my EA open positions irrespective of positions opened manually or other positions opened by another EA? I tried to do it with magic, but it did not work. Here is the code:
You are missing fields and no order is selected to check number
You have missing fields and the order to check the number is not being highlighted
I did. I didn't. It opens in packs. Magic's ignoring it.