Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to plot last price on the charts

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

    How to plot last price on the charts

    How to plot last price on the charts??

    #2
    Hello,

    Thank you for the question.

    If you are looking to plot just the last price you could create an indicator and use it on CalculateOnBarClose = false and reference the Close[0] as the Last price.

    The Close would be considered the Close of the bar if you have CalculateOnbarClose = true or the Last price if you have CalculateOnbarClose = false.

    You can also use something like a 1 period SMA set on CalculateOnbarClose = false if you do not want to manually code this. You can define the input series if you would like a different set of values other than the Close of each bar.

    I look forward to being of further assistance.

    Comment


      #3
      Originally posted by NinjaTrader_Jesse View Post
      Hello,

      Thank you for the question.

      If you are looking to plot just the last price you could create an indicator and use it on CalculateOnBarClose = false and reference the Close[0] as the Last price.

      The Close would be considered the Close of the bar if you have CalculateOnbarClose = true or the Last price if you have CalculateOnbarClose = false.

      You can also use something like a 1 period SMA set on CalculateOnbarClose = false if you do not want to manually code this. You can define the input series if you would like a different set of values other than the Close of each bar.

      I look forward to being of further assistance.
      Thanks for your swift reply.. I have created a message box where I want to show the last price.

      Comment


        #4
        Hello,

        Thank you for the clairification.

        You would need to pass through the Close[0] information to this box as well as putting the indicator into CalculateOnBarClose = false.

        If the case is that you can not use COBC = false you could look into using the OnMarketData method to update your box as ticks are coming in.

        There is also an example that includes the Last price in the following link:


        Please let me know if I may be of additional assistance.

        Comment


          #5
          if this is the code then how to add that OMD method into it
          if(!Historical)
          MessageBox.Show(DateTime.Now.ToString() + "\n\n Sell Signal generated for " + Instrument.FullName + ".", Instrument.FullName + " SELL ALERT!");

          Comment


            #6
            Hello,

            In NinjaScript or C# you can turn most things into strings by adding ToString() to the end of it or if you are combining a number with a string you dont even need to go that far.

            Here are a couple examples:

            Code:
            MessageBox.Show(DateTime.Now.ToString() + "\n\n Sell Signal generated for " + Instrument.FullName + ".", Instrument.FullName + " SELL ALERT! + " Price at: " + Close[0]);
            Or you can convert to a string like this:

            Code:
            string price = Close[0].ToString();
            I look forward to being of further assistance.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by CarlTrading, 05-11-2026, 05:56 AM
            0 responses
            28 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 05-10-2026, 08:12 PM
            0 responses
            20 views
            0 likes
            Last Post CarlTrading  
            Started by Hwop38, 05-04-2026, 07:02 PM
            0 responses
            183 views
            0 likes
            Last Post Hwop38
            by Hwop38
             
            Started by CaptainJack, 04-24-2026, 11:07 PM
            0 responses
            337 views
            0 likes
            Last Post CaptainJack  
            Started by Mindset, 04-21-2026, 06:46 AM
            0 responses
            261 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Working...
            X