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

Orders are not displayed in chart

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

    Orders are not displayed in chart

    Hi

    I am using a call like

    Code:
    var command = _client.Command("PLACE", "Sim101", assetPair, position==Position.Long? "BUY":"SELL", 100, "MARKET", 0, 0, "DAY", null, null, null, strategyId.ToString());
    I do see the a green entry in the ControlCenter Strategies tab however my chart plots nothing.

    Can someone guide me as to what I am missing this time?

    #2
    Hello tolisss,

    Support for the API is very limited.

    The Application Programming Interface (API) is available in the ̶N̶T̶D̶i̶r̶e̶c̶t̶.̶d̶l̶l̶ ̶(̶n̶a̶t̶i̶v̶e̶ ̶C̶/̶C̶+̶+̶)̶ ̶a̶n̶d̶ NinjaTrader.Client.dll (managed .NET assembly) files for you to use in an external application to interface with NinjaTrader. These two files provide the same functions, however, you may find the NinjaTrader.Client.dll is easier to reference in your custom .NET application.

    Support for the API is limited from NinjaTrader Support. We are not able to assist with any code in an application external to NinjaTrader. We are able to detail the usage of any methods available from the API.

    Below I am providing a publicly available link to the help guide that lists the functions available to the API.
    Help Guide NT8 API functions - http://ninjatrader.com/support/helpG..._interface.htm
    Help Guide NT7 API functions - https://ninjatrader.com/support/help..._interface.htm

    ̶T̶h̶e̶ ̶N̶T̶D̶i̶r̶e̶c̶t̶.̶d̶l̶l̶ ̶c̶a̶n̶ ̶b̶e̶ ̶f̶o̶u̶n̶d̶ ̶i̶n̶:
    • ̶C̶:̶\̶W̶I̶N̶D̶O̶W̶S̶\̶S̶y̶s̶W̶O̶W̶6̶4̶
    The NinjaTrader.Client.dll for NinjaTrader 8 can be found in:
    • C:\Program Files\NinjaTrader 8\bin\NinjaTrader.Client.dll
    The NinjaTrader.Client.dll for NinjaTrader 7 can be found in:
    • 32 bit - C:\Program Files (x86)\NinjaTrader 7\bin\NinjaTrader.Client.dll
    • 64 bit - C:\Program Files (x86)\NinjaTrader 7\bin64\NinjaTrader.Client.dll


    Attached, I am providing two unsupported visual studio projects that demonstrate connecting to NinjaTrader, then sending and receiving data for both NinjaTrader 8 and NinjaTrader 7 that I have created.

    These examples are 100% unsupported by NinjaTrader Support.

    I've also created a set of videos that demonstrate connecting.
    ̶N̶T̶D̶i̶r̶e̶c̶t̶.̶d̶l̶l̶ - ̶h̶t̶t̶p̶s̶:̶/̶/̶d̶r̶i̶v̶e̶.̶g̶o̶o̶g̶l̶e̶.̶c̶o̶m̶/̶f̶i̶l̶e̶/̶d̶/̶1̶G̶J̶e̶.̶.̶.̶K̶Z̶D̶I̶2̶g̶7̶C̶t̶/̶v̶i̶e̶w̶
    NinjaTrader.Client.dll - https://drive.google.com/file/d/1fTL...AMIi5frp-/view

    Also, below is a link to an example project provided by a community member on the NinjaTrader forums, that uses the NinjaTrader API.
    http://ninjatrader.com/support/forum...6222#post36222

    As well as a few links to forum threads where using the API is discussed.
    http://ninjatrader.com/support/forum...?t=6971&page=2
    http://ninjatrader.com/support/forum...934#post465934
    http://ninjatrader.com/support/forum...480#post439480

    *The ATI (Automated Trading Interface) is a special subset of the API (Application Programming Interface) commands that are specific to placing or receiving information about orders. When ATI is disabled, all API methods that do not relate to orders (such as sending / receiving data) will continue to operate.

    *When using the API only one version of NinjaTrader can be open and running. This means to use with NinjaTrader 7, NinjaTrader 8 must be shutdown; to use with NinjaTrader 8, NinjaTrader 7 must be shutdown.

    (Updated June 5th, 2018 - Forgot to call TearDown() to shutdown threads in the Client/NtDirect when shutting down)

    (Update January 6th, 2020 - Ninja8API targeting .NET 4.8 in compliance with 8.0.23.0)

    (Update April 6th, 2023 - Due to the lack of user utilization and resource cost of maintaining, the native c++ NtDirect.dll has been discontinued.
    We will continue to track interest into this functionality and may revisit re-implementing in the future if there is high user demand.
    The API is still available with the .NET managed assembly NinjaTrader.Client.dll. Further, the ATI is still available through the Email and Order-Instruction-File approaches.)​

    Ninja7API.zip

    Ninja8API.zip
    Attached Files
    Last edited by NinjaTrader_ChelseaB; 01-20-2023, 10:01 AM.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChelseaB View Post
      The NTDirect.dll can be found in:
      • C:\WINDOWS\system32

      Doesn't NinjaTrader 7 also install a file named NTDirect.dll to the same Windows folder?

      If I install both NT7 and NT8 on the same machine, how would I know which version of NT my external application is talking to?

      Comment


        #4
        Originally posted by NinjaTrader_ChelseaB View Post
        Hello tolisss,

        Support for the API is very limited.

        The Application Programming Interface (API) is available in the NTDirect.dll and NinjaTrader.Client.dll files for you to use in an external application to interface with NinjaTrader. These two files provide the same functions, however, you may find the NinjaTrader.Client.dll is easier to reference in your script.

        Support for the API is limited from NinjaTrader Support. We are not able to assist with any code in an application external to NinjaTrader. We are able to detail the usage of any methods available from the API.

        Below I am providing a publicly available link to the help guide that lists the functions available to the API.
        http://ninjatrader.com/support/helpG..._interface.htm

        The NTDirect.dll can be found in:
        • C:\WINDOWS\system32

        The NinjaTrader.Client.dll can be found in:
        • 32 bit - C:\Program Files (x86)\NinjaTrader 8\bin\NinjaTrader.Client.dll
        • 64 bit - C:\Program Files (x86)\NinjaTrader 8\bin64\NinjaTrader.Client.dll


        Attached, I am providing two unsupported visual studio projects that demonstrate connecting to NinjaTrader, then sending and receiving data for both NinjaTrader 8 and NinjaTrader 7 that I have created.

        These examples are 100% unsupported by NinjaTrader Support.

        I've also created a set of videos that demonstrate connecting.
        NTDirect.dll - https://www.screencast.com/t/I2VDPm3HE9l
        NinjaTrader.Client.dll - https://www.screencast.com/t/039r0EM6WBdi

        Also, below is a link to an example project provided by a community member on the NinjaTrader forums, that uses the NinjaTrader API.
        http://ninjatrader.com/support/forum...6222#post36222

        As well as a few links to forum threads where using the API is discussed.
        http://ninjatrader.com/support/forum...?t=6971&page=2
        http://ninjatrader.com/support/forum...934#post465934
        http://ninjatrader.com/support/forum...480#post439480

        *A small note. The ATI (Automated Trading Interface) is a special subset of the API (Application Programming Interface) commands that are specific to placing or receiving information about orders. When ATI is disabled, all API methods that do not relate to orders (such as sending / receiving data) will continue to operate.

        (Updated June 5th, 2018 - Forgot to call TearDown() to shutdown threads in the Client/NtDirect when shutting down)
        Chelsea, why are you so damn cool? You always post some very useful stuff.

        Anyways, I'm interested in starting a new project but I will have to make calls to oanda's API. Before I started and having zero prior experience doing something like this before - can you pls confirm that it will be possible to do so with ninjatrader and the example you posted in this thread (I understand it's probably different but I'll try to see the general principles and then go from there.. ).

        I've connected with oanda's api and gotten data using python and r studio before. Basically, I'll be trying to get some data from oanda's api. I'll have to authenticate and then request particular data and then feed it back to ninjatrader and chart it/use it in my strategy. That should be doable right?

        Comment


          #5
          Hello staycool3_a,

          I honestly don't know anything about the Oanda API and these examples are likely not going to be helpful. These examples are pretty specific to NinjaTrader's API.

          I'm sure our development knows a bit from creating a connection in the internal code of NinjaTrader but its not within our support model to share this.

          That said, I will ping our developers and just ask what they are willing to provide and I'll let you know what they say.

          I was able to find Oanda's documentation from a google search. I am included a public link to this 3rd party site below.



          However, I'm a little confused on what you are trying to do. NinjaTrader 8 has an internal Oanda connection built into the NinjaTrader Continuum connection. If you are wanting to feed data to a strategy in NinjaTrader then you wouldn't need to directly interface with Oanda's API, you would need to be connected through the normal connection and run the strategy as you would any other strategy.

          Can you clarify what you are trying to achieve?
          Last edited by NinjaTrader_ChelseaB; 11-01-2018, 09:54 AM.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Originally posted by NinjaTrader_ChelseaB View Post
            Hello staycool3_a,

            I honestly don't know anything about the Oanda API and these examples are likely not going to be helpful. These examples are pretty specific to NinjaTrader's API.

            I'm sure our development knows a bit from creating a connection in the internal code of NinjaTrader but its not within our support model to share this.

            That said, I will ping our developers and just ask what they are willing to provide and I'll let you know what they say.

            I was able to find Oanda's documentation from a google search. I am included a public link to this 3rd party site below.



            However, I'm a little confused on what you are trying to do. NinjaTrader 8 has an internal Oanda connection built into the NinjaTrader Continuum connection. If you are wanting to feed data to a strategy in NinjaTrader then you wouldn't need to directly interface with Oanda's API, you would need to be connected through the normal connection and run the strategy as you would any other strategy.

            Can you clarify what you are trying to achieve?
            Apologies for the late response. Pretty busy day today!

            I'm trying to access oanda's fx lab data points by connecting with API. They have bunch of cool information that i'd like to get access to and then use them within my strategies. Because ninjascript is just C, I can't imagine it being complicated.. just don't know where to start

            Thanks for asking the dev team. Would be nice to have some example if they can provide on how to pull data from an API from external sources within ninjascript.

            fx lab variables:
            Discover the range of powerful analysis tools and partner API's contained within the OANDA trade platform


            developer:
            http://developer.oanda.com/rest-live...ign=forex-labs

            http://developer.oanda.com/rest-live-v20/instrument-ep/

            ^--- this is their most updated API documentation (v20).

            Below is a sample python script that i've used previously to connect with their API.


            import subprocess, os, csv
            import json, http.client, math, calendar, datetime, requests
            from time import *
            import pandas as pd
            import sys
            import openpyxl
            from openpyxl.reader.excel import load_workbook
            import oandapyV20
            import oandapyV20.endpoints.forexlabs as labs


            Symbol='EUR_USD'

            accountID = "********************"
            client = oandapyV20.API(access_token="********************* *")
            params ={"instrument": Symbol,"period": 3600}
            r = labs.HistoricalPositionRatios(params=params)
            output = client.request(r)
            position_data = output['data'][Symbol]['data']
            for p in range(len(position_data)):
            position_data[p][0] = datetime.datetime.fromtimestamp(position_data[p][0])
            headers = ["timestamp", "lpr", "rate"]
            df = pd.DataFrame(position_data, columns=headers)
            df = df.set_index(df['timestamp'])
            df = df.drop(['timestamp', 'rate'], axis=1)
            df = df[:-1]

            latest_value= df.tail(1)
            Last edited by staycool3_a; 11-01-2018, 06:23 PM.

            Comment


              #7
              Hello staycool3_a,

              Our development got back to me and let me know that the Oanda order routing and data delivery is done by the Continuum service who directly interface with the Oanda API.

              Unfortunately, our development is not able to provide any details with the Oanda API.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Thanks for useful posts. Unfortunately, it does not work for me because I do not have coding knowledge. By the way, the Metastock Xenith adapter for Ninjatrader 8 would be great. I don't know a better way to stream live data from unsupported exchanges live to Ninjatrader 8.

                Comment


                  #9
                  Hello sabankaradeniz and johnsonmark506,

                  Thank you for your replies.

                  I have added a vote for you to a current feature request to add a Metastock Xenith adapter. This request is being tracked under the number SFT-4951.

                  As with all feature requests, interest is tracked before implementation is considered, so we cannot offer an ETA or promise of fulfillment. If implemented, it will be noted in the Release Notes page of the Help Guide.

                  Release Notes — https://ninjatrader.com/support/help...ease_notes.htm

                  I would note here that this is a very old thread and further replies may not be noticed with our ticketing system - if any other users would also like to submit votes for SFT-4951, please start a new thread to do so.

                  Please let us know if we may be of further assistance to you.
                  Kate W.NinjaTrader Customer Service

                  Comment


                    #10
                    Hi
                    This is looks great, Thank you
                    Will this API work for any symbol, like for Futures contracts as well exp. for CL (crude Oil)?

                    Comment


                      #11
                      Hello BobyGill,

                      Thank you for your reply.

                      Our API will allow you to pump data for any instrument you wish as long as the instrument is set up in the Instruments window.

                      Please let us know if we may be of further assistance to you.
                      Kate W.NinjaTrader Customer Service

                      Comment


                        #12
                        Originally posted by NinjaTrader_Kate View Post
                        Hello BobyGill,

                        Thank you for your reply.

                        Our API will allow you to pump data for any instrument you wish as long as the instrument is set up in the Instruments window.

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

                        I try Sample for Gold and ES Future, but it shows 0. My data feed is IQfeed dtn. So I check Ticker compare their Symbol List here https://www.iqfeed.net/symbolguide. Or what I did wrong?

                        Comment


                          #13
                          Hello zhiga,

                          Thank you for your note.

                          It looks like at the time you posted this post, the market was closed and we would not expect to see data coming in. If you try loading a chart today, are you able to do so?

                          Have you confirmed with IQFeed that you are enabled for those two instruments?

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

                          Comment


                            #14
                            Originally posted by NinjaTrader_Kate View Post
                            Hello zhiga,

                            Thank you for your note.

                            It looks like at the time you posted this post, the market was closed and we would not expect to see data coming in. If you try loading a chart today, are you able to do so?

                            Have you confirmed with IQFeed that you are enabled for those two instruments?

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

                            I did it when market was opened. In case Data feed is IQfeed, for ES it works with Ticker @ES, but for Gold I have no solution. Also there is such strange detail, for Ticker @6B, the code doesn't work, but it's for @M6B.

                            Comment


                              #15
                              Hello zhiga,

                              Thank you for your reply.

                              Can you confirm if you have checked with IQ feed that you are enabled for the GC instrument?

                              I'm not sure what you mean by "Also there is such strange detail, for Ticker @6B, the code doesn't work, but it's for @M6B." Could you provide a screenshot that illustrates? 6B would be British pound futures, and M6B would be micro British pound futures.

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

                              T
                              Kate W.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Barry Milan, Yesterday, 10:35 PM
                              5 responses
                              16 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by DanielSanMartin, Yesterday, 02:37 PM
                              2 responses
                              13 views
                              0 likes
                              Last Post DanielSanMartin  
                              Started by DJ888, 04-16-2024, 06:09 PM
                              4 responses
                              12 views
                              0 likes
                              Last Post DJ888
                              by DJ888
                               
                              Started by terofs, Today, 04:18 PM
                              0 responses
                              11 views
                              0 likes
                              Last Post terofs
                              by terofs
                               
                              Started by nandhumca, Today, 03:41 PM
                              0 responses
                              8 views
                              0 likes
                              Last Post nandhumca  
                              Working...
                              X