Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
NinjaScript is C# not C++ so if you are serious about development I recommend you study the NinjaScript reference manual, and the many online tutorials that Google will throw up.
For your particular track I would recommend looking at the code for the Ninja built-in VolumeProfiles indicator, it uses sorted dictionaries to accomplish what I think you look for. I have used it as a basis to build simple multi-pane profiles and rolling profiles myself. You should also find a lot of other great work here on futures.io (formerly BMT) already, but I know how satisfying it is to get under the hood yourself!
Many thanks...Yes C# is not a C++...I use a reference manual but I have to make more experience with the C#...I'm studing!
For now....I think that I will use a DrawRectangle() or similar to draw what I need ....!
I'm using at moment 3 monodimensional array for store ask and bid volume traded for every price but I know that monodimensional array can store only 256 values....so I need to use a Class.
In this moment I only need to test what I want and monodimensional arrays working good in intraday (more of 256 points at day is very hard for every classic instrument like currency or index).
Only trouble regarde the delay time spent in sorting the arrays. I will use a simple sort or boubble sort or other ( is there a library or function to do that?) and I hope that in this way I will not lose tick under market acceleration.
Any comment is appreciated.
No need to use anything other than the built-in C#/System/.Net SortedDictionary type classes that are used for example in the VolumeProfiles indicator I mentioned, there are many other routes available too.
With regard to performance - on a modern multi-gigahertz cpu you won't even notice it running, in the VolumesProfiles case for example the SortedDictionary is maintained in state on every addition and completely traversed for a full direct redraw every time the custom Plot method is called, but since the latter is at user speed (e.g fractions of seconds not milli or micro seconds) it is effectively invisible.
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
Because i am currently on replay data, that will be correct, but i was curious if you had any
experience or comments, in case you run it live and during a spike, when lots of data comes
will that still work correctly ?
I have not seen back-filling occur on forward testing on Continuum (NT Broker). I do want to caution you as you started working with MTF something that wasn't clear to me. This function will be called for each timeframe. If the instrument is the same for the MTFs you will get multiple calls in a row with the same data, you will need to filter this out. So if you have a 1 Min primary and a 5 min as your 2nd timeframe, you will get two calls to this function. Same with the depth function as well. The BIP flag didn't seem to get updated properly because the instrument is the same for each timeframe. My understanding is it works better for different instruments in a MTF but I haven't tested this yet.
Hi Ron, as far as I am aware live data should always be presented in-sequence, any slow down caused by application sloth should be just that, a slowdown at the user presentation level. I do not use IQFeed myself but would be very surprised if they did anything to interfere with sequential trade processing order in low level data handling.
Cheers (i'm awol at the moment but your mention worked, alway sgood to hear from you, I am slowly getting nearer to dropping discretionary playtimes and letting the robots take over..., luckily gardens and mowers have interrupted plans for now.)
@NJAMC, fwiw I have yet to see BarsInProgress not be updated correctly even in large MTF situations with 30-40 instruments, with or without many of the same instrument with different bar types or timeframes, it just needs care to see what you should see, always remembering of course that you do have to do it the Ninja way. [edit: I will qualify that statement as the evidence is more from OnBarUpdate than from OnMarketData, I do use both heavily and have not seen issues]
Hello @NJAMC
I am not running into that issue, because i have 3 charts with 3 strategiess, all mono time-frame but different from each other. the 2 auxiliary strategies post data using JSON to a stand-alone process and the first strategy polls that process (as other stuff is sitting there also that gets pulled in)
but i understand your point...
The issue is not with OnBarUpdate, but with the Data/Depth tick data. Most will not notice the issue, but if you are totaling incoming data, you will get 2X, etc more than expected. 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. Different instruments may work fine as that seemed to be the original intent/design of the interface. I have not worked much with different instruments and these low level functions.