Or do you mean that you're not getting the Last traded price in OnMarketDepth?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Trading on level 2 values
Collapse
X
-
I'm not sure I follow - are you saying you're not getting e.Price and e.Volume at e.Position 0?
Or do you mean that you're not getting the Last traded price in OnMarketDepth?Last edited by NinjaTrader_Matthew; 02-19-2013, 09:09 AM.MatthewNinjaTrader Product Management
-
data stops recording
I can get both, its simply to physically record both the data into 1 .dat file. - I guess what I am asking: is onmarketdept and onmarketdata in sync ? such that lvl2 [0] will be the same in both - with the same time stamp?
another question:
it seems that when I start to record lvl 2 data it suddenly stops recording, the strategy continue running but no data is recorded to the .dat file ... do you know of other who have this issue?
this is the error I get, but the strat has been running for almost 8 hours....
20/02/2013 4:09:29 AM Strategy Error on calling 'OnMarketDepth' method for strategy 'datalvl2/d04d1a4daafd4feabcf75abd84264c68': You are accessing an index with a value that is invalid since its out of range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.
any condition I can place to avert this?
Comment
-
The data files only store data down to the second. As a result, if you have multiple date points with the same second time stamp, they may load out of order. We're looking to add subsecond time stamps to the next major release of NinjaTrader to improve this area.
Who are you connected to during this time? If you check the log/trace files, are there any sudden disconnects around this time?MatthewNinjaTrader Product Management
Comment
-
well thats a bummer.
with patsystem
my output looks like what I placed in attachment.
and then I get the error in my log
20/02/2013 9:48:04 AM Strategy Error on calling 'OnMarketDepth' method for strategy 'datalvl2/d04d1a4daafd4feabcf75abd84264c68': You are accessing an index with a value that is invalid since its out of range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.
which you say would be caused by the lack of ninjatrader being able to deal in increments smaller than 1 sec...Attached FilesLast edited by chancehero; 02-20-2013, 08:27 AM.
Comment
-
what a sloppy job I have donePHP Code:string data_1 = " count : "+count_save + " Time: " +DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff tt") +" data type: "+ e.MarketDataType +" , "+ bidRows[0].Price +" , "+ bidRows[0].Volume + " , " +bidRows[1].Price +" , "+ bidRows[1].Volume + " , " +bidRows[2].Price +" , "+ bidRows[2].Volume + " , " +bidRows[3].Price +" , "+ bidRows[3].Volume + " , " +bidRows[4].Price +" , "+ bidRows[4].Volume + " , " +bidRows[5].Price +" , "+ bidRows[5].Volume + " , " +bidRows[6].Price +" , "+ bidRows[6].Volume + " , " +bidRows[7].Price +" , "+ bidRows[7].Volume + " , " +bidRows[8].Price +" , "+ bidRows[8].Volume + " , " +bidRows[9].Price +" , "+ bidRows[9].Volume + " , " + e.MarketDepth.Ask[0].Price + " , " + e.MarketDepth.Ask[0].Volume+ " , " + e.MarketDepth.Ask[1].Price + " , " + e.MarketDepth.Ask[1].Volume+ " , " + e.MarketDepth.Ask[2].Price + " , " + e.MarketDepth.Ask[2].Volume + " , " + e.MarketDepth.Ask[3].Price + " , " + e.MarketDepth.Ask[3].Volume+ " , " + e.MarketDepth.Ask[4].Price + " , " + e.MarketDepth.Ask[4].Volume + " , " + e.MarketDepth.Ask[5].Price + " , " + e.MarketDepth.Ask[5].Volume+ " , " + e.MarketDepth.Ask[6].Price + " , " + e.MarketDepth.Ask[6].Volume + " , " + e.MarketDepth.Ask[7].Price + " , " + e.MarketDepth.Ask[7].Volume + " , " + e.MarketDepth.Ask[8].Price + " , " + e.MarketDepth.Ask[8].Volume+ " , " + e.MarketDepth.Ask[9].Price + " , " + e.MarketDepth.Ask[9].Volume + Environment.NewLine; File.AppendAllText(log_file_part1,data_1 );
!
Comment
-
Thanks - yes, the error is likely from the DateTime.millisecond you're saving.
We would not be able to support this granularity in our data files. You may consider storing these data in your own database and accessing it from there - although we do not have any support or documentation for this method either.MatthewNinjaTrader Product Management
Comment
-
-
-
question
I have other data recording programs with the .ttt for time stamp , but it only record on
, and no issue.... ? comments?PHP Code:if(e.MarketDataType != MarketDataType.Last) return;
Comment
-
ok so it seems I solved my issue ,I think, I can still use .fff for the time stamp without errors,
am I going to have issue doing:
PHP Code:protected override void OnMarketData(MarketDataEventArgs e) { // when a trade has beem executed, we want to add to the onmarket depth data1 string. if(e.MarketDataType == MarketDataType.Last){ marketdata_step3 = "Last" ; transacted_volume = e.Volume; transacted_price = e.Price; } else{ marketdata_step3 = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; long transacted_volume = 0; double transacted_price = 0; }
and
PHP Code:protected override void OnMarketDepth(MarketDepthEventArgs e) { //.... if(marketdata_step3 == "Last"){ string data_1 = " count : "+count_save + " Time: " +DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff tt") + " data type: "+ e.MarketDataType +" , "+ //.... marketdata_step3 +" ,price sold: "+ transacted_price +" ,quantity sold: "+ transacted_volume + Environment.NewLine; File.AppendAllText(log_file_part1,data_1 ); } else { //.... }
Comment
-
including other instruments
question
as of now I was simply recording and trading 1 instrument.
is it possible to create a strategy that will go through all possible instrument at my disposal? where should I start looking to build this?
right now I have a few different start that records, and a few that trade, all separate, and would like to start recording other instruments - but would like to do this from 1 strat if possible.
thanks
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
620 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
359 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
105 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
562 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
566 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment