Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Live Ninjatrader Plot

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

    Live Ninjatrader Plot

    Say I wanted to plot this please;

    d110 = (High[0] + Low[0] + Close[0] ) / 3;

    but instead of plotting it when the bar closes,

    I would like to plot it live, as the bar is plotting, using the live H, L & C?

    Is this possible with Ninja trader please?

    #2
    Hello tradethebonds,

    Welcome to the NinjaTrader Support Forums!

    Yes, that would be possible. You may change the CalculateOnBarClose to false, that that way your NinjaScript is going to be processed on each incoming live tick of data.

    You may see the following link to our Help Guide for more information about the CalculateOnBarClose.


    Happy to be of further assistance.
    JCNinjaTrader Customer Service

    Comment


      #3
      Thank you for your reply, it is appreciated.

      I cannot seem to determine how to implement this live plot, can you help please?

      ================================================

      protected override void Initialize()
      {
      Add(new Plot(Color.FromKnownColor(KnownColor.DarkBlue), PlotStyle.Line, "oneone"));
      AutoScale = false;
      Overlay = false;
      }

      // FormatPriceMarker method of a custom indicator
      public override string FormatPriceMarker(double price)
      {

      // Formats price values to 1 decimal places
      return price.ToString("N1");
      }

      /// <summary>
      /// Called on each bar update event (incoming tick)
      /// </summary>
      protected override void OnBarUpdate()
      {
      // Use this method for calculating your indicator values. Assign a value to each
      // plot below by replacing 'Close[0]' with your own formula.


      if (Bars == null)
      return;

      d110 = (High[0] + Low[0] + Close[0] ) / 3;

      Comment


        #4
        Originally posted by tradethebonds View Post
        Thank you for your reply, it is appreciated.

        I cannot seem to determine how to implement this live plot, can you help please?

        ================================================

        protected override void Initialize()
        {
        Add(new Plot(Color.FromKnownColor(KnownColor.DarkBlue), PlotStyle.Line, "oneone"));
        AutoScale = false;
        Overlay = false;
        }

        // FormatPriceMarker method of a custom indicator
        public override string FormatPriceMarker(double price)
        {

        // Formats price values to 1 decimal places
        return price.ToString("N1");
        }

        /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
        {
        // Use this method for calculating your indicator values. Assign a value to each
        // plot below by replacing 'Close[0]' with your own formula.


        if (Bars == null)
        return;

        d110 = (High[0] + Low[0] + Close[0] ) / 3;
        The fine, free manual is a very nice resource for language syntax.

        ref: http://www.ninjatrader.com/support/h...onbarclose.htm

        Comment


          #5
          Originally posted by tradethebonds View Post
          Code:
          protected override void Initialize()
                  {
                      Add(new Plot(Color.FromKnownColor(KnownColor.DarkBlue), PlotStyle.Line, "oneone"));
                      AutoScale            = false;
                      Overlay                = false;
                  }
          Inside of your Initialize() you may set the "CalculateOnBarClose = false;".

          The only thing that you have to be aware of is that you can change this property inside of the Parameters section of the Script when you apply it to a chart and it will override what ever is set programmatically.
          JCNinjaTrader Customer Service

          Comment


            #6
            I think because of my English, I am leaving something out...here is a picture please to confirm idea.

            World's leading screen capture + recorder from Snagit + Screencast by Techsmith. Capture, edit and share professional-quality content seamlessly.

            Comment


              #7
              Originally posted by tradethebonds View Post
              I think because of my English, I am leaving something out...here is a picture please to confirm idea.

              http://screencast.com/t/oMGoSuG0q
              In which case you need:
              Code:
               
              CalculateOnBarClose = true;
              d110 = (High[1] + Low[1] + Close[1] ) / 3;
              If you want to force COBC to true, you can place the COBC directive in OnStartUp(), or OnBarUpdate(): if you want it to be configurable, place the COBC directive in Initialize().

              Comment


                #8
                Appreciate all the help here very much, thank you!

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by argusthome, 03-08-2026, 10:06 AM
                0 responses
                105 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                53 views
                0 likes
                Last Post NabilKhattabi  
                Started by Deep42, 03-06-2026, 12:28 AM
                0 responses
                35 views
                0 likes
                Last Post Deep42
                by Deep42
                 
                Started by TheRealMorford, 03-05-2026, 06:15 PM
                0 responses
                38 views
                0 likes
                Last Post TheRealMorford  
                Started by Mindset, 02-28-2026, 06:16 AM
                0 responses
                74 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Working...
                X