Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 helpwanted, Today, 03:06 AM
                  0 responses
                  3 views
                  0 likes
                  Last Post helpwanted  
                  Started by Brevo, Today, 01:45 AM
                  0 responses
                  7 views
                  0 likes
                  Last Post Brevo
                  by Brevo
                   
                  Started by aussugardefender, Today, 01:07 AM
                  0 responses
                  5 views
                  0 likes
                  Last Post aussugardefender  
                  Started by pvincent, 06-23-2022, 12:53 PM
                  14 responses
                  242 views
                  0 likes
                  Last Post Nyman
                  by Nyman
                   
                  Started by TraderG23, 12-08-2023, 07:56 AM
                  9 responses
                  384 views
                  1 like
                  Last Post Gavini
                  by Gavini
                   
                  Working...
                  X