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

Ninjatrader.Client.dll not returning error when Command PLACE encounters error

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

    Ninjatrader.Client.dll not returning error when Command PLACE encounters error

    I am using the Ninjatrader.Client.dll.
    My code calls the ninjatrader.client.Command() function passing the 'PLACE' command.
    During testing all worked well. I was specifying the Sim101 account and successfully getting data, opening and closing orders.
    When I did some testing using the Playback101 connection/account, the PLACE command started silently failing.
    This was showing up in the trace output:
    ERROR: OIF, 'PLACE;Sim101;YM 12-21;BUY;3;LIMIT;34653;0;DAY;;33A38C66E50D4BB289A883 86CC30A63A;;' account does not exist 'Sim101'
    My problem is that I had forgotten to specify the Playback101 in the account string (it was still Sim101).

    My question is why did the call to Command not return a negative return code ?
    The call to 'Command' clearly failed as the trace output indicates with the ERROR line. The log tab also showed this error.

    Can the Command be fixed to return a negative code so that calling code can take appropriate action?

    Thanks,
    Gary

    #2
    Hello Gary,

    To confirm the method did not return a -1 value?

    Do you have a screenshot of the output that shows the return value, along with the error?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Here is the block of code that logs before, then makes the call, then logs the result:
      Code:
      log(atiCommand + cma +account + cma +instName + cma +command + cma +quantity + cma +action + cma +price + cma +orderID);
      int result = ninjaClient.Command(atiCommand,account,instName,command,quantity,action,price,0,string.Empty,orderID,string.Empty, string.Empty);
      log("----- Return from " + atiCommand + ": result= " + result);
      if (result != 0)log("ERROR returned from " + atiCommand + " order:" + orderID + ", result: " + result);

      Here is logging output from my code:
      PLACE, Playback101, YM 12-21, BUY, 3, LIMIT, 34747, 5AEDBAFE69F44BF588CB213F6C503029
      ----- Return from PLACE: result= 0
      PLACE, Playback101, ES 12-21, SELL, 1, LIMIT, 4555.25, 522F43D5DDAE42E187F1B9BDD191E67F
      ----- Return from PLACE: result= 0

      Here are two lines from the trace file at the same time:
      2021-12-05 18:04:11:167 ERROR: OIF, 'PLACE;Playback101;YM 12-21;BUY;3;LIMIT;34747;0;DAY;;5AEDBAFE69F44BF588CB21 3F6C503029;;' account does not exist 'Playback101'
      2021-12-05 18:04:11:167 ERROR: OIF, 'PLACE;Playback101;ES 12-21;SELL;1;LIMIT;4555.25;0;DAY;;522F43D5DDAE42E187F 1B9BDD191E67F;;' account does not exist 'Playback101'


      NOTE, that in this case, I was connected to a live data feed using the Sim101 account. To cause the problem, I used the Playback101 account.

      Gary

      Comment


        #4
        Hello Gary,

        Are you using OIF text files and not the dll interface to send the orders?



        These don't have a return value..
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          I am using the dll.
          From the code snippet above:
          Code:
          int result = ninjaClient.Command(atiCommand,account,instName,co mmand,quantity,action,price,0,string.Empty,orderID ,string.Empty, string.Empty);
          Gary

          Comment


            #6
            Hello Gary,

            Thank you for confirming this.

            I am looking into the issue.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hello Gary,

              I've sent this to our developers and received tracking ID# NTEIGHT-15082.

              They'll look into and if there is a fix, this will appear in the release notes on a new release.
              Chelsea B.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by algospoke, Yesterday, 06:40 PM
              2 responses
              20 views
              0 likes
              Last Post algospoke  
              Started by ghoul, Today, 06:02 PM
              3 responses
              14 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Started by jeronymite, 04-12-2024, 04:26 PM
              3 responses
              45 views
              0 likes
              Last Post jeronymite  
              Started by Barry Milan, Yesterday, 10:35 PM
              7 responses
              21 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Started by AttiM, 02-14-2024, 05:20 PM
              10 responses
              181 views
              0 likes
              Last Post jeronymite  
              Working...
              X