Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Transferring code from TradeStation to NT

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Hi Jesse. I have another issues with the data I am getting (for now I use the SIM datafeed). First, I do not see the June YM futures there, only March, although it is no more the front month instrument. But if I compare the data from your sim data feed with the live data from TS I see a huge discrepancy (please see the jpg file attached as well as data output). Can you please tell me why? Thank you.
    Attached Files

    Comment


      #17
      Hello,

      Thank you for the reply.

      I reviewed the syntax provided but I dont see that it is matching the charts volume for me after accumulating. This is likely something you would need to further debug to see how your logic is executed. You may also reference the following post which contains a sample of accumulating price and volume from a secondary tick series. This approach could likely be used with OnMarketData as well with some modification. https://ninjatrader.com/support/foru...130#post516130 the volumeCollect variable would be what is accumulating the volume in that sample.

      Regarding the contract month, if you have not opened a chart to that contract it would not appear in the recent list that you can click in the chart. You can either type in the instrument or use the instrument picker to search for it. You can also roll over instruments using the rollover tool, that is found in the Tools -> DataBase Management menu as "Rollover".

      Regarding the Sim data feed if you are referring to the "Simulated data feed", that is fake data so I would not expect that to match any other data feed. This is randomly generated data which can be used for testing purposes but should not be used to compare against other live data sources.


      Please let me know if I may be of further assistance.
      JesseNinjaTrader Customer Service

      Comment


        #18
        Thank you Jesse. If you are saying that SIM data is incorrect then this is might be the answer to one of my previous questions (several posts ago) about how precise they are. Given that OHLC data of the SIM stream were exactly the same as my live data I was under impression that what I get as SIM is correct.

        I will take a look at the code you referred to to see what is what. Thank you. Cheers! Sergey

        Comment


          #19
          Hello,

          Thank you for the reply.

          If you are using the Simulated data feed, the data is not incorrect it is just randomly generated in realtime as that is the nature of that connection. It will display existing real historical data when you connect and any forward data created would be fake or random data to drive the sim engine.

          If you are not using the "Simulated data feed" and are instead referring to your actual data provider by the name "SIM", I would suggest using the actual name of that data provider to not be confusing. Otherwise, this would be expected if you use specifically the "Simulated data feed".



          I look forward to being of further assistance.
          JesseNinjaTrader Customer Service

          Comment


            #20
            My bad, on that particular instance I confused the Demo feed with the Simulated one, this is why when I saw YV ~ 20,500 I was "surprised". Usually I do use Continuum (Demo) feed. I have been watching the difference in data. IN a nutshell if a 1-sec interval has only buy or sell volume, TS and NT feeds are in agreement. The difference starts occurring when during a particular 1-sec interval you have both buys and sells.
            Btw, as a "Plan B", do you think I can feed the TS data into NT platform?
            Thank you Jesse for your assistance. Cheers! Sergey.

            Comment


              #21
              Hi Jesse. I am finally getting comfortable with NT and I am ready to start transferring my code on the test platform. However, analyzing your data structure I found one thing that makes me a little cross. Here are the details:

              1. To understand the NT data structure I reused and slightly updated this piece of a code from one of the NT standard indicators (@BuySellVolume.cs)
              Code:
              		protected override void OnMarketData(MarketDataEventArgs e)
              		{			
              			if(e.MarketDataType == MarketDataType.Last)
              			{				
              				if(e.Price >= e.Ask)
              				{
              					buys += e.Volume;
              				}
              				else if (e.Price <= e.Bid)
              				{
              					sells += e.Volume;
              				}
              				
              				iTickCounter = iTickCounter + 1;		// counting ticks within a bar
              			}	
              		}
              		
              		protected override void OnBarUpdate()
              		{	
              			
              			if (CurrentBar < activeBar)  	
              				return;			
              			
              			// Update (plot) the bar
              			Sells[0] 	= sells;
              			Buys[0] 	= buys;
              			
              			sw = File.AppendText(path);  // Append text in case I have to restart the indicator
              			sw.WriteLine(Time[0] + "," + Open[0] + "," + High[0] + "," + Low[0] + "," + Close[0] + "," + buys + "," + sells + "," + CurrentBar + "," + iTickCounter); // Append a new line to the file
              			sw.Close();
              2. I ran this code and in the output file I saw that the last tick volume in a bar gets moved to the next bar (please see the *,csv attached). In this file I marked some of these situations, although they happen every time when a bar has more than 1 tick.

              3. Moreover, I found that the same error was reported to NT in Aug. 2016: https://ninjatrader.com/support/foru...ad.php?t=88419

              4. There is also two reports on this issue in 2017:
              https://ninjatrader.com/support/foru...ad.php?t=94637

              https://ninjatrader.com/support/foru...ad.php?t=94673

              Can you please shed some light on this situation as it is getting quite confusing, given that at least two more ppl reported this strange behavior?

              Thank you. Sergey.
              Attached Files

              Comment


                #22
                Hi Jesse, is there any news on my previous post regarding the NT data issue? Can you suggest a way to work around this issue, as I realize since it has been reported long time ago and is still present, not much has done about this?

                Comment


                  #23
                  Hello syatskevitch,

                  Thank you for your patience.

                  This is due to the OnMarketData() call always occurring after the OnBarUpdate() call. Your iTickCounter is updating after the OnBarUpdate() call, so on the new bar the iTickCounter is still for the prior bar's OnMarketData() call.

                  Please let me know if you have any questions.

                  Comment


                    #24
                    Hello Patrick, Thank you for the response. Does this mean that if I do a series of calculations, for which I need the exact data for each tick in a bar, I should move them into OnMarketData() from OnBarUpdate() ? Thank you. Cheers!

                    Comment


                      #25
                      Hello syatskevitch,

                      Thank you for your response.

                      If you need the Tick accumulation for calculations in the OnBarUpdate() then you would need to track that in OnBarUpdate() as it updates before OnMarketData(). An added 1 Tick bar series could be utilized for this purpose. Please visit the following link on multiple series in your script: https://ninjatrader.com/support/help...nstruments.htm

                      Please let me know if you have any questions.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Gerik, Today, 09:40 AM
                      2 responses
                      7 views
                      0 likes
                      Last Post Gerik
                      by Gerik
                       
                      Started by RookieTrader, Today, 09:37 AM
                      2 responses
                      11 views
                      0 likes
                      Last Post RookieTrader  
                      Started by alifarahani, Today, 09:40 AM
                      1 response
                      7 views
                      0 likes
                      Last Post NinjaTrader_Jesse  
                      Started by KennyK, 05-29-2017, 02:02 AM
                      3 responses
                      1,285 views
                      0 likes
                      Last Post NinjaTrader_Clayton  
                      Started by AttiM, 02-14-2024, 05:20 PM
                      11 responses
                      186 views
                      0 likes
                      Last Post NinjaTrader_ChelseaB  
                      Working...
                      X