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

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.







    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 -



          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 Waxavi, Today, 02:10 AM
                        0 responses
                        3 views
                        0 likes
                        Last Post Waxavi
                        by Waxavi
                         
                        Started by TradeForge, Today, 02:09 AM
                        0 responses
                        9 views
                        0 likes
                        Last Post TradeForge  
                        Started by Waxavi, Today, 02:00 AM
                        0 responses
                        2 views
                        0 likes
                        Last Post Waxavi
                        by Waxavi
                         
                        Started by elirion, Today, 01:36 AM
                        0 responses
                        4 views
                        0 likes
                        Last Post elirion
                        by elirion
                         
                        Started by gentlebenthebear, Today, 01:30 AM
                        0 responses
                        4 views
                        0 likes
                        Last Post gentlebenthebear  
                        Working...
                        X