Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Help me fix my simple Line @ Bid Price Indicator

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

    Help me fix my simple Line @ Bid Price Indicator

    Hi,

    I'm trying to make a simple indicator that will draw a horizontal line across the chart at the current Bid Price. No luck though, I do not see any line at all.

    This is my first foray into NinjaScript coding, so I'm sure I'm just overlooking something "obvious". Any help appreciated, thanks.
    Last edited by NinjaCustomer; 05-15-2008, 10:04 AM.

    #2
    This will never works since you are assuming that GetCurrentBid() will dynamically return the bid value for the plot. GetCurrentBid() only returns a value when its called so you are in fact setting the plot to a constant value of which since GetCurrentBid() may not return a value until after OnBarUpdate() is called...I don't recall.

    What you will want to do is set the value of the Plot in the OnBarUpdate() method and run the indicator with CalculateOnBarClose = false. This will only update the bid line on a change in the last trade.
    RayNinjaTrader Customer Service

    Comment


      #3
      Hi Ray,

      thanks... I tried using a Plot first but figured that is not what I need. A Plot will plot it like a regular price... i.e. squiggly... what I need is a horizontal line at the current price.

      How do I do that?

      Comment


        #4
        You could try using DrawHorizontalLine()
        RayNinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Ray View Post
          You could try using DrawHorizontalLine()
          after I draw it, how do I update it? DrawHorizontalLine() returns void according to compiler. How can I get the Horizontal Line object?

          Comment


            #6
            Use the same tag such as the line below. Thats the only thing you need in OnBarUpdate().

            DrawHorizontalLine("BidPrice", GetCurrentBid(), Color.Blue)
            RayNinjaTrader Customer Service

            Comment


              #7
              cool thanks.. that worked..

              one more question though... how do I publish the Color value of this line so that I can change it in the indicators dialog?

              Comment


                #8
                This post will help in this area.

                RayNinjaTrader Customer Service

                Comment


                  #9
                  Hi NinjaCustomer,

                  Could you post the corrected code for this indicator?

                  Thanks...

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  577 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  334 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  101 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  553 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  551 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X