| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| OCO script has inconsistent behavior https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=649 |
Page 1 of 1 |
| Author: | garyfritz [ Mon Jun 25, 2012 5:47 pm ] |
| Post subject: | OCO script has inconsistent behavior |
Some months ago, George (TIG) knocked out a quick script for me to implement OCO (Order Cancels Order) behavior. I place two breakout trades around the current price, and when one fills, the other should be canceled. The script stays in a start() loop until one of the orders fills, then it cancles the other and exits. The script behavior has always been a bit flaky. Usually it cancels the orders correctly, but sometimes it doesn't, and neither George nor I could figure out why. Last night I had something really bizarre happen that I can only think was the script. I had several OCO orders open, and one of them canceled BOTH orders before either had been hit. (I checked with my broker and they said the cancel request came from the same IP as the original order.) *I* sure didn't cancel them manually. We had a raging thunderstorm at just about the time the orders were canceled, but I can't see how power or net glitches could cause the script to think it should cancel. And, of course, the trade would have been a winner. This stuff never happens on losing trades... Can anyone figure out why this thing misbehaves? Or does someone have a good reliable OCO script? |
|
| Author: | dietcoke [ Mon Jun 25, 2012 9:11 pm ] |
| Post subject: | Re: OCO script has inconsistent behavior |
Did they cancel together or with a big gap? and how long after they were opened did it happen? I would consider using matts OR library for the orders and leave the error handling to that. The only ways I can see both orders being cancelled are: 1) if the Alt+X escape keys are pressed. 2) If the Orderselect() function fails to read the pending ticket multiple times and hits the error limit |
|
| Author: | garyfritz [ Mon Jun 25, 2012 11:26 pm ] |
| Post subject: | Re: OCO script has inconsistent behavior |
I placed the orders at about 01:00 GMT+3, and they were canceled at 07:18 and 07:19. Close together, but not exactly at the same time. Maybe one was 07:18:59 and the other was 07:19:00, but... I don't THINK I hit Alt-X on it! I don't remember even opening that Empty4 last night. Maybe the storm caused a net outage that caused the Orderselect() to fail? But I've had outages plenty of times and this has never happened before. I've successfully executed over 50 orders with this script. No inspiration of why it sometimes doesn't cancel the "didn't get hit" order? |
|
| Author: | chimera [ Thu Jul 12, 2012 9:33 pm ] |
| Post subject: | Re: somewhat related |
Hey Is there any way that i can bother you for OCO related code. Have this script made in to a reliable EA, executing on open of new bar if no trades are found. Distance from price, MagicNumber, TP, SL as the extern parameters. Chi |
|
| Author: | garyfritz [ Thu Jul 12, 2012 9:55 pm ] |
| Post subject: | Re: OCO script has inconsistent behavior |
I'm not in a position to convert/upgrade this thing right now. Maybe somebody else will volunteer to convert it to the ReliableOrder library calls but right now I just can't. |
|
| All times are UTC | Page 1 of 1 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|