
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Here is another bunch of minor bugfixes and improvements of wss source codes in a zip-archive.
Among other things you can now analyze unsuccessful upgrade (for example, if authorization is required and status code other than 101 is returned) and take measures:
Also StringUtils.mqh and URL.mqh are also received important fixes.
Hi @Stanislav Korotky, i'm new to the MQL5. Find that you post a wss.zip file for websocket use. How to use it, is there a demo or something i can learn. Thank you sincerely!
Hi @Stanislav Korotky, i'm new to the MQL5. Find that you post a wss.zip file for websocket use. How to use it, is there a demo or something i can learn. Thank you sincerely!
You can find several examples in the algotrading book, in the section describing (step by step) implementation of a web service project for copying trades and signals.
You can find several examples in the algotrading book, in the section describing (step by step) implementation of a web service project for copying trades and signals.
Hello @Stanislav Korotky
I am trying to implement a partial position close with a pending order in the opposite direction.
eg:
MqlTradeRequestSync reqs(transaction.symbol);
reqs.closeby(target_position_ticket_id, transaction.order);
I believe the above line should be able to get the job done but my challenge is how to get the `target_position_ticket_id` within the OnTradeTransaction -> TRADE_TRANSACTION_DEAL_ADD (transaction.type) event handler or somehow associate the pending order with the target_position_ticket_id it is expected to close whenever the pending order is filled.
I tried adding the `target_position_ticket_id` to the pending order comment when I am creating the pending order but the issue is that within the OnTradeTransaction -> TRADE_TRANSACTION_DEAL_ADD (transaction.type) I cannot access the comment since MqlTradeTransaction attributes does not have 'comment'
Please I will appreciate your help
I am trying to implement a partial position close with a pending order in the opposite direction.
eg:
MqlTradeRequestSync reqs(transaction.symbol);
reqs.closeby(target_position_ticket_id, transaction.order);
I believe the above line should be able to get the job done but my challenge is how to get the `target_position_ticket_id` within the OnTradeTransaction -> TRADE_TRANSACTION_DEAL_ADD (transaction.type) event handler or somehow associate the pending order with the target_position_ticket_id it is expected to close whenever the pending order is filled.
I tried adding the `target_position_ticket_id` to the pending order comment when I am creating the pending order but the issue is that within the OnTradeTransaction -> TRADE_TRANSACTION_DEAL_ADD (transaction.type) I cannot access the comment since MqlTradeTransaction attributes does not have 'comment'
The closeby(ticket1, ticket2) method from the book assumes that you use a hedging account and already have 2 open positions (buy and sell) with tickets ticket1 and ticket2. I suppose, it's impossible (in general) to perform TRADE_ACTION_CLOSE_BY action against pending order. But if your account is in netting mode, I think you can simply place a pending order in opposite direction and when it triggers, it will modify existing position accordingly - that's close it, or does partial close, or even invert (if new volume is larger than old).
Small patches in websockets (a la carte & en masse).
One of these properties is the Symbol's "Commissions" which obviously differs from brokers as can be seen in the attached picture. However, I have not been be able to access this property programmatically. Please can you help me with a clue on how to get the symbol's commission?
On the side this message often shows on the log whenever am working with PositionFilter especially when the EA is loaded the first time or recompiled "Unresolved int value as enum: 8 for MonitorInterface<ENUM_POSITION_PROPERTY_INTEGER,ENUM_POSITION_PROPERTY_DOUBLE,ENUM_POSITION_PROPERTY_STRING>". It still works fine and does not stop anything
@Stanislav Korotky Thanks for the continuous update, please there is something I have been struggling to figure out. On the MT5 "Market Watch" I can right click on any "Symbol" and view all it's associated properties just as I would programmatically by clicking on "Specification".
One of these properties is the Symbol's "Commissions" which obviously differs from brokers as can be seen in the attached picture. However, I have not been be able to access this property programmatically. Please can you help me with a clue on how to get the symbol's commission?
Unfortunately, not all properties of the terminal's entities are accessible via MQL5.
On the side this message often shows on the log whenever am working with PositionFilter especially when the EA is loaded the first time or recompiled "Unresolved int value as enum: 8 for MonitorInterface<ENUM_POSITION_PROPERTY_INTEGER,ENUM_POSITION_PROPERTY_DOUBLE,ENUM_POSITION_PROPERTY_STRING>". It still works fine and does not stop anything
This is just a warning caused by the fact that the corresponding built-in enumeration of MQL5 has a gap in the constants which are normally assigned consecutively. This gap is occured because MQL5 is constantly changing, and some constants can become obsolete and then be eliminated. You can edit the source code to prevent such warnings.
I'm attaching an updated version of JSON library - toyjson3.mqh - a replacement for toyjson2.mqh and toyjson.mqh from the book.
This version is optimized for processing huge json files. For the sake of simplicity, the previous versions use StringSplit function for text tokenization during parsing, and this call can internally request gigabytes of spare memory due to fragmentation and anticipation of further data flow. It's released after the parsing, but MQL5 memory manager can keep it reserved for a while, because it frees garbage in postponed manner.
Now it takes times less memory during parsing.