• 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

cannot update chart with External Connection

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

    cannot update chart with External Connection

    Hi

    Here the Steps I follow
    1) Enable AT interface through NT8/Options/Automated Trading Interface/AT Interface
    2) Create custom stock symbol "TEST" and fill the External property under the Symbol Map section
    3) Connect to the external connection
    4) Open a chart for my TEST symbol. The chart is empty and on the top left corner there is a "Loading..." text
    5) Create a simple console application where I use
    Code:
        class Program {
            [DllImport("NTDirect.dll")]
            public static extern int Last(string instrument, double price, int size);
            [STAThread]
            static void Main(string[] args) {
    //            var client = new NinjaTrader.Client.Client();
    //            client.SetUp("127.0.0.1", 36973);
    //            var connected = client.Connected(900);
                Random rDelta = new Random();
    
                // prices start at 100 and will randomly move and down within the while loop below
                double lastPrice = 100.00;
    
                // direction determines the movement, 1 is up, -1 is down. start with up
                int direction = 1;
    
                bool go = true;
                while (go == true) {
                    Thread.Sleep(2000);
    
                    // generate a random LastPrice;
                    direction = direction == 1 ? -1 : 1; // if last move was up, this move will be down and vise versa
                    int delta = rDelta.Next(5);
                    lastPrice += delta * direction;
                    System.Console.WriteLine("Direction " + direction + "Delta " + delta + "Last Price " + lastPrice);
    //                if (client.Last("TEST",lastPrice,100)==-1)
    //                    throw new NotImplementedException();
    //                 call Ninja and set the last price with a volume of 100
                    if (Last("TEST", lastPrice, 100) == -1) {
                        System.Console.WriteLine("There was an error calling ninja - terminating execution");
                        break;
                    }
                }
    
            }
        }
    Nothing is drawn on my chart and the "Loading.." continues blinking. Can someone help on what I miss please?

    I also tested NT7 and works fine
    Last edited by tolisss; 06-07-2017, 06:41 AM.

    #2
    after further investigation discover that it was an enviromental issue, clean up Program Files and Documents/NinjaTrader and worked!

    Comment


      #3
      Hello tolisss,

      I am glad you were able to get this working.

      Keep in mind 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.

      I was able to test and ensure that data can be received and sent successfully through the API.
      http://ninjatrader.com/support/forum...092#post479092
      Chelsea B.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by gbulle, Today, 01:17 PM
      3 responses
      11 views
      0 likes
      Last Post gbulle
      by gbulle
       
      Started by CougarMountain, Today, 03:55 PM
      0 responses
      4 views
      0 likes
      Last Post CougarMountain  
      Started by syxforex, Today, 01:13 PM
      3 responses
      12 views
      0 likes
      Last Post NinjaTrader_PaulH  
      Started by pjsmith, Today, 01:17 PM
      2 responses
      6 views
      0 likes
      Last Post pjsmith
      by pjsmith
       
      Started by syxforex, Today, 01:17 PM
      2 responses
      6 views
      0 likes
      Last Post syxforex  
      Working...
      X