Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
get the bid ask volume inside the bar from the example
Collapse
X
-
Hello Pole123,
It would only be changing if the ask and bid are updating at that price. Likely the ask and bid are updating at a different price.
The values from a script will be the same values the bar type is showing on the chart (albeit one tick behind due to the sequence of events) in both real-time and historical.
The volume in historical comes from ask/bid time stamped historical tick data.Chelsea B.NinjaTrader Customer Service
Comment
-
Test it yourself, i made it print each tick , if you see its constant for each price level. I would like to know how those are calculated in historical stateAttached FilesLast edited by Pole123; 10-25-2023, 03:02 PM.
Comment
-
Hello Pole123,
I am not able to reproduce, the values are not static in realtime.
Below is a link to a video that shows this is not the case.
https://drive.google.com/file/d/1srK...w?usp=drivesdk
Below is a link to the help guide on Volumetric.
https://ninjatrader.com/support/help...tric_bars2.htm
Calling Volumetric data does not require adding a 1 tick series. The Calculate.OnEachTick would be updating the values for each tick (and the close price of BarsInProgress 1 could be used.
As a tip, to export a NinjaTrader 8 NinjaScript so this can be shared and imported by the recipient do the following:- Click Tools -> Export -> NinjaScript Add-on...
- Click the 'add' link -> check the box(es) for the script(s) and reference(s) you want to include
- Click the 'Export' button
- Enter a unique name for the file in the value for 'File name:'
- Choose a save location -> click Save
- Click OK to clear the export location message
- (My) Documents/NinjaTrader 8/bin/Custom/ExportNinjaScript/<export_file_name.zip>
http://ninjatrader.com/support/helpG...nt8/export.htmChelsea B.NinjaTrader Customer Service
Comment
-
For me it just happens with the historical data, when connected to tradovate which should be CQG
Comment
-
Hello Jim,Originally posted by NinjaTrader_Jim View PostHello memonolog,
Please see the modifications attached. I use two Series<Dictionary<double, double>>'s to track bid/ask volume at price for every bar.
Somethings to keep in mind:
Anything Series related should only be done in SetValues. If not, you will hit errors since the Dictionary<double, double> is synchronized to the primary data series and CalculateValues is processed in BarsInProgress 1.
To work around this, I create temporary class level dictionaries to hold what is being calculated.
I then create the Dictionaries from the Series in SetValues and then I copy KeyValuePairs from the temporary dictionary to the Series dictionaries.
Thank you for the example. It helps me a lot!
It seems, that 0 asks/bids at a price level are not added to the Dictionary Series. After your Temp Series has been assigned to the Ask/Bid series, i sort the lists by price. When I print the Asks/Bids per price, I do not see any 0s and also the Count of the list is less then the prices per bar. I'm not able to figure out, why that is the case. I do want to have the 0s also in the list. Any idea why that might be the case. I add mockup and hoepfully it explains what the issue is.
Many Thanks !
Comment
-
Hello Stefan Mayer,
When the Volumetic is showing a 0, this means there was no ask (or bid depending on which side) update to add to the dictionary.
You could change the logic to add a volume of 0 for the ask when the bid updates if there is no value at that price level index in the dictionary.Chelsea B.NinjaTrader Customer Service
Comment
-
Hi Chelsea,
Sorry, I don't understand your reply fully.
All of that is done without Volumetric. The Footprint is done/shown with another indicator so i can visualize the data and check my own code, which is based on Jims example.
The dictionary is build by the Indicator itself (Example Indicator from Jim). So what ever the reason is, when adding the volume and the price to the Dictionary, the 0 once (Bid or Ask) are not added and I don't know why? Because when i put a Print check in the code, the volume never is 0; so somewhere before Getting the data, the 0 must be filtered out already.
Comment
-
Hello Stefan Mayer,
The dictionary has elements added when there is an ask or bid update. All of the ask and bid updates have volume. If there is no ask or bid update, there is nothing added to the dictionary.
Because you want values of 0, meaning no update, you would want to just add these with a volume of 0. If there is an ask update and no bid update, add to the bid dictionary a volume of 0 at that price.Chelsea B.NinjaTrader Customer Service
Comment
-
Hello Chelsea,
thank you for you very fast reply. Since I have some missing knowledge when working with ticks, I want to thank you for your patience and helping closing my knowledge gap in that area.
I understand that for 0 no update will be done, but that means, the CalculateValues() method is never called for it, correct? So only after the Bar has closed I'm able to identify the missing price in one of the Dictionaries by searching the 2 Dictionaries, and check if a price exists in both, if not, then i need to add it. Do you see this as the correct approach?
And if Bid and Ask are 0, then the price will not appear in any list; which means, i need to check from Bar High to Bar Low for every possibel price in-between and check if it exists?
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
577 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
334 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
553 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
551 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment