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

DLL Interface Ask() Method

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

    DLL Interface Ask() Method

    Hello,

    I am currently using the DLL interface to grab pricing from Kraken for some crypto symbols and trying to pass the BID/ASK data to NT. I am using the following methods in order to accomplish this.
    Code:
    int Ask(string instrument, double price, int size)
    int Bid(string instrument, double price, int size)

    When I call the above methods from my application I get a return value of 0 which indicates success but how can I see this data in NT?

    So for example I get XBT/EUR and convert the symbol name to XBT_EUR and call the above methods and get a return value of 0, but I can not see this data or the instrument inside NT, does the instrument already have to exist within NT?

    Thank you in advance for the support.
    Last edited by proptradingshop; 08-02-2021, 10:40 PM.

    #2
    I even tried adding the following to a custom indicator to see if I can print the values, added the indicator to the chart for the (custom)symbol that I am pushing BID/ASK data to and do not get anything.

    Code:
    protected override void OnMarketData(MarketDataEventArgs e)
    {
    if (e.MarketDataType == MarketDataType.Last)
    Print("[OnMarketData] Last = " + e.Price + " " + e.Volume);
    else if (e.MarketDataType == MarketDataType.Ask)
    Print("[OnMarketData] Ask = " + e.Price + " " + e.Volume);
    else if (e.MarketDataType == MarketDataType.Bid)
    Print("[OnMarketData] Bid = " + e.Price + " " + e.Volume);
    }

    Comment


      #3
      Hello proptradingshop,

      Thank you for your post.

      The DLL interface is provided as-is and support is limited to the resources available below.

      DLL interface - https://ninjatrader.com/support/help.../functions.htm

      Example application (Unsupported example) - https://ninjatrader.com/support/foru...442#post514442

      Are you able to run the NT8API example from the link above and see data coming in when you select Historical and then Send MSFT? You'll need to uncomment lines 118-119 and 147-154 to see data on a chart. Please ensure you have the AT interface enabled under Tools > Options > Automatic Trading Interface and ensure you are connected to the External connection.

      Please let us know if we may be of further assistance to you.

      Kate W.NinjaTrader Customer Service

      Comment


        #4
        Hi Kate,

        Thanks for the response, I ran the application...Can you specify in which file you are referring to uncomment the lines? I do not see any comments in the cs files. While running the application I placed some breakpoints on ToggleSend and can see the breakpoint being hit but don't see any data on the chart in NT. I have AT enabled and am connected to the external connection.

        Click image for larger version

Name:	nt-api.PNG
Views:	66
Size:	71.0 KB
ID:	1166244

        Comment


          #5
          Hello proptradingshop,

          Thank you for your reply.

          Looks like those lines are already uncommented so you should be good to go there - I may have commented them out in my own install to test something and just didn't remember. Are you using historical as the option, and do you have an MSFT chart open prior to pressing the Send MSFT option?

          I've created a short video demonstrating the example:
          https://www.screencast.com/t/81GftV1f

          Please let us know if we may be of further assistance to you.

          Kate W.NinjaTrader Customer Service

          Comment


            #6
            Hi Kate, it does not seem to be working for me.
            1. I am set to external connection
            2. I have AT interface enabled
            3. I create a 1min chart on MSFT
            4. Run the application and hit send button
            5. I see the code being hit but cant see anything on the chart
            I have attached a link to a video below, maybe you can spot what I am doing wrong.

            Comment


              #7
              Hello proptradingshop,

              Thank you for your reply.

              Generally speaking, we can see issues if you have NinjaTrader 7 running at the same time you're trying to use the external data feed, but I don't see that you've got that running from your video.

              Can you confirm what is shown for the chart end date when opening it?

              If you open a Time and Sales window and then run the example application, do you see data coming through there?

              Thanks in advance; I look forward to assisting you further.
              Kate W.NinjaTrader Customer Service

              Comment


                #8
                Hey Kate,

                End date is set to 08/03/2021

                Yes...I was able to see the T & S info come into the window when clicking on the button in the external app.

                My goal was essentially to be able to get the data in the OnMarketData() method of my indicator that is applied to the chart and that does not seem to be working for me.

                I appreciate your effort & support.

                Comment


                  #9
                  Hello proptradingshop,

                  Thank you for your reply.

                  To confirm, you haven't edited the project itself or changed the trading hours template listed for MSFT in the Instruments window, have you? It should be listed as US Equities RTH.

                  Changing to ask or bid data would cause that not to be shown on the chart since that would show Last data with the settings you've got for the chart.

                  I'm not sure it's anything specific to this instrument, though, since you're also having trouble with your crypto symbols with your own application.

                  Let's make sure you're on the correct version of the platform - if you look under Help > About in the Control Center, what is the version number listed there? If it's anything other than 8.0.24.3, let's have you update to the latest version to make sure nothing weird from an older version might be causing the issue.

                  To update NinjaTrader if necessary, please follow the steps below:
                  • First, copy your license key from NinjaTrader under Help> License Key then exit NinjaTrader
                  • Click on the link: https://ninjatrader.com/PlatformDirect
                  • Enter your license key and press Submit
                  • Select 'Download'
                  • Critical: Before running the installer, ensure NinjaTrader is closed.
                  If you're on the correct version already, let's have you run a repair on the installation. To run a repair, go to the uninstall a program section of the Windows control panel. Find NinjaTrader in the list, right click on it and select "Repair". If the repair is successful, please test with the example application again.

                  Thanks in advance; I look forward to assisting you further.

                  Kate W.NinjaTrader Customer Service

                  Comment


                    #10
                    Hi Kate,

                    Name: MSFT, Type: Stock, Description: Microsoft Corporation under instrument window.

                    Chart is set to last 1 min, you can review that in the video I posted.

                    I was on 8.0.24.2 but upgraded but still can't get anything on the chart.


                    Last edited by proptradingshop; 08-03-2021, 03:02 PM.

                    Comment


                      #11
                      Hello proptradingshop,

                      Thank you for your reply.

                      Let's have you restart your PC, then start up NinjaTrader, open a MSFT chart, set the chart trading hours to Default 24/7 since we're outside of regular trading hours at this point, then connect to the Simulated Data Feed just to make sure there's not something weird going on with the charts themselves. Do you see bars on the chart?

                      Once you've tested that, try restarting Visual Studio, connecting to the External Data Feed, and running the example project one more time with it set to historical.

                      If you still don't see data, try setting the Data Series settings to Ask and then Bid instead of Last, rerunning the example project each time. Do either of those show bars on the chart if Last still doesn't work?

                      Thanks in advance; I look forward to assisting you further.
                      Kate W.NinjaTrader Customer Service

                      Comment


                        #12
                        Hey Kate,

                        No luck unfortunately. I tried the steps you mentioned above. I am able to get the data in the T & S window (can even get my custom app that is pushing data from Kraken to push to the T & S window) but can't get anything to show on the charts or hit OnMarketData().

                        When I am NOT connected to the external data I am able to get data for MSFT on the chart perfectly fine.

                        Please let me know if it would help if I do another video of creating a chart to see if I am missing something.

                        Comment


                          #13
                          Hello proptradingshop,

                          Thank you for your reply.

                          If you're seeing data from both the example application and your custom application in the T&S window but not the chart, that seems more like a possible error in rendering the chart than a problem with the scripts themselves. At this point, I'd like to look at your log and trace files. Rather than post them here as they may contain personally identifiable information, please send them directly to us through the platform.

                          You can send these by going to the Control Center-> Help-> Email Support

                          Ensuring 'Log and Trace Files' is checked will include these files. This is checked by default.

                          Please reference the following ticket number in the body of the email: 3206004 ATTN Kate W. with a link to this post in the body of the email as well.

                          Thanks in advance; I look forward to assisting you further.
                          Kate W.NinjaTrader Customer Service

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by 7robert, Today, 11:50 AM
                          0 responses
                          4 views
                          0 likes
                          Last Post 7robert
                          by 7robert
                           
                          Started by ezrollin, Today, 10:40 AM
                          8 responses
                          11 views
                          0 likes
                          Last Post ezrollin  
                          Started by sidlercom80, Today, 10:20 AM
                          2 responses
                          6 views
                          0 likes
                          Last Post sidlercom80  
                          Started by TraderElegante, Today, 09:53 AM
                          2 responses
                          18 views
                          0 likes
                          Last Post TraderElegante  
                          Started by Kreyenhagen, Today, 09:03 AM
                          1 response
                          7 views
                          0 likes
                          Last Post NinjaTrader_ChrisL  
                          Working...
                          X