• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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 NTDirect.dll (unmanaged) and NinjaTrader.Client.dll (managed) 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 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.
    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

    *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)
    Attached Files
    Last edited by NinjaTrader_ChelseaB; 05-23-2019, 10:34 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.
          https://developer.oanda.com/


          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.
            https://developer.oanda.com/


            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:
            https://www.oanda.com/forex-trading/analysis/labs/

            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

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by TazoTodua, Today, 02:02 AM
              0 responses
              2 views
              0 likes
              Last Post TazoTodua  
              Started by rehema, Today, 01:29 AM
              0 responses
              5 views
              0 likes
              Last Post rehema
              by rehema
               
              Started by Papercut110, Yesterday, 11:25 PM
              0 responses
              3 views
              0 likes
              Last Post Papercut110  
              Started by cgjecv, Yesterday, 09:42 PM
              0 responses
              4 views
              0 likes
              Last Post cgjecv
              by cgjecv
               
              Started by fxRichard, Yesterday, 08:34 PM
              0 responses
              3 views
              0 likes
              Last Post fxRichard  
              Working...
              X