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.

            Free online storage and sharing with Screencast.com. 2 GB of storage and 2 GB of bandwidth per month for free. We won't compress, alter or take ownership of your content.

            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 wzgy0920, 04-20-2024, 06:09 PM
                2 responses
                26 views
                0 likes
                Last Post wzgy0920  
                Started by wzgy0920, 02-22-2024, 01:11 AM
                5 responses
                32 views
                0 likes
                Last Post wzgy0920  
                Started by wzgy0920, Yesterday, 09:53 PM
                2 responses
                49 views
                0 likes
                Last Post wzgy0920  
                Started by Kensonprib, 04-28-2021, 10:11 AM
                5 responses
                192 views
                0 likes
                Last Post Hasadafa  
                Started by GussJ, 03-04-2020, 03:11 PM
                11 responses
                3,235 views
                0 likes
                Last Post xiinteractive  
                Working...
                X