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
In this case, I still need to store the ticket of the order from the requester somewhere to compare it with the ticket from the trade. And I just want to get away from all storing in local variables and get info solely from market/terminal to level out local infrastructure risks.
You're being a bit naive.
The mage is the same for all trades of this EA!
But the orders are different (unique)!
I trade in Openvashka on real and am testing on demo, but I don't have multiple triggers.
Post your piece of code forTRADE_TRANSACTION_DEAL_ADD
I just had this happen today. Above posted a clipping from the log of 2 identical transactions for the same robot.
2019.02.08 10:55:29 [INFO]: ( PChBreak_RTS-3.19_22) TRADE_TRANSACTION_DEAL_ADD
TRADE_TRANSACTION_DEAL_ADD
Symbol: RTS-3.19
Deal ticket: 12674810
Deal type: DEAL_TYPE_BUY
Order ticket: 82646001
Order type: ORDER_TYPE_BUY
Order state: ORDER_STATE_STARTED
Order time type: ORDER_TIME_GTC
Order expiration: 1970.01.01 00:00
Price: 119700
Price trigger: 0
Stop Loss: 0
Take Profit: 0
Volume: 1
Position: 82646001
Position by: 0
2019.02.08 10:55:32 [INFO]: ( PChBreak_RTS-3.19_22 ) TRADE_TRANSACTION_DEAL_ADD
TRADE_TRANSACTION_DEAL_ADD
Symbol: RTS-3.19
Deal ticket: 12674810
Deal type: DEAL_TYPE_BUY
Order ticket: 82646001
Order type: ORDER_TYPE_BUY
Order state: ORDER_STATE_STARTED
Order time type: ORDER_TIME_GTC
Order expiration: 1970.01.01 00:00
Price: 119700
Price trigger: 0
Stop Loss: 0
Take Profit: 0
Volume: 1
Position: 82646001
Position by: 0
Code to deal_add
After a bug with two identical transactions, I added a check that the ticket of the current transaction is not equal to the previous one.
I just had one of those today. Above I posted a clipping from the log of 2 identical transactions for the same robot.
2019.02.08 10:55:29 [INFO]: ( PChBreak_RTS-3.19_22 ) TRADE_TRANSACTION_DEAL_ADD
TRADE_TRANSACTION_DEAL_ADD
Symbol: RTS-3.19
Deal ticket: 12674810
Deal type: DEAL_TYPE_BUY
Order ticket: 82646001
Order type: ORDER_TYPE_BUY
Order state: ORDER_STATE_STARTED
.........
Code to deal_add
After a bug with two identical transactions, I added a check that the ticket of the current transaction is not equal to the previous one.
Got it.
Order state: ORDER_STATE_STARTED - THIS CANNOT BE inTRADE_TRANSACTION_DEAL_ADD!
Added
I'm sure you don't (and neither doesIlya Baranov)
Added
This forum has a "Exchange Trading" section you would be better off communicating there...
I see.
Order state: ORDER_STATE_STARTED - THIS CANNOT BE in TRADE_TRANSACTION_DEAL_ADD!
Added
I'm sure you don't.
Added
This forum has a "Exchange Trading" section you would be better off communicating there...
I would have moved it long ago - but@Ilya Child never said - does he trade on the exchange or just netting forex. I'm sitting here waiting...
I would have moved it a long time ago - but@Ilya Child never said whether he trades on the exchange or just netting forex. I'm sitting here waiting...
Symbol: RTS-3.19 is FORTS
Symbol: RTS-3.19 is FORTS
Ido not understand. There is a stock exchange, there is forex. Everything else is out of the ballpark.
I don't understand. There is a stock exchange, there is forex. Everything else is out of the ballpark.
FORTS is RTS Futures and Options - the derivatives market section of the Moscow Exchange:)
I see.
Order state: ORDER_STATE_STARTED - THIS CANNOT BE inTRADE_TRANSACTION_DEAL_ADD!
Added
I'm sure you don't (and neither doesIlya Baranov)
Added
There is a "Exchange Trading" section on this forum you'd better communicate there...
I don't quite follow you. Here I have the processing of the transaction.
Regarding the status of the order in the transaction. You do realise that I'm not making it up myself. In all deal_add transactions this is the status of the order. Please note that it is a market order and it used to be a pending order.
Now we have another portion of confusion. A deal_add transaction flew in and no position appeared and pending on a non-existent position was placed.
Added.
A Deal_add transaction arrived, but the position did not appear and the pending orders on the non-existing position were placed. Transaction type is Sell, order type is Buy. Although initially the limit was Sell_limit
Limiters themselves, which will require TP/SL, may be partially executed. The TP in the form of limiters is the same. For example, TP is executed by a third of the volume - SL must be reduced by the same amount.
All in all, quite unpleasant logic for catching all the tricks.
The task should be implemented in OnTrade. It should not be too difficult to implement.
Task
We have pending orders on Netting (may be differently directed and any number of each type). Each time the initial pending order triggers, we need to set its SL/TP as a Stop/Limit pending order. Then the SL/TP should be interdependent: once the order triggers, the second one is deleted. The initial and SL/TP pending orders can trigger partially. The Expert Advisor may be reloaded at any time, including transferring to another Terminal.
Solution
I don't quite follow you. Here's my transaction processing
You do not have switch(trans.type)