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.


    Further, instead of using Print() you would need to use Code.Output.Process() to print to the output window from an addon.
    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#.


            As well as an example addon that has a button.


            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.
            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 rdtdale, Today, 01:02 PM
              0 responses
              1 view
              0 likes
              Last Post rdtdale
              by rdtdale
               
              Started by alifarahani, Today, 09:40 AM
              3 responses
              15 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by RookieTrader, Today, 09:37 AM
              4 responses
              18 views
              0 likes
              Last Post RookieTrader  
              Started by PaulMohn, Today, 12:36 PM
              0 responses
              6 views
              0 likes
              Last Post PaulMohn  
              Started by love2code2trade, 04-17-2024, 01:45 PM
              4 responses
              40 views
              0 likes
              Last Post love2code2trade  
              Working...
              X