• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Need Help -- Want to plot a line...

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

    Need Help -- Want to plot a line...

    Hello, I am new to C#, coming from a VBA background long ago. I would appreciate some help with an indicator that plots a line that is X number of ticks from the Upper Bollinger Band and I want to color to be user choice. So in plain language the code would:

    On bar close, add X number of ticks to the outer band and plot the line in X color.

    Thanks...If you are willing, we can take it one step at a time. Define the variable? Since it is a whole number, INT, right? Using the NT indicator editor I have this:

    Add(new Plot(Color.FromKnownColor(KnownColor.SeaGreen), PlotStyle.Line, "Plot0"));

    and

    Plot0.Set(Close[0]);

    Where do I go from here?

    And I want to lines to be "smooth" like the Bollinger Band, not purely vertical or horizontal.

    Thanks.

    #2
    Hi

    Have you worked through the samples in the HelpGuide?

    Ignore the builder, study the code generated.



    http://www.ninjatrader.com/support/h...ndicators2.htm



    Originally posted by sarasotavince View Post
    Hello, I am new to C#, coming from a VBA background long ago. I would appreciate some help with an indicator that plots a line that is X number of ticks from the Upper Bollinger Band and I want to color to be user choice. So in plain language the code would:

    On bar close, add X number of ticks to the outer band and plot the line in X color.

    Thanks...If you are willing, we can take it one step at a time. Define the variable? Since it is a whole number, INT, right? Using the NT indicator editor I have this:

    Add(new Plot(Color.FromKnownColor(KnownColor.SeaGreen), PlotStyle.Line, "Plot0"));

    and

    Plot0.Set(Close[0]);

    Where do I go from here?

    And I want to lines to be "smooth" like the Bollinger Band, not purely vertical or horizontal.

    Thanks.

    Comment


      #3
      I have started...but I don't connect the examples with what I am trying to do. And the "wizard" said I was "finished" and that's how I got the code I have now but it's just a start... I'll keep at it until I can have enough code to ask better questions.

      Comment


        #4
        Originally posted by sarasotavince View Post
        I have started...but I don't connect the examples with what I am trying to do. And the "wizard" said I was "finished" and that's how I got the code I have now but it's just a start... I'll keep at it until I can have enough code to ask better questions.
        Something like this perhaps?

        Plot0.Set(Bollinger(2,14).Upper[0]+5);

        Comment


          #5
          sarasotavince, can you give the snippet posted by sledge a try? You would want to multiple that 5 by TickSize though -

          http://www.ninjatrader.com/support/h...7/ticksize.htm

          Per default your OnBarUpdate() method for the script would be called at bar close - http://www.ninjatrader.com/support/h...onbarclose.htm
          BertrandNinjaTrader Customer Service

          Comment


            #6
            Painting Price Candles According to Delta

            I use the GOM package to plot delta and cumulative delta. What I would like to be able to do is colour the price candles according to the delta. In other words, if the delta is negative, I would like the price candle painted red, and of course, if the delta is positive, I want the price candle painted green. Any help would be greatly appreciated.

            Thank you

            Leafsfan

            Comment


              #7
              Yes, * Ticksize, I have seen that coding elsewhere. Will report back shortly. Much thanks to all.

              Comment


                #8
                Here is the code so far...
                Plot0.Set(Bollinger(2,4).Upper[0] + ticksAbove * Ticksize);

                ticksAbove is a private int variable.

                When I add * Ticksize the error message is: THe name "Ticksize" does not exist in the current context.

                When I leave * Ticksize off, the plot is 4 ticks (one ES point) if the ticksAbove is set to "1" and 8 ticks (two ES points) if set to "2", etc.

                I will do some more research on Ticksize but so far I cannot get past this error. Thanks Again.

                Comment


                  #9
                  Please be aware that C# NinjaScript is case sensitive, so TickSize should work just fine.
                  BertrandNinjaTrader Customer Service

                  Comment


                    #10
                    Originally posted by leafsfan View Post
                    I use the GOM package to plot delta and cumulative delta. What I would like to be able to do is colour the price candles according to the delta. In other words, if the delta is negative, I would like the price candle painted red, and of course, if the delta is positive, I want the price candle painted green. Any help would be greatly appreciated.

                    Thank you

                    Leafsfan
                    Leafsfan, I would ask that you please open a new thread in Indicator Development for this issue unrelated to the OP's questions. Thanks.
                    BertrandNinjaTrader Customer Service

                    Comment


                      #11
                      Changed Ticksize to TickSize and things are better!

                      Comment


                        #12
                        Was pretty sure of that but still great to hear that feedback.
                        BertrandNinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by njesopawt, Today, 11:32 PM
                        0 responses
                        2 views
                        0 likes
                        Last Post njesopawt  
                        Started by iceman2018, Today, 09:56 PM
                        2 responses
                        10 views
                        0 likes
                        Last Post samir
                        by samir
                         
                        Started by [email protected], Today, 10:13 PM
                        0 responses
                        4 views
                        0 likes
                        Last Post garzon.javier.e@gmail.com  
                        Started by iceman2018, Today, 09:51 PM
                        0 responses
                        5 views
                        0 likes
                        Last Post iceman2018  
                        Started by n8dogg59, Today, 06:55 AM
                        2 responses
                        18 views
                        0 likes
                        Last Post n8dogg59  
                        Working...
                        X