Dominik Egert:
On requote all you are doing is reading a certain memory area then sleeping for 1 second, repeating this 5 times.
You need to modify your order and resend it. Else nothing happens...
Your code is not doing anything with requotes, except for sleeping... Or being lazy...
Thanks Dominik. I've added some more comments on the logs to provide more clarity, can you please have a look?
CL 0 15:09:49.881 TestEA v00.04 (EURUSD,M5) 2020.04.10 17:59:00 Journal|Trading|Trade:Open, Type:ORDER_TYPE_BUY, PO_positionTicket0:4, EntryPrice:1.09506, EntryVolume:0.02000 // This is the log for entering the trade with ticket #4 CJ 0 15:09:49.881 TestEA v00.04 (EURUSD,M5) 2020.04.10 17:59:00 Journal|Debug|PO_id:EURUSD|TREND_UP, PO_symbol:EURUSD, PO_direction:TREND_UP, PO_validity:true, PO_positionTicket0:4, PO_exitTicket0:0, PO_stopLoss:1.09438, PO_orderstatus:MO_PENDING // This is the log for entering the trade LS 0 15:09:49.881 TestEA v00.04 (EURUSD,M5) 2020.04.10 17:59:00 OnTradeTransaction function triggered // This part was triggered by the 'OnTradeTransaction' Function on TestEA.mq5, I've added this to see if I can use the 'Ontrade Transaction' to capture the intended ticket number DN 0 15:09:49.881 TestEA v00.04 (EURUSD,M5) 2020.04.10 17:59:00 OnTrade function triggered // This part was triggered by the 'OnTrade' Function on TestEA.mq5, I've added this to see if I can use the 'Ontrade Transaction' to capture the intended ticket number JL 0 15:09:49.881 TestEA v00.04 (EURUSD,M5) 2020.04.10 17:59:00 OnTradeTransaction function triggered JS 0 15:09:49.881 TestEA v00.04 (EURUSD,M5) 2020.04.10 17:59:00 OnTrade function triggered HI 0 15:09:49.881 TestEA v00.04 (EURUSD,M5) 2020.04.10 17:59:00 OnTradeTransaction function triggered HD 0 15:09:49.881 TestEA v00.04 (EURUSD,M5) 2020.04.10 17:59:00 OnTrade function triggered FJ 0 15:09:49.881 TestEA v00.04 (EURUSD,M5) 2020.04.10 17:59:00 OnTradeTransaction function triggered QD 0 15:09:49.891 TestEA v00.04 (EURUSD,M5) 2020.04.10 18:12:42 Trigger:TRIGGER_EXIT_STOP_LOSS // This part was triggred by the line 'case ORCA_TRIGGER_EXIT_STOP_LOSS:' onthe Expert.mqh which is triggered on the 'OnTick' function on the TestEA.mq5. OD 0 15:09:49.891 Trade 2020.04.10 18:12:42 requote 1.09430 / 1.09434 / 1.09430 (instant sell 0.02 EURUSD at 1.09438) // This was the initial attempt to close but failed due to requote LK 0 15:09:49.891 Trades 2020.04.10 18:12:42 requote 1.09430 / 1.09434 (instant sell 0.02 EURUSD at 1.09438, close #4 buy 0.02 EURUSD 1.09506) HI 0 15:09:49.891 TestEA v00.04 (EURUSD,M5) 2020.04.10 18:12:42 sleeping on requote // This was my attempt to see if I can recapture the closing ticket after the requote. Please see 'CTradeCustom::Sell' function GD 0 15:09:49.891 TestEA v00.04 (EURUSD,M5) 2020.04.10 18:12:43 sleeping on requote FS 0 15:09:49.891 TestEA v00.04 (EURUSD,M5) 2020.04.10 18:12:44 sleeping on requote EN 0 15:09:49.891 TestEA v00.04 (EURUSD,M5) 2020.04.10 18:12:45 sleeping on requote DM 0 15:09:49.891 TestEA v00.04 (EURUSD,M5) 2020.04.10 18:12:46 sleeping on requote RJ 0 15:09:49.891 TestEA v00.04 (EURUSD,M5) 2020.04.10 18:12:47 Encountered error! retcode:10004, retcode_external:0 //Please see 'CTradeCustom::Sell' function DH 0 15:09:49.891 TestEA v00.04 (EURUSD,M5) 2020.04.10 18:12:47 Journal|Trading|Unable to close position for ticket:4 //Please see 'CTradeCustom::Sell' function OP 0 15:09:49.891 TestEA v00.04 (EURUSD,M5) 2020.04.10 18:12:47 Ticket=0 // Returned value of the funtion 'CTradeCustom::CloseByTicket' under Trade.mqh NK 0 15:09:49.891 Trade 2020.04.10 18:12:47 instant sell 0.02 EURUSD at 1.09430, close #4 (1.09430 / 1.09434 / 1.09430) // Attempt to close again. FF 0 15:09:49.891 Trades 2020.04.10 18:12:47 deal #5 sell 0.02 EURUSD at 1.09430 done (based on order #5) // Succeded in closing the trade. This deal #5 is the closing ticket for #4. ticket #5 is the one I wanted to capture HK 0 15:09:49.891 Trade 2020.04.10 18:12:47 deal performed [#5 sell 0.02 EURUSD at 1.09430] NR 0 15:09:49.891 Trade 2020.04.10 18:12:47 order performed sell 0.02 at 1.09430 [#5 sell 0.02 EURUSD at 1.09430] PR 0 15:09:49.893 TestEA v00.04 (EURUSD,M5) 2020.04.10 18:12:47 OnTradeTransaction function triggered PQ 0 15:09:49.893 TestEA v00.04 (EURUSD,M5) 2020.04.10 18:12:47 OnTrade function triggered NO 0 15:09:49.893 TestEA v00.04 (EURUSD,M5) 2020.04.10 18:12:47 OnTradeTransaction function triggered FR 0 15:09:49.893 TestEA v00.04 (EURUSD,M5) 2020.04.10 18:12:47 OnTrade function triggeredIt would seem that the successful dea#5 was triggred from the 'broker' side (this was run on the strategy tester). Initially i thought is was rerun (i.e. the trigger to close on stop loss and the succeeding functions were run again) on the new tick but this wasn't the case. I tried
// printf("new tick");
on the 'OnTick' function of the TestEA.mq5 but nothing was logged just before deal#5 was executed.
You need to do another Sendorder.
It does not change anything, adding more log Output.
Dominik Egert:
You need to do another Sendorder.
It does not change anything, adding more log Output.
I've updated my previous comment to include the following
It would seem that the successful deal#5 was triggred from the 'broker' side (this was run on the strategy tester). Initially i thought is was rerun (i.e. the trigger to close on stop loss and the succeeding functions were run again) on the new tick but this wasn't the case. I tried// printf("new tick");
on the 'OnTick' function of the TestEA.mq5 but nothing was logged just before deal#5 was executed.
I have to add, the new price was well within the deviation.
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
I appreciate any help guys. Thank you!