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

  • staycool3_a
    replied
    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.

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    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.

    Leave a comment:


  • staycool3_a
    replied
    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?

    Leave a comment:


  • bltdavid
    replied
    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?

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    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.

    Leave a comment:


  • tolisss
    started a topic Orders are not displayed in chart

    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?

Latest Posts

Collapse

Topics Statistics Last Post
Started by burtoninlondon, Today, 12:38 AM
0 responses
10 views
0 likes
Last Post burtoninlondon  
Started by AaronKoRn, Yesterday, 09:49 PM
0 responses
14 views
0 likes
Last Post AaronKoRn  
Started by carnitron, Yesterday, 08:42 PM
0 responses
11 views
0 likes
Last Post carnitron  
Started by strategist007, Yesterday, 07:51 PM
0 responses
14 views
0 likes
Last Post strategist007  
Started by StockTrader88, 03-06-2021, 08:58 AM
44 responses
3,983 views
3 likes
Last Post jhudas88  
Working...
X