Problem with OnMarketData() - NinjaTrader Programming | futures io social day trading
futures io futures trading


Problem with OnMarketData()
Updated: Views / Replies:3,786 / 35
Created: by ketron82 Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

Problem with OnMarketData()

  #21 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,238 since Jun 2009
Thanks: 29,350 given, 83,217 received


rleplae View Post
Hello @ratfink

I am on IQfeed

Is there any risk that data comes in, that is back-fill data ?
I thought there was a mechanism, during a spike, when too much data comes, that IQfeed will try to catch
up with the most recent and then later fill in the gap ?

The code seems to build on the fact that data always comes in sequential

IQFeed always delivers ticks in sequence. It's also over TCP, so guaranteed delivery. Other broker type feeds like Rithmic for example don't guarantee in-sequence ticks, and also use UDP. That particular feed also routinely drops Level 2 updates, sacrificing quality for speed (since it is a broker execution feed, not a data feed).

There should never be a "spike" with "too much data". I've documented elsewhere on the forum that even running 200 concurrent symbols will still use minimal bandwidth, IIRC it was less than 1 Mbps. Now, if your platform is not threading correctly or is delayed by bad code (indicator) then of course it just means things will get slow, but the issue is definitely not with IQFeed in this case.

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
The following 2 users say Thank You to Big Mike for this post:
 
  #22 (permalink)
Elite Member
Atkinson, NH USA
 
Futures Experience: Intermediate
Platform: NinjaTrader 8/TensorFlow
Broker/Data: NinjaTrader Brokerage
Favorite Futures: Futures, CL, ES, ZB
 
NJAMC's Avatar
 
Posts: 1,925 since Dec 2010
Thanks: 2,962 given, 2,294 received


Big Mike View Post
IQFeed always delivers ticks in sequence. It's also over TCP, so guaranteed delivery. Other broker type feeds like Rithmic for example don't guarantee in-sequence ticks, and also use UDP. That particular feed also routinely drops Level 2 updates, sacrificing quality for speed (since it is a broker execution feed, not a data feed).

There should never be a "spike" with "too much data". I've documented elsewhere on the forum that even running 200 concurrent symbols will still use minimal bandwidth, IIRC it was less than 1 Mbps. Now, if your platform is not threading correctly or is delayed by bad code (indicator) then of course it just means things will get slow, but the issue is definitely not with IQFeed in this case.

Mike

@Big Mike,

Were you subscribed to the L2 data for all 200 symbols or just the L1?

Nil per os
-NJAMC [Generic Programmer]

LOM WIKI: NT-Local-Order-Manager-LOM-Guide
Artificial Bee Colony Optimization
Reply With Quote
 
  #23 (permalink)
Elite Member
Birmingham UK
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: IG/eSignal
Favorite Futures: Dax
 
ratfink's Avatar
 
Posts: 3,336 since Dec 2012
Thanks: 11,276 given, 7,090 received


Hi Ron, @rleplae

Just in case this is causing any confusion it is worth a mention/reminder of the stupid timestamping issue in Ninja, remember that Ninja time-based bar series get timestamped with a *future* timestamp. This is annoying, to say nothing of being inconsistent with both it's own other bar types and the real world.

So, for example, the first tick of a new bar in a 15 minute series opening at 16:00 will be timestamped 16:15:00, and that timestamp will not change for any subsequent ticks in that same bar. In the meantime the first tick of a new bar in a 5 minute series will get 16:05:00 and same for subsequent, the first and subsequent ticks for the new 1 minute series will get 16:01:00, the first tick of a 12 second series will get 16:00:12, the first tick of it's next bar will get 16:00:24, etc, etc. So you can appear to be getting backfilling data across different series, but you aren't, tedious isn't it, but at least easy to handle/correct for the external world once you know.

The 'apparent' time of other bar type series events is also not guaranteed or consistent either, e.g. a 200 volume series can appear to open before a 1 or 5 volume series, so assume nothing and be not disappointed. Likewise order of bar processing across charts is not preseved across Ninja saves/restores, so again, make no assumptions.

Cheers

Travel Well
Reply With Quote
The following user says Thank You to ratfink for this post:
 
  #24 (permalink)
Elite Member
Birmingham UK
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: IG/eSignal
Favorite Futures: Dax
 
ratfink's Avatar
 
Posts: 3,336 since Dec 2012
Thanks: 11,276 given, 7,090 received

Hi Ron @rleplae,

This is my current adjustment I use with a dynamically allocated array system I use to talk elsewhere with:

 
Code
	DateTime t = Bars.GetTime(CurrentBar);
					
	// correct for Ninja's stupid use of future timestamps on time based series, other's are ok
	if (BarsPeriod.BasePeriodType == PeriodType.Minute)
	{
		t = t.AddMinutes(-BarsPeriod.BasePeriodValue);
	}
	else if (BarsPeriod.BasePeriodType == PeriodType.Second)
	{
		t = t.AddSeconds(-BarsPeriod.BasePeriodValue);
	}
There are other smarter ways I'm sure, but I need simple.

Travel Well
Reply With Quote
The following user says Thank You to ratfink for this post:
 
  #25 (permalink)
Elite Member
Birmingham UK
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: IG/eSignal
Favorite Futures: Dax
 
ratfink's Avatar
 
Posts: 3,336 since Dec 2012
Thanks: 11,276 given, 7,090 received


NJAMC View Post
... but with the Data/Depth tick data. The problem only occurs when you have MTF with the same instrument with different time periods. The BIP will not be updated properly on these calls.

Thanks for the heads-up, that's also irksome.

Travel Well
Reply With Quote
 
  #26 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,238 since Jun 2009
Thanks: 29,350 given, 83,217 received


NJAMC View Post
@Big Mike,

Were you subscribed to the L2 data for all 200 symbols or just the L1?

L2

Sent from my phone

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
The following user says Thank You to Big Mike for this post:
 
  #27 (permalink)
Elite Member
Manchester, NH
 
Futures Experience: Beginner
Platform: thinkorswim
Broker/Data: TD Ameritrade
Favorite Futures: Stocks
 
Posts: 902 since Jul 2012
Thanks: 603 given, 1,785 received

TCP guarantees in-order delivery, so it is true.


Last edited by artemiso; March 19th, 2015 at 02:03 PM.
Reply With Quote
The following 4 users say Thank You to artemiso for this post:
 
  #28 (permalink)
Elite Member
Omer עומר / Israel י
 
Futures Experience: Master
Platform: NinjaTrader, Proprietary,
Broker/Data: Ninjabrokerage/IQfeed + Synthetic datafeed
Favorite Futures: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
 
rleplae's Avatar
 
Posts: 2,472 since Sep 2013
Thanks: 1,696 given, 3,663 received
Forum Reputation: Legendary

no issue


artemiso View Post
If I understand your questions correctly, it is really three-fold: (1) You are asking if the "live" data is mixed with "historical data", and (2) if it is not mixed, you want to know if the "live" data is guaranteed to be in correct sequence. (3) Regardless of the order of data, you want to know if a "spike of data" is an issue.

Regarding (1), historical backfill and L1/L2 subscription are treated as different requests, so you will never receive a mix of historical and "live" data. In a C++ implementation:

 
Code
void IQLevel1Controller::subscribeToSymbol(const string &symbol) {
    boost::format formatter("w%1%\r\n");
    string message = str(formatter % symbol);
    tcpClient->write(message);
}


 
Code
void IQHistoricalLookupController::getHistoricalTickDataForSymbol(const string &symbol) {
    boost::format formatter("HTT,%1%,%2%,%3%,,,,1,%4%\r\n");
    string message = str(formatter % symbol % beginTimeString % endTimeString % DATA_MESSAGE_PREFIX);
    tcpClient->write(message);
}


Regarding (2), TCP has a handshake mechanism that guarantees in-order delivery, so it is true that the data always comes in a stream in the same sequence as it was sent to you.



Thanks Artisimo

I was aware about IQfeed back-fill capability (that was the reason for me to take IQfeed,
because of OFA indicator, that seemed to work best with that data stream), but have not
been coding it low level enough.

You clearly explain how it works.... as another stream

I did not run into any issue, but because i knew back is possible, but didn't know how it
worked i was just checking if my work would still work in live.
The answer is clearly yes from all sides

regards,
Ron

Reply With Quote
The following user says Thank You to rleplae for this post:
 
  #29 (permalink)
Elite Member
Manchester, NH
 
Futures Experience: Beginner
Platform: thinkorswim
Broker/Data: TD Ameritrade
Favorite Futures: Stocks
 
Posts: 902 since Jul 2012
Thanks: 603 given, 1,785 received


Big Mike View Post
Now, if your platform is not threading correctly or is delayed by bad code (indicator) then of course it just means things will get slow, but the issue is definitely not with IQFeed in this case.

Also, just to clarify, there's very little that your program can do to optimize this further.


Last edited by artemiso; March 19th, 2015 at 02:04 PM.
Reply With Quote
The following user says Thank You to artemiso for this post:
 
  #30 (permalink)
Elite Member
Manchester, NH
 
Futures Experience: Beginner
Platform: thinkorswim
Broker/Data: TD Ameritrade
Favorite Futures: Stocks
 
Posts: 902 since Jul 2012
Thanks: 603 given, 1,785 received


@rleplae You're welcome.

Reply With Quote
The following user says Thank You to artemiso for this post:

Reply



futures io > > > > > Problem with OnMarketData()

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
CalculateOnBarClose = false versus OnMarketData() MWinfrey NinjaTrader Programming 8 September 30th, 2013 01:52 PM
OnMarketData Problem humy65 NinjaTrader Programming 3 October 16th, 2012 11:17 AM
OnMarketData serious issue baberg NinjaTrader Programming 13 September 27th, 2011 10:04 AM
BUG for OnMarketData timmyb NinjaTrader Programming 12 February 5th, 2011 10:32 PM
Programming Indicators Using OnMarketData in NT7!!! RJay NinjaTrader Programming 3 December 16th, 2010 01:16 PM


All times are GMT -4. The time now is 05:03 PM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2017-12-11 in 0.14 seconds with 19 queries on phoenix via your IP 54.226.132.197