Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Get Current Price

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

    Get Current Price

    I'm using renko bars and I don't get a visual of the current price. I wrote an indicator that displays horizontal lines for the bid and ask using GetBid and GetAsk functions. However, I would like to display a horizontal line for the current price. Using Close[0] doesn't work as it only applies to the renko bar data.

    Thanks,
    Mike

    #2
    Using Close[0] will work if you set your indicator to calculate intrabar.
    mrlogik
    NinjaTrader Ecosystem Vendor - Purelogik Trading

    Comment


      #3
      calculateonbarclose is set to false and is working as it should for the bid and ask. however, because i am using renko bars, Close[0] only returns the closing price of the completed block.

      Comment


        #4
        Mike, I believe this is due to the programming of the custom renko bars type you use - this should be fixed with the renko bars type we'll add for NinjaTrader 7 - http://www.ninjatrader.com/webnew/NT7/NinjaTrader7.html

        Comment


          #5
          Well, I believe NT currently uses the Bid price for creating a chart, so you should be able to use GetCurrentBid() for the horizontal line.
          mrlogik
          NinjaTrader Ecosystem Vendor - Purelogik Trading

          Comment


            #6
            Thanks Bertrand...that may be true but I would still like to know how I can get the current price aside from using Close[0], if possible.

            Comment


              #7
              not so sure that's true MrLogik...i see many times when the spead is greater than 2 where the current price marker on the right of the chart is between the bid and ask which is why i am asking my question.

              Comment


                #8
                I asked this question a while back.

                The post is here
                mrlogik
                NinjaTrader Ecosystem Vendor - Purelogik Trading

                Comment


                  #9
                  This would also depend on the connection you use if I'm not mistaken - if you can't use Close, try using the last from OnMarketData() - http://www.ninjatrader-support.com/H...arketData.html

                  Comment


                    #10
                    ah yes...thanks bertrand

                    Comment


                      #11
                      mrlogik...just read the thread and eventhough i fully understand the answer, it doesn't explain why the current price can and very often does appear between bid and ask.

                      Comment


                        #12
                        Bertrand,

                        Thanks for the suggestion. This works perfectly...Thanks again.


                        protectedoverridevoid OnMarketData(MarketDataEventArgs e)
                        {
                        if (e.MarketDataType == MarketDataType.Last)
                        DrawHorizontalLine(
                        "LastPrice",e.Price,Color.Black,DashStyle.Solid,1);
                        }


                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                        0 responses
                        580 views
                        0 likes
                        Last Post Geovanny Suaza  
                        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                        0 responses
                        335 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by Mindset, 02-09-2026, 11:44 AM
                        0 responses
                        102 views
                        0 likes
                        Last Post Mindset
                        by Mindset
                         
                        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                        0 responses
                        554 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by RFrosty, 01-28-2026, 06:49 PM
                        0 responses
                        552 views
                        1 like
                        Last Post RFrosty
                        by RFrosty
                         
                        Working...
                        X