Yedelkin: Для каждого вида торгового запроса предусмотрены обязательные поля. Они должны быть заполнены. "Открытие позиции" или "Закрытие позиции" - это всего лишь результат выполнения конкретного торгового запроса, правила заполнения которого - одни и те же. Т.е. берите свой работающий вариант запроса "на открытие" и меняйте тип ордера. Ненужные обязательные поля заполняйте нулями.
sergeev:
you have already been answered!
Thank you!
I have one more question: the request below is sent and a position is opened, but stop and profit is not set. I have already twisted them in different ways, but nothing helped. What is the problem, what am I doing wrong?
MqlTick latest_price; // Будет использоваться для текущих котировокif(!SymbolInfoTick(_Symbol,latest_price)) return; // получить текущее значение котировки в структуру типа MqlTick
...
if(uBuy && opSell==false)
{
if(opBuy) return; // при наличии позиции не добавлять к открытой позиции на покупку
mrequest.action = TRADE_ACTION_DEAL; // немедленное исполнение
mrequest.price = NormalizeDouble(latest_price.ask,_Digits); // последняя цена ask
mrequest.sl = NormalizeDouble(latest_price.ask - StopLoss*_Point,_Digits); // Stop Loss
mrequest.tp = NormalizeDouble(latest_price.ask + TakeProfit*_Point,_Digits); // Take Profit
mrequest.symbol = _Symbol; // символ
mrequest.volume = WorkLot; // количество лотов для торговли
mrequest.magic = EA_Magic; // Magic Number
mrequest.type = ORDER_TYPE_BUY; // ордер на покупку
mrequest.type_filling = ORDER_FILLING_FOK; // тип исполнения ордера - все или ничего
mrequest.deviation=Slippage; // проскальзывание от текущей ценыOrderSend(mrequest,mresult); // отсылаем ордерif(mresult.retcode==10009 || mresult.retcode==10008) //запрос выполнен или ордер успешно помещен
{
Alert("Ордер Buy успешно помещен, тикет ордера #:",mresult.order,"!!");
}
else
{
return;
}
}
double summ=0;//переменная, в которую все суммируется
int w=0;//счетчик 3 удачных сумирований
int count_for_buf=0;//Счетчик переходов по буферу ZigZag
while (w<=3)
{
summ=summ+ZigzagBuffer[rates_total-count_for_buf];
count_for_buf++;
if (ZigzagBuffer[rates_total-count_for_buf]!=0)//Увеличиваем счетчик, если используемое значение индикатора не равно нулю
{
w++;
}
}
This way for some reason it hangs or something else happens
WindSW: The request below is sent and a position is opened, but no stop and profit is placed. I've already tried different settings, but nothing helped. What is the problem, what am I doing wrong?
Remember that trade requests "to open a position" have several options to fill? Some of these options involve sl/tp, others do not. In other words, what trading mode does your broker have?
Remember that trade requests "to open a position" have several options to fill? Some of these options involve sl/tp, others do not. In other words, what is your broker's trading mode?
Alpari broker. In the manual mode only a new order is placed in the exchange execution. There is no other option to enter from the market. I understand that this is an Exchange Execution request. Thank you, I have sorted it out. Can you tell me why the compiler processes the following code:
if(CopyBuffer(ema,0,0,3,emaVal)<0) return; // copy the new values of the indicator buffers into arrays
и
IndicatorRelease(ema);
A "possible loss of data due to type conversion" warning appears. I can't figure out what's wrong here, I can't fix it since yesterday evening.
WindSW: Can you tell me why the compiler swears at the following strings:
if(CopyBuffer(ema,0,0,3,emaVal)<0) return; // copy new indicator buffer values into arrays
и
IndicatorRelease(ema);
A "possible loss of data due to type conversion" warning appears. I can't figure out what's wrong here, I haven't managed to fix it since yesterday evening.
This way for some reason it hangs or something else happens
I'll give you my suggestion:
double summ=0; //переменная, в которую все суммируетсяint w=0; //счетчик 3 удачных сумированийfor(int i=0; i<rates_total; i++)
{
if(ZigzagBuffer[rates_total]!=0 && w<3)//Увеличиваем счетчик, если используемое значение индикатора не равно нулю
{
summ+=ZigzagBuffer[i];
w++;
}
if(w>2) break;
}
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.
All options are listed except closing. That's why I ask.
you have already been told.
"Closing a position" is just the result of a trade request, whose rules are the same.
I.e. take the "open" request and change the order type.
Fill the unnecessary mandatory fields with zeros.
Yedelkin:
sergeev:Для каждого вида торгового запроса предусмотрены обязательные поля. Они должны быть заполнены. "Открытие позиции" или "Закрытие позиции" - это всего лишь результат выполнения конкретного торгового запроса, правила заполнения которого - одни и те же. Т.е. берите свой работающий вариант запроса "на открытие" и меняйте тип ордера. Ненужные обязательные поля заполняйте нулями.
you have already been answered!
Thank you!
I have one more question: the request below is sent and a position is opened, but stop and profit is not set. I have already twisted them in different ways, but nothing helped. What is the problem, what am I doing wrong?
how do I add up the last 3 ZigZag values?
This way for some reason it hangs or something else happensRemember that trade requests "to open a position" have several options to fill? Some of these options involve sl/tp, others do not. In other words, what trading mode does your broker have?
Remember that trade requests "to open a position" have several options to fill? Some of these options involve sl/tp, others do not. In other words, what is your broker's trading mode?
Alpari broker. In the manual mode only a new order is placed in the exchange execution. There is no other option to enter from the market. I understand that this is an Exchange Execution request. Thank you, I have sorted it out. Can you tell me why the compiler processes the following code:
if(CopyBuffer(ema,0,0,3,emaVal)<0) return; // copy the new values of the indicator buffers into arrays
и
IndicatorRelease(ema);
A "possible loss of data due to type conversion" warning appears. I can't figure out what's wrong here, I can't fix it since yesterday evening.
if(CopyBuffer(ema,0,0,3,emaVal)<0) return; // copy new indicator buffer values into arrays
и
IndicatorRelease(ema);
A "possible loss of data due to type conversion" warning appears. I can't figure out what's wrong here, I haven't managed to fix it since yesterday evening.
What type of variable is ema?
Got it. See what type of variable should be used to store indicator handles, and match it.
how do you add up the last 3 ZigZag values?
This way for some reason it hangs or something else happensI'll give you my suggestion: