Hi all! Can you tell me if it's possible to implement price change speed function in mql4? For example, if price changes faster than 30 pips per second, then do not open a deal (for an EA)... If you can, tell me the code... thanks
artmedia70: В той функции идёт перебор ордеров для поиска последнего закрытого по тейку. Переработайте эту функцию для ускорения. Они у Кима все универсальные - значит от-туда можно много лишнего поубирать. Опять-таки, всё зависит от логики вашего эксперта.
borilunad: Thanks a lot! Was thinking maybe some operator to use, but they don't go over cases with "or" for the same action.
Artyom, sorry to bother you! What and how else can I remove from the function? I'm only interested in the last position, closed on the take!
I've commented out everything that's not needed, but it's still crawling and dragging... :((
//+----------------------------------------------------------------------------+//| Автор : Ким Игорь В. aka KimIV, http://www.kimiv.ru |//+----------------------------------------------------------------------------+//| Версия : 19.05.2008 |//| Описание : Возвращает флаг закрытия последней позиции по тейку. |//+----------------------------------------------------------------------------+//| Параметры: |//| sy - наименование инструмента ("" - любой символ, |//| NULL - текущий символ) |//| op - операция (-1 - любая позиция) |//| mn - MagicNumber (-1 - любой магик) |//+----------------------------------------------------------------------------+//bool isCloseLastPosByTake(string sy="", int op=-1, int mn=-1) {bool isCloseLastPosByTake() {//int op=-1) {//, int mn=0) {//string sy="", datetime t;
double ocp, otp;
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=5; else dg=3;
ocp=NormalizeDouble(OrderClosePrice(), 5);//dg);
otp=NormalizeDouble(OrderTakeProfit(), 5);//dg);if (ocp==otp) return(True);
}
return(False);
}
bugorok: Hi all! Can you tell me if it is possible to implement rate function in mql4? For example, if price changes faster than 30 pips per second, then do not open a deal (for an EA)... If you can, tell me the code... thanks
Try looking at the code of this EA, it has something similar implemented.
externintKolSec = 4; //количество секунд, между измерениями скорости ценыexternintPunkts = 28; //количество пунктов, которые цена проходит за это время//ЗАКРЫТИЕ ПОЗИЦИИ, ЕСЛИ ЦЕНА ДЕЛАЕТ РЕЗКИЙ РЫВОК ПРОТИВ НЕЕ//-------------------------------------------------------------
I had my pending orders deleted in the tester, it can be seen in the results, however, the log says ERR_INVALID_TICKET 4108 Invalid Ticket Number
Should I ignore this or better deal with the situation?
You'd better handle it. Maybe, your Expert Advisor has tried to delete not only the pending ones, but the ones already opened? Before deleting, insert Print("I want to delete an order with ticket=",OrderTicket()," OrderType=",OrderType()); For pending OrderType from 2 to 5. For open ones from 0 to 1.https://docs.mql4.com/ru/constants/trading
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.
Good afternoon, everyone.
I have an interesting question.
Tell me, who knows or may be faced with, when the account is registered in MT4 the Trader's Name and Account No. are written on the left side.
I am wondering whether or not I can change the details entered in the account while I am using it. I need to change the entered NAME.
I will thank you in advance for your reply.
В той функции идёт перебор ордеров для поиска последнего закрытого по тейку. Переработайте эту функцию для ускорения. Они у Кима все универсальные - значит от-туда можно много лишнего поубирать. Опять-таки, всё зависит от логики вашего эксперта.
borilunad:
Thanks a lot! Was thinking maybe some operator to use, but they don't go over cases with "or" for the same action.
Artyom, sorry to bother you! What and how else can I remove from the function? I'm only interested in the last position, closed on the take!
I've commented out everything that's not needed, but it's still crawling and dragging... :((
Good evening! Happy holidays to all!
I had my pending orders deleted in the tester, it can be seen in the results, however, the log says ERR_INVALID_TICKET 4108 Invalid Ticket Number
Should I ignore this or better deal with the situation?
Hi all! Can you tell me if it is possible to implement rate function in mql4? For example, if price changes faster than 30 pips per second, then do not open a deal (for an EA)... If you can, tell me the code... thanks
Try looking at the code of this EA, it has something similar implemented.
https://www.mql5.com/ru/code
Good evening! Happy holidays to all!
I had my pending orders deleted in the tester, it can be seen in the results, however, the log says ERR_INVALID_TICKET 4108 Invalid Ticket Number
Should I ignore this or better deal with the situation?
You'd better handle it. Maybe, your Expert Advisor has tried to delete not only the pending ones, but the ones already opened? Before deleting, insert Print("I want to delete an order with ticket=",OrderTicket()," OrderType=",OrderType()); For pending OrderType from 2 to 5. For open ones from 0 to 1.https://docs.mql4.com/ru/constants/trading
Thank you!!!!
Is there a bushwhacker/no bushwhacker in the tanks? :-)