Форум по трейдингу, автоматическим торговым системам и тестированию торговых стратегий
fxsaber, 2018.02.28 13:39
2018.02.28 14:28:27.907 Trans.deal = 0 Trans.order = 213465763 Trans.symbol = EURUSD Trans.type = TRADE_TRANSACTION_ORDER_ADD (0) Trans.order_type = ORDER_TYPE_SELL (1) Trans.order_state = ORDER_STATE_STARTED (0) Trans.deal_type = DEAL_TYPE_BUY (0) Trans.time_type = ORDER_TIME_GTC (0) Trans.time_expiration = 1970.01.01 00:00:00 Trans.price = 1.22178 Trans.price_trigger = 0.0 Trans.price_sl = 0.0 Trans.price_tp = 0.0 Trans.volume = 1.0 Trans.position = 0 Trans.position_by = 0 Request.action = ENUM_TRADE_REQUEST_ACTIONS::0 (0) Request.magic = 0 Request.order = 0 Request.symbol = Request.volume = 0.0 Request.price = 0.0 Request.stoplimit = 0.0 Request.sl = 0.0 Request.tp = 0.0 Request.deviation = 0 Request.type = ORDER_TYPE_BUY (0) Request.type_filling = ORDER_FILLING_FOK (0) Request.type_time = ORDER_TIME_GTC (0) Request.expiration = 1970.01.01 00:00:00 Request.comment = Request.position = 0 Request.position_by = 0 Result.retcode = 0 Result.deal = 0 Result.order = 0 Result.volume = 0.0 Result.price = 0.0 Result.bid = 0.0 Result.ask = 0.0 Result.comment = Result.request_id = 0 Result.retcode_external = 0 2018.02.28 14:28:27.913 Trans.deal = 196986814 Trans.order = 213465763 Trans.symbol = EURUSD Trans.type = TRADE_TRANSACTION_DEAL_ADD (6) ....
Hi,
am I doing something wrong?
- To know where the calls of OnTradeTransaction() belong to I would like to use the magic number. The only (why only?) type that provides the magic number is request - BUT in OnTradeTransaction() request.magic is always 0?
- Beside this even the comment is empty??
- Beside this either in request or in trans the symbol is filled - is this a feature or a foul? => SYM = StringLen(request.symbol)>1 ? request.symbol : trans.symbol?
- When I manually open and/or close a position OnTradeTransaction() is called but when I manually change SL and/or TP of an open position no reaction??
I the list of the open positions and orders I can see the magic number and the comment but all this is not assigned to either request, transaction and/or result... :(
Here is my little EA with which you can check yourself or tell me what I am doing wrong..
ONLY FOR DEMO ACCOUNTS!!
If i recall correctly, there is always order or positionid, with those it it possible to retrieve the magic number from current positions or positions in history.
I started with something similar than your spy and then I noticed that important information for me is not delivered to my EA, although it exists in the system and I don't see any reason why this is so, except ... :(
If i recall correctly, there is always order or positionid, with those it it possible to retrieve the magic number from current positions or positions in history.
This forces me to administrate theses ids additionally and make OnTradetransdaction() more or less superfluous :(
I have never used the OnTradeTransaction but I do have questions, guesses and observations that might help ...
- Why are you trying to change the magic number in operations involving updating the T/P and S/L, instead of supplying the current magic number of the position/order in your request?
... req.magic = __LINE__; //PositionGetInteger(POSITION_MAGIC); // MagicNumber der Position (Line 109) ... req.magic = __LINE__; //OrderGetInteger(ORDER_MAGIC); // MagicNumber der Position (Line 187) ...
- It may be that with certain requests or transaction types (e.g. order update, or stops update), where things like magic number and comments that cannot be changed anyway, these are probably ignored and not carried over to the transaction event handler. This is only a guess.
- In my tests with your code, only the "TRADE_TRANSACTION_REQUEST" transaction type had a magic number and comment.
2022.12.29 09:47:57.738 Test_OnTradeTransaction_02 (EURUSD,H1) 265 EURUSD mag: >127< cmmt: >Market Sell Mag: 127< New Event trans.typ: TRADE_TRANSACTION_REQUEST deal_typ: DEAL_TYPE_BUY order_state: ORDER_STATE_STARTED order_typ: ORDER_TYPE_BUY order: 0 pos: 0
I have never used the OnTradeTransaction but I do have questions, guesses and observations that might help ...
- Why are you trying to change the magic number in operations involving updating the T/P and S/L, instead of supplying the current magic number of the position/order in your request?
- It may be that with certain requests or transaction types (e.g. order update, or stops update), where things like magic number and comments that cannot be changed anyway, these are probably ignored and not carried over to the transaction event handler. This is only a guess.
- In my tests with your code, only the "TRADE_TRANSACTION_REQUEST" transaction type had a magic number and comment.
add 1.: I just wanted to try it and to see what happens: Can I change the magic number of an open position or oder or will that cause this an error - but nothing! It is not checked and not handled...
Imagine to check only the magic number that logs by its changes the management of this position - only an idea..
add 3.: Right (why only this?), but it would be OK if were set correctly but I set them before sending my request to the server and this (?) request comes back without these MY information... :(
I am guessing that for all other types, except for that one, the magic and comment fields are simply cleared and ignored because they are not used.
It could also be to save on network bandwidth, that only the minimal required data is transmitted to and from the trade server, and given that magic and comment is not required for all other types except the primary request, these are never send nor received and not part of the transaction event.
It could also be to save on network bandwidth, that only the minimal required data is transmitted to and from the trade server, and given that magic and comment is not required for all other types except the primary request, these are neve send nor received.
Won't be the field length the same no matter whether it was filled with 0 or the highest possible number?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
am I doing something wrong?
I the list of the open positions and orders I can see the magic number and the comment but all this is not assigned to either request, transaction and/or result... :(
Here is my little EA with which you can check yourself or tell me what I am doing wrong..
ONLY FOR DEMO ACCOUNTS!!