Jim Dean
 Sage
       Posts: 3433
Joined: 3/13/2006
Location: L'ville, GA
User Profile |
Goals:
1. Stop should show the same exit point in OT voteline simulation, OT charts, and from real-broker execution.
2. Stop should work with Market or with Virtual-Level Stop-Market.
3. Only ONE stop-line should be visible, when one is painted by the code, and the other by the real-time engine.
4. Historical simulation of the stop should MATCH what the real-life execution shows.
5. Stop must work in Intraday RT mode, Daily RT mode, EOD mode with multiple downloads during the day, and EOD mode with downloads only at night.
We wrote up a "simple" stop for testing ... this stop is actually a pretty good one to use, btw. It's called the "BarToBar Simple Stop" ... it's described in the code-comments shown below.
We ran into problems immediately, when we started testing this. The original code was somewhat different ... as we learned things, we made changes, and finally, FINALLY arrived at a workable solution. The odyssey is chronicled at:
http://www.omnitrader.com/omnitrader/proforum/thread-view.asp?threadid=2786&forumid=2&MessageID=0
The originally-documented problems seem to have been dealt with in all but a small number of cases ... and those instances are ones that can be attributed to SLIPPAGE. The slippage occurs between the time the solid-triangle bar appears, and the time the trade chevrons (or button) are placed, and the time that the broker actually gets the order, and the time that the broker actually fills the order.
If the user's reaction time is very fast, and if the stock is adequately liquid, and if the commo time to the broker is unimpeded, then 95% of the tests all show the same bar as broker exit and simulation (voteline) exit. We have not tested this with OmniPilot ... presumably its "reaction time" could be better ... if anyone wants to dive in and contribute to this journey using OP with a real broker, please do!
We've tested this with OT's paper broker and have had ZERO issues. We've tested it with Interactive Brokers and have seen a FEW issues, related to the slippage / reaction-time comments above. But, from our perspective, this puts the thing to rest.
QUALIFIERS: we have tested this for Market and Virtual-Level Stop Market orders ... not limit orders. We have tested this with Real Time feed, on one-minute bars. We've tested it with OT's Paper Broker and with Interactive Brokers via the Integrated Brokerage. We have NOT tested it with MB Trading, nor have we tried it with EOD feed that is downloaded multiple times per day. As far as we know, those other uses should work.
PROGRAMMERS: Please carefully read the five "Notable Lessons Learned" in the comments ... you WILL want to incorporate this info into your own stops.
Many thanks to Curtis Cooper, Matt Greenslet, and Buffalo Bill Leake, who all provided valuable assistance and contributions to this project.
"Gentlemen, the Eagle has landed!"
The RTF attachment holds the actual code, suitable for copy/paste into OT.

[Edited by Jim Dean on 3/28/2015 7:23 AM]
Attached file : aJDstBarToBarSimple.rtf (3KB - 995 downloads)
Attached file : aJDstBarToBarSimple - CodeSnap.png (66KB - 1719 downloads)
|