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

How to obtain the residual height of the mouth seat

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

    How to obtain the residual height of the mouth seat

    I tried the following code to retrieve my account balance, but it did not work.

    #region Using declarations
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Xml.Serialization;
    using NinjaTrader.Cbi;
    using NinjaTrader.Gui;
    using NinjaTrader.Gui.Chart;
    using NinjaTrader.Gui.SuperDom;
    using NinjaTrader.Gui.Tools;
    using NinjaTrader.Data;
    using NinjaTrader.NinjaScript;
    using NinjaTrader.Core.FloatingPoint;
    using NinjaTrader.Gui.Tools;
    #endregion

    //This namespace holds Add ons in this folder and is required. Do not change it.
    namespace NinjaTrader.NinjaScript.AddOns
    {
     public class myAccont2 : NinjaTrader.NinjaScript.AddOnBase
     {
      Account a = Account.All.First(t => t.Name == "Sim101");
      double value = a.Get(AccountItem.CashValue, Currency.UsDollar);
      Print(value);
     }
    }

    #2
    Hello ラリー,

    As this is an addon, I would recommend that this be run when a new window is opened or when a button is clicked.
    Below is a link to an example that uses an account.
    https://ninjatrader.com/support/foru...720#post820720

    Further, instead of using Print() you would need to use Code.Output.Process() to print to the output window from an addon.
    https://ninjatrader.com/support/help...g_concepts.htm
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      ご返事ありがとうございます。
      私はコードを変更しました、それはここで正しいですか?

      #region Using declarations
      using System;
      using System.Collections.Generic;
      using System.ComponentModel;
      using System.ComponentModel.DataAnnotations;
      using System.Linq;
      using System.Text;
      using System.Threading.Tasks;
      using System.Windows;
      using System.Windows.Input;
      using System.Windows.Media;
      using System.Xml.Serialization;
      using NinjaTrader.Cbi;
      using NinjaTrader.Gui;
      using NinjaTrader.Gui.Chart;
      using NinjaTrader.Gui.SuperDom;
      using NinjaTrader.Gui.Tools;
      using NinjaTrader.Data;
      using NinjaTrader.NinjaScript;
      using NinjaTrader.Core.FloatingPoint;
      using NinjaTrader.Gui.Tools;
      #endregion

      //This namespace holds Add ons in this folder and is required. Do not change it.
      namespace NinjaTrader.NinjaScript.AddOns
      {
      public class myAccont2 : NinjaTrader.NinjaScript.AddOnBase
      {
      Account a = Account.All.First(t => t.Name == "Sim101");
      double value = a.Get(AccountItem.CashValue, Currency.UsDollar);
      Code.Output.Process();
      }
      }
      Attached Files

      Comment


        #4
        Hello ラリー,

        No, Code.Output.Process() requires a string that will be printed and the output tab it will go to.

        From the help guide;
        "NinjaTrader.Code.Output.Process("my message", PrintTo.OutputTab1);"

        When do you want this output to appear? I am recommending that this be in the Loading event handler method for a new window, or from a button press. See my example linked for a demonstration.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          I'm sorry, I referred to the link, but I didn't understand it very well, and I changed the code again here, is this (attached) correct?
          Also, from where do I see the log when an error is output?
          Attached Files

          Comment


            #6
            Hello ラリー,

            Below I am providing a link to a forum post with helpful information about getting started with C#.
            https://ninjatrader.com/support/foru...040#post786040

            As well as an example addon that has a button.
            https://ninjatrader.com/support/foru...egy#post759830

            The Code.Output.Process() in your post has the right format, however you would want to change the string to the information you are wanting to print.

            The Log tab can be selected at the bottom of the Control Center window.
            https://ninjatrader.com/support/help...ndingTheLogTab
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Thank you very much.
              I will give them a try.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by MatthewLesko, Today, 12:12 AM
              0 responses
              3 views
              0 likes
              Last Post MatthewLesko  
              Started by Teebone21, Yesterday, 11:28 PM
              0 responses
              2 views
              0 likes
              Last Post Teebone21  
              Started by newton1, Yesterday, 08:28 PM
              0 responses
              2 views
              0 likes
              Last Post newton1
              by newton1
               
              Started by jjanguda, Yesterday, 06:20 PM
              0 responses
              7 views
              0 likes
              Last Post jjanguda  
              Started by TaZ22, Yesterday, 11:32 AM
              5 responses
              29 views
              0 likes
              Last Post bltdavid  
              Working...
              X