Guys, give me an example of how to correctly place an expiration in a stop order. Let's say one minute, 20 minutes, one hour. I can not find and myself do not understand. I am grateful in advance.
bool isCloseLastPosByStop(string sy="", int op=-1, int mn=-1) {// Объявление функции. Передаваемые параметры: sy = символ, op - тип, mn - магикdatetime t; // Переменная содержит время закрытия ордераdouble ocp, osl; // ocp - цена закрытия позиции, osl - цена СтопЛосс закрытой позицииint dg, i, j=-1, k=OrdersHistoryTotal(); // k содержит общее количество ордеров в историиif (sy=="0") sy=Symbol(); // Если в ф-цию передан sy равный 0 или NULL, то использовать символ графика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) { // ... если тип ордера равен или -1 (имеется ввиду любой) или равен переданному в ф-цию, ...if (mn<0 || OrderMagicNumber()==mn) { // ... если его магик или любой (-1) или равен переданному в ф-цию (магику советника), ...if (t<OrderCloseTime()) { // ... если переменная t содержит время закрытия меньше, чем время закрытия выбранного ордера, то ...
t=OrderCloseTime(); // ... то присвоим переменной t время закрытия выбранного ордера (этот ордер закрыт позже предыдущего)
j=i; // Запишем в переменную j индекс найденного ордера с максимальным временем закрытия
}
}
}
}
}
}
} // По окончании цикла в переменной j находится индекс последнего закрытого ордераif (OrderSelect(j, SELECT_BY_POS, MODE_HISTORY)) { // Выберем его по индексу
dg=MarketInfo(sy, MODE_DIGITS); // Количество цифр после десятичного точки в цене инструмента, заданного переменной syif (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); // Возвращаем "Ложь"
}
It seems to get to me, honestly with difficulty, I even printed on a sheet to read on the way, one thing I do not understand "JPY" from where? why?
and tell me where do i put this code correctly? if i am not mistaken it should be outside all functions?
It seems to get to me, honestly with difficulty, I even printed on a sheet to read on the way, one thing I do not understand "JPY" from where? why?
and tell me where to put this code correctly? if i am not mistaken it should be placed outside of all functions?
You need to correct digits for yen if you're working with yen and the order symbol contains a JPY. Do not bother - this function will do everything for you. And it should be placed, as well as any other functions outside the body of the EA. And you should call it from the EA as follows:
if (isCloseLastPosByStop(Symbol(), OP_BUY, Magic)) // Если последняя закрытая позиция Buy на текущем графике с магиком Magic была закрыта по стопу, то ...
{
// .......... тут код, который выполнится при данном условии
}
//--------------------------------------------------------------------------------------------------------------------------if (isCloseLastPosByStop(USDJPY, OP_SELL, Magic)) // Если последняя закрытая позиция Sell с символом USDJPY с магиком Magic была закрыта по стопу, то ...
{
// .......... тут код, который выполнится при данном условии
}
//--------------------------------------------------------------------------------------------------------------------------if (isCloseLastPosByStop()) // Если любая последняя закрытая позиция с любым символом и любым магиком была закрыта по стопу, то ...
{
// .......... тут код, который выполнится при данном условии
}
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.
//===========================================================================
who can help, explain in russian
how the methodology of training takes place (conditionally, it does not matter which algorithm yet) Neuronka
so the methodology of selection ( tucking parmeters aka values ) is clear
- genetics
- propagation of the backward error (for example)
But what about training? If the fitting logic is not clear - ok, training is finished.
or drop me a link i would be very grateful.
//===========================================================================
i.e. in the tester it is clear there at the expense of building up profits - ok.
but let's say just a perfect sinusoidal sample of xxx values
how is it =) goes the concept of good and enough ?
Thanks in advance for the reply on the subject.
chrs
thanks for the link, what's the best place to start
to catch the logic of the question :?
I've installed Microsoft Visual Studio 2010, chose programming in C++, and a window opened for code. Does anybody know how to create a form?
When programming in Microsoft Visual Studio 2010, a form appears immediately and only then you can proceed with the code; what about C++?
I don't think anything has changed since 2008, and I've only recently mastered it... Anyway, try it this way:
right click on the directory in Solution Explorer->Add->New Item->select Windows Form
Good afternoon. Please make an iBandsOnArray indicator on the macda. It should be like on the screenshot.
b.band on macd
b.band on the macd
Guys, give me an example of how to correctly place an expiration in a stop order. Let's say one minute, 20 minutes, one hour. I can not find and myself do not understand. I am grateful in advance.
here's an example from the guys =)
What if the variable is to be used in the future for some calculations and not just for printing?
What if the variable is to be used in the future for some calculations and not just for printing?
It seems to get to me, honestly with difficulty, I even printed on a sheet to read on the way, one thing I do not understand "JPY" from where? why?
and tell me where do i put this code correctly? if i am not mistaken it should be outside all functions?
It seems to get to me, honestly with difficulty, I even printed on a sheet to read on the way, one thing I do not understand "JPY" from where? why?
and tell me where to put this code correctly? if i am not mistaken it should be placed outside of all functions?
You need to correct digits for yen if you're working with yen and the order symbol contains a JPY. Do not bother - this function will do everything for you. And it should be placed, as well as any other functions outside the body of the EA. And you should call it from the EA as follows: