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

We want to paint on the chart a candle that has achieved at least 5% from the previou

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

    #16
    Hello ラリー,

    The code you have now would make more sense as you are setting BarBrush/BarBrushes[0] under specific conditions rather than at random places in OnBarUpdate.

    When OnBarUpdate is processing an update of a bar, line 60 checks if the current close is greater than 1.05 times the previous close.

    In the else statement, BarBrush/BarBrushes[0] is set to null to reset it to the original bar color.

    If you want the conditions to be processed on the developing bar, consider setting the script to use Calculate.OnPriceChange.
    JimNinjaTrader Customer Service

    Comment


      #17
      Thank you for your reply.

      I have set Onprice Change from the settings of the properties of the indicators and I was able to include the last daily price in the calculation and paint it with a color.
      It was very helpful.​

      Comment


        #18
        Hello ラリー,

        Lines 62, 64, and 68 likely don't need to be there.

        You want to only set the bar brush if the condition is true. If you are setting the bar brush outside of the condition, it will be set on every bar.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #19
          Thank you for your reply.

          Lines 62, 64, and 68 likely don't need to be there.

          You want to only set the bar brush if the condition is true. If you are setting the bar brush outside of the condition, it will be set on every bar.​
          Will it be about post 13 which I posted? Or will it be about post 15?

          Also, I was able to display on the chart the daily net change that ended 5% or more, but I added it to the market analyzer (name test), but for the 4192 and 2813 symbols, I was expecting something to be displayed for those symbols since they ended 5% or more from the previous day's close, but it only shows 0. I was hoping to see something for the 4192 and 2813 symbols, but all I get is 0.
          How can this be done?​
          Attached Files

          Comment


            #20
            Hello ラリー,

            Will it be about post 13 which I posted? Or will it be about post 15?
            I'm not quite sure what you are asking. In post CSS Examples I was directing you to use a condition and trigger the action.


            but I added it to the market analyzer (name test), but for the 4192 and 2813 symbols, I was expecting something to be displayed for those symbols since they ended 5% or more from the previous day's close, but it only shows 0
            The Market Analyzer does not have bars that can be colored. You would have to set a plot value.
            I'm trying to expose my variables to the strategy builder so everyone can have better use of the WaveTrend indicator (it has a lot of code). Explain this to me like I am 5 because this isnt the first time I've tried to figure it out and hit a wall. What is Series? I know its like an array that stores bars. Why not just call it




            Use Print() to understand behavior. Print the time of the bar and all values used in the condition being investigated.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #21
              Thank you for your reply.

              I'm not quite sure what you are asking. In post CSS Examples I was directing you to use a condition and trigger the action.​
              I was referring to ChelseaB's post 18, "Lines 62, 64, and 68 probably don't need to be there." I wanted to ask if you were talking about the screenshot in post 15 that I posted or the screenshot in post 13 that I posted.

              Also, the plot seems to have already been on line 49, but it only shows n/a on the chart data box and 0 in the market analyzer as before.​
              Attached Files

              Comment


                #22
                Hello ラリー,

                I am again linking a forum post (linked in post #20) on setting plot values.
                I'm trying to expose my variables to the strategy builder so everyone can have better use of the WaveTrend indicator (it has a lot of code). Explain this to me like I am 5 because this isnt the first time I've tried to figure it out and hit a wall. What is Series? I know its like an array that stores bars. Why not just call it


                AddPlot() is the first piece. Setting the Value is the second piece. Making a public Series<double> to return the Values is the third piece.

                To set a plot value assign the value to Value[0].

                Value[0] = 100;

                Chelsea B.NinjaTrader Customer Service

                Comment


                  #23
                  Thank you for your reply.

                  AddPlot() is the first piece. Setting the Value is the second piece. Making a public Series<double> to return the Values is the third piece.
                  Are you referring to the first three links from the first link you sent us in post 22?
                  Or are you referring to the sections where the code is listed?​

                  Comment


                    #24
                    Hello ラリー,

                    I am referring to the three code blocks in the forum post I have linked.

                    I am again linking this below.
                    I'm trying to expose my variables to the strategy builder so everyone can have better use of the WaveTrend indicator (it has a lot of code). Explain this to me like I am 5 because this isnt the first time I've tried to figure it out and hit a wall. What is Series? I know its like an array that stores bars. Why not just call it
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #25
                      Thank you for your reply.

                      I am again linking this below.
                      https://ninjatrader.com/support/foru...er#post1182264
                      The three codes in your link start with AddPlot(Brushes.Blue, "MyPlot1"); and end with MyPlot2[0] = (Open[0] > Close[0] ? 1 : 0; I assume you have the code, but would it be correct to copy and paste them all into NinjaScript (name test)?

                      Comment


                        #26
                        Hello ラリー,

                        You can test the code if you would like.
                        This is meant for you to learn from and understand how to use.

                        Your code will need to be your plots that are returned in the getter of the public series for that plot index.
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #27
                          Thank you for your reply.

                          I copied and pasted the code from the link you sent, but it outputs an error as shown in the attached image.

                          I was under the understanding that I was supposed to paste it within the scope of the public class, but is that not the case?
                          Attached Files

                          Comment


                            #28
                            Hello ラリー,

                            C# logic cannot be in the scope of the class. Only declarations can be in the scope of the class.

                            May I confirm that you have structured the code the same as in the CrossDetectionForMarketAnalyzerExample_NT8 script?

                            Does your code look like the example's code?
                            Chelsea B.NinjaTrader Customer Service

                            Comment


                              #29
                              Thank you for your reply.

                              May I confirm that you have structured the code the same as in the CrossDetectionForMarketAnalyzerExample_NT8 script?

                              Does your code look like the example's code?​
                              Are you referring to the Market Analyzer file name that is built in by default?
                              If so, I have checked all the file names in the Market Analyzer folder (as attached) and cannot find them.

                              Also, the screenshot I sent you in post 27 is not the default one, but the one I created from Add New.​
                              Attached Files

                              Comment


                                #30
                                Hello

                                We are noticing compile errors and Chelsea is suggesting to follow how the code is structured in his example here:



                                While we want to be helpful, we are seeing numerous C# related issues which are preventing your progress. A fundamental understanding of C# will be required to write code that compiles. We strongly recommend reviewing publicly available C# educational materials or to take formal programming courses to better learn the syntax and language.

                                C# educational materials (scope, publicly available) - https://www.geeksforgeeks.org/scope-...es-in-c-sharp/

                                I recommend viewing the above and noting the scope in which you are placing your code.

                                I also recommend starting with our indicator tutorials to see how each piece fits into an indicator. This makes it clear on how Plot code is added.

                                Indicator Tutorials - https://ninjatrader.com/support/help...indicators.htm

                                Once becoming familiar with these building blocks, I would then recommend adding new plots to your test indicator, and then to revisit the custom indicator with this gained knowledge.

                                JimNinjaTrader Customer Service

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by SightCareAubetter, Today, 12:55 PM
                                0 responses
                                3 views
                                0 likes
                                Last Post SightCareAubetter  
                                Started by traderqz, Today, 12:06 AM
                                8 responses
                                15 views
                                0 likes
                                Last Post traderqz  
                                Started by SightCareAubetter, Today, 12:50 PM
                                0 responses
                                1 view
                                0 likes
                                Last Post SightCareAubetter  
                                Started by Mongo, Today, 11:05 AM
                                4 responses
                                15 views
                                0 likes
                                Last Post Mongo
                                by Mongo
                                 
                                Started by Skifree, Today, 03:41 AM
                                5 responses
                                14 views
                                0 likes
                                Last Post Skifree
                                by Skifree
                                 
                                Working...
                                X