What is AND, OR, NOT is not hard to understand, I'm just interested in these little things in code and their uses.
Or, for instance, this: - condition a is EQUAL to b is easy to implement a==b - But a is UNEQUAL to b condition is difficult to implement...
Sorry to bring up the basics again, but this will probably come in handy for many beginners...
Here is a ready-made code with combat training conditions. :) It has everything... from defining and arranging fields to the programmer's handwriting... https://www.mql5.com/ru/forum/51521
It seems to me, Igor, that you have deviated a bit from the topic and have gone into explanations. If you don't mind my saying so I would like to suggest a function which shows something in the taskbar shortcut. I use it to monitor EAs performance at work without opening the terminal (lots of prying eyes). it may also be useful in other cases.
//----------- Taskbar visualization function ------------------------------------- void ProfMT(string X) { int hwnd1 = WindowHandle(Symbol(), Period()); int hwnd_parent1 = 0; while (!IsStopped()) { hwnd1= GetParent(hwnd1); if (hwnd1 == 0) break; hwnd_parent1 = hwnd1; } if (hwnd_parent1 != 0) SetWindowTextA(hwnd_parent1,X); } Thanks.
Designed to open positions - trading operations of buying or selling at market prices. This function is universal and multicurrency, allowing to open positions for any symbol, not only for the current one. For example, an EA can be run on the EURUSD chart, and trade USDCAD.
//+----------------------------------------------------------------------------+//| Автор : Ким Игорь В. aka KimIV, http://www.kimiv.ru |//+----------------------------------------------------------------------------+//| Версия : 13.06.2007 |//| Описание : Открытие позиции. Версия функции для тестов на истории. |//+----------------------------------------------------------------------------+//| Параметры: |//| sy - наименование инструмента ("" - текущий символ) |//| op - операция |//| ll - лот |//| sl - уровень стоп |//| tp - уровень тейк |//| mn - MagicNumber |//+----------------------------------------------------------------------------+voidOpenPosition(stringsy, intop, doublell, doublesl=0, doubletp=0, intmn=0){colorclOpen;
doublepp;
interr, ticket;
if(sy=="")sy=Symbol();
if(op==OP_BUY){pp=MarketInfo(sy, MODE_ASK); clOpen=clOpenBuy;
}else{pp=MarketInfo(sy, MODE_BID); clOpen=clOpenSell;
}ticket=OrderSend(sy, op, ll, pp, Slippage, sl, tp, "", mn, 0, clOpen);
if(ticket<0){err=GetLastError();
Print("Error(",err,") open ",GetNameOP(op),": ",ErrorDescription(err));
Print("Ask=",Ask," Bid=",Bid," sy=",sy," ll=",ll,
" pp=",pp," sl=",sl," tp=",tp," mn=",mn);
}}
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.
Thank you for your acceptance... ;)
What is AND, OR, NOT
is not hard to understand, I'm just interested in these little things in code and their uses.
Or, for instance, this:
- condition a is EQUAL to b is easy to implement a==b
- But a is UNEQUAL to b condition is difficult to implement...
Sorry to bring up the basics again, but this will probably come in handy for many beginners...
Here is a ready-made code with combat training conditions. :)
It has everything... from defining and arranging fields to the programmer's handwriting...
https://www.mql5.com/ru/forum/51521
- But the condition a is UNEQUAL to b is already causing difficulties...
If you don't mind my saying so I would like to suggest a function which shows something in the taskbar shortcut.
I use it to monitor EAs performance at work without opening the terminal (lots of prying eyes).
it may also be useful in other cases.
//----------- Taskbar visualization function -------------------------------------
void ProfMT(string X)
{
int hwnd1 = WindowHandle(Symbol(), Period());
int hwnd_parent1 = 0;
while (!IsStopped())
{
hwnd1= GetParent(hwnd1);
if (hwnd1 == 0) break;
hwnd_parent1 = hwnd1;
}
if (hwnd_parent1 != 0) SetWindowTextA(hwnd_parent1,X);
}
Thanks.
There you go... Where else can you learn the truth so quickly than in a forum... ;)
Thank you! And sorry I slipped off topic.
I'll try to ask more questions in the book thread...
The OpenPosition() function for the tester.
Designed to open positions - trading operations of buying or selling at market prices. This function is universal and multicurrency, allowing to open positions for any symbol, not only for the current one. For example, an EA can be run on the EURUSD chart, and trade USDCAD.
OpenPosition() function for online.
Examples of using the OpenPosition() function.
1. Buy 0.1 lot of the current instrument
2. Sell 0.2 lots of EURUSD
3. Sell 0.12 lots of USDCAD with a 20 pips stop
4. Buy 0.15 lot of USDJPY with 40 pips stop
5. Sell 0.1 lot of GBPJPY with stop 23 and takeaway 44 pips
The trailer is a script to test the OpenPosition() function. The first 4 examples are commented out.OpenPosition() function for online.
Why not put lsComm in the function parameters?
Imho, the "flexibility" of the function expands...