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.
      Chelsea B.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by cmtjoancolmenero, Yesterday, 03:58 PM
      2 responses
      19 views
      0 likes
      Last Post cmtjoancolmenero  
      Started by Stanfillirenfro, Today, 07:23 AM
      0 responses
      1 view
      0 likes
      Last Post Stanfillirenfro  
      Started by olisav57, Yesterday, 07:39 PM
      1 response
      9 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by cocoescala, 10-12-2018, 11:02 PM
      7 responses
      942 views
      0 likes
      Last Post Jquiroz1975  
      Started by oviejo, Today, 12:28 AM
      1 response
      11 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Working...
      X