Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.


  • Content Count

  • Joined

  • Last visited

Personal Information

  • First Name
  • Last Name
  • City
  • Country
  • Gender

Trading Information

  • Vendor
  1. I was wondering if you are still on traders lab, and would send some code to a newbie to help them get started on a project with a zenfire c# api with multithreading and a connection to SQL

  2. Zen-Fire has a .NET API and you can request a free demo account.
  3. This is the tutorial I used when writing my Zen-Fire API connector (C#). Can't recommend it highly enough. If you'd like some code, PM me. Since I come from a messaging/integration background, I naturally created a single 'hub' that would receive ticks from Zen-Fire, and I then distribute to interested 'tick sinks' (which are plugins). Some tick sinks are files, others are the console itself, others are trading programs etc. This saves having to rewrite sections of code and manage multiple connections. By far the largest issue was reconnection after a connection failure. The API is meant to take care of it internally, but it simply doesn't always work. I had to resort to actually killing my daemon and restarting it. This works nicely Note that Zen-Fire is definitely not thread-safe. All access to its events etc should be single threaded. This is especially important for GUI applications (which I try and avoid).
  4. No problems AgeKay, just wanted to be sure you understood the difference between the API blocking and your event thread queuing. Regarding Zen-Fire, the suggestion from FulcrumTrader is that the order book updates might come out of sequence with regards to the trades themselves, causing a mild discrepancy that over time could build up when one is doing bid-ask cumulative delta work. However, you need to ask yourself whether this affects you. If you look at, say, a Ninja DOM when connected to Zen-Fire, the frequency of updates is quite good. Is this guaranteed to be in the same order that is disseminated by the exchange? I'd be amazed if it was. But is it good enough for what you want to do, given that it's free and easy to program to? As always, it might be more prudent trying what's free and easy before attempting to expensively solve a problem you may never have.
  5. Zen-Fire should do this, or at least seems to based on my usage of the API - even though I never used it for the level 2 feed (order book). Although I very strongly recommend that you don't block the API even if you don't want to process the events immediately (ie you need guaranteed synchronous processing). I used a thread to pull the events from the API and place them in a local memory queue (actually a Queue in C#) and then processed them from that queue. If the API itself does it, all good and well - I'm just saying that it's not a requirement and none that I know do it (most APIs are geared towards technologically advanced users, all of which have their own methods for synchronising threads and prefer to retain control over it). Best part: Zen-Fire API access is free. Can't comment on quality of data though.
  6. NeoTicker :-) Great piece of software if you know how to use it. You can google "Time Distribution Analysis" along with "NeoTicker" for an idea of how I did these tests (although I rewrote that indicator to allow it to do quite a few extra bits and pieces).
  7. My apologies if I didn't make this clear earlier - I've been running many different tests other than the one I posted the full breakdown for. I find the full breakdown unnecessary unless there is an interesting 'time' component to the results. So where I'm spitting out percentages, they are generally based on different tests which I've tried to articulate. Testing how the day closes compared to both the previous days close and the current days open is the last set of tests I did, as per the clarification you highlighted. This is different to the initial run. I may start another thread on ES statistics if there are questions people would like answered, especially regarding intraday tendencies based on contextual setups (setups can be both intraday and across many days, and can include complex analysis such as market profile for example). I could use the research practice, I'm a bit rusty. Anyway, back to your regular scheduled programming.
  8. Without the 'trending' criteria I outlined earlier, compared to the open it will close in the direction of the gap between 50% and 55% (no edge). Compared to the previous days close, it will close in the direction of the gap between 70% and 75% of the time (if the gap isn't closed in the first 30 minutes). Now, if I add the trending component (only on 30 minute bars again), the chances of closing up are 85% (compared to previous close) and 65% to 70% compared to current open. There are two options here: - Vic's stats are wrong - His stats were right in his time and the market has changed If I were to write a TVGR for today's ES market (note that's the only market I analysed, being short on data and time), it would say: "If the first 15 to 30 minutes of market open trends in the direction of the gap, then there is greater than 80% chance the market will close in the direction of the gap for the day. Furthermore, there is only between 25% and 35% chance the gap will fill at all during the day. This is in stark contrast with the usual gap fill chance of 70%". As it stands, I believe much of this phenomenon has to do with the distance the market is away from the gap at the point that these statistics kick in. There is already a very strong correlation between gap size and gap fill chance. I wouldn't be surprised to find that these stats are indicative of the percentage chance of a reversal move of N points being made once a market closes twice in any direction. I may yet test this...
  9. Interesting concept for an automated system ;-)
  10. Just one addendum to the above, gap closures once the first 30 to 60 minutes have played out happen at any point during the day - fairly random distribution, slightly correlated to the expected volatility at that time of day. That is, for the 30% of days that defy the odds and close the gap, it can happen at any point. So be mindful of the reversal...
  11. Interesting observations. I tested this in various ways (gaps up only at first): 1. Market opens, first 15 minute bar doesn't close gap and closes up, second 15 minute bar breaks above first bar high. Chance of gap closure by close? 37%. This happens on 7% of days. 2. As above, but market opens above previous day high (big gap up). Chance of gap closure by close? 27%. This happens on almost 3% of days. 3. As above but using first and second 30 minute bar instead and odds drop to 29% and 24% respectively. This is expected since an OR30 breakout is more directional than a OR15 breakout, and there's less time in the day. Of course, this happens slightly less often. 4. If we consider the odds provided above in order as 37%, 27%, 29%, 24% - the corresponding odds for gaps down are 32%, 23%, 25%, 23%, so marginally less likely to close. These happen happen about as often (6% to 8% for regular gap downs, 2% to 3% for gaps below previous days low). I hope everyone is clear how useful this information is. On around 15% of days, the market will gap and break out of its 15 or 30 minute opening range away from the gap. If this breakout bar also closes away from gap, you would want a lot of momentum back towards the gap to trade against this TVGR. The numbers are good - not 90% to 95% good, but good enough to not trade against without good reason.
  12. Heh, I guess I'll try to be clearer. Odds of gap filling: 70% Odds of gap filling in first 15 minutes: 30% Therefore, odds of gap filling after first 15 minutes: 40% So, if gap doesn't fill in first 15 minutes (30% of days), there are still two options. One option is that the gap fills some other time in the day. This happens on another 40% of days. The second option is that the gap doesn't fill at all. That happens on the last 30% of days. In any 10 days, 3 days the gap will fill in 15 minutes, 4 days it will fill in the rest of the day, 3 days it will not fill at all. I didn't mean to derail the thread, but I hope this is clear. This was run on futures data so 4:15pm close was taken. Yes, on rollover this may cause slight discrepancies but this hardly effects the odds.
  13. I understand. Vic's odds are still wrong (but may have been right at the time..). If we just look at gaps that close (70% of days), 50/70 of those (about 70%) close in the first hour. In the first 15 minutes, only 30/70 (43%) close. Vic states 90% to 95%, not 43%. I'm completely ignoring the days that don't close the gap at all. I'm also not considering the final close for the day, just whether the gap is filled. Perhaps he doesn't care about the gap fill, but just the final close. Personally, I want to know where price shouldn't visit, rather than just where it might end up. Stats for where it closes would be worthwhile to run. If I'm still missing something, please point it out. Otherwise, while TVGR is still a very useful rule, one must understand the true odds.
  14. I don't normally post in this thread but follow it most days. Just wanted to comment on TVGR since it's come up a bit recently. Over the last 6 years on the ES I ran the time distribution for when a gap is closed: Days - 2269 Total - 1557 / 2207 ( 70.5%) Bars (Count) ( Pct) ( AccPct) Histogram 3 ( 648) ( 29.4%) ( 29.4%) ############### 6 ( 188) ( 8.5%) ( 37.9%) #### 9 ( 154) ( 7%) ( 44.9%) ### 12 ( 79) ( 3.6%) ( 48.4%) ## 15 ( 75) ( 3.4%) ( 51.8%) ## 18 ( 51) ( 2.3%) ( 54.1%) # 21 ( 36) ( 1.6%) ( 55.8%) # 24 ( 28) ( 1.3%) ( 57%) # 27 ( 16) ( .7%) ( 57.8%) 30 ( 25) ( 1.1%) ( 58.9%) # 33 ( 16) ( .7%) ( 59.6%) 36 ( 22) ( 1%) ( 60.6%) 39 ( 18) ( .8%) ( 61.4%) 42 ( 9) ( .4%) ( 61.8%) 45 ( 19) ( .9%) ( 62.7%) 48 ( 20) ( .9%) ( 63.6%) 51 ( 12) ( .5%) ( 64.2%) 54 ( 10) ( .5%) ( 64.6%) 57 ( 12) ( .5%) ( 65.2%) 60 ( 16) ( .7%) ( 65.9%) 63 ( 18) ( .8%) ( 66.7%) 66 ( 20) ( .9%) ( 67.6%) 69 ( 15) ( .7%) ( 68.3%) 72 ( 15) ( .7%) ( 69%) 75 ( 17) ( .8%) ( 69.7%) 78 ( 8) ( .4%) ( 70.1%) 81 ( 10) ( .5%) ( 70.5%) The bars column is in 5 minute bars and each row represents 3 bars, so 15-minute periods. This tells us that: 1. 70.5% of gaps close (this is fairly consistently between 65% and 75% most years). 2. 50% of all days close the gap within the first hour - this means another 20% close over the rest of the day (very low odds) and another 30% don't close at all. So, while the original TVGR rules (90% to 95% of gaps close in 15 minutes) aren't quite right, the odds are still against a closure once the first hour has passed. And yes, the above stats mean that just under 50% of gaps that eventually fill will fill in the first 15 minutes.
  15. The image is not showing up for some reason. Other than obvious previous swings, cumulative delta and market profile, I estimate where moves or days ranges might end. I also look using specific methods at where players might be trapped either long or short. I didn't see anything at that high (although there were lots of trapped shorts earlier in the day...). Of course, I didn't look at cash SPX, I'll have a look tonight. Of course, it's usually the most obvious things. I did note that your earlier screenshot showed the limit at 4450 yet here you've entered at approx 4600, I guess you waited for the pause or reversal?
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.