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

Moving Average with Levels

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

    Moving Average with Levels

    Hello,

    I would like to use moving average indicator with levels, like you can see in attached document. How is it posible to do in NinjaTrader.

    If its not supported , could you please advise some tips how to implement ones. Need to choose custom levels as properties for the indicator.

    I am developer, so can understand what you write.
    Thank you in advance!
    Attached Files

    #2
    Hi Akushyn,

    Thank you for your note.

    Yes, from what you are showing be and describing is possible.

    With the plot class in NinjaScript, when you go to set the value of the plot you will need to add some values that will adjust that value based on the level you want to increase it.

    The Bollinger indicator is a great example of how this is done with multiple plots and "Levels".

    Let me know if this helps
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Ok).

      Thanks for the quick reply.
      I would like to use a lot of levels , let say 30 levels.

      So, because of big count of the properties, I've tried to parse the string into int array and create plots dynamically.
      And unfortunatelly it doesnt work (((

      Coluld you please, check what is wrong . My .cs file in attachments.

      --
      Andriy
      Attached Files

      Comment


        #4
        Originally posted by akushyn View Post
        Ok).

        Thanks for the quick reply.
        I would like to use a lot of levels , let say 30 levels.

        So, because of big count of the properties, I've tried to parse the string into int array and create plots dynamically.
        And unfortunatelly it doesnt work (((

        Coluld you please, check what is wrong . My .cs file in attachments.

        --
        Andriy
        You are doing this in Initialize()
        Code:
        for (int index = 1; index < convertedItems.Length; index++) 
                    {
                        Add(new Plot(ColorLevel, "Level" + index));    
                    }
        At that time, the array is not yet populated, so convertedItems.Length does not mean much in terms of iteration.
        Last edited by koganam; 12-06-2013, 12:32 PM.

        Comment


          #5
          Akushyn,

          I took a look and say that it has something to do with the convertedItems.
          I cannot pinpoint the exact reason but possibly due to the array being set for it.
          Cal H.NinjaTrader Customer Service

          Comment


            #6
            Thank you guys!

            Now Its okay, I just initialize convertedItems in Initialize() method. May be, not good solution, but working.

            Have another question (see in attached picture).
            Lets say, if I have a lot of levels it will be not good looking in properties window...
            That is why I just want draw levels on the chart but do not show in property list.

            --
            Andriy
            Attached Files

            Comment


              #7
              Originally posted by akushyn View Post
              Thank you guys!

              Now Its okay, I just initialize convertedItems in Initialize() method. May be, not good solution, but working.

              Have another question (see in attached picture).
              Lets say, if I have a lot of levels it will be not good looking in properties window...
              That is why I just want draw levels on the chart but do not show in property list.

              --
              Andriy
              Code:
              PlotsConfigurable = false;

              Comment


                #8
                Hello,

                Its weard, I wrote a post and it looks like was deleted..
                Anyway, ask the same again)))

                To continue the question of the previous post, I would like to hide configuration of levels and show only configuration for main series. How is it possible to do?

                I have tried to play with PlotsConfigurable like in example bellow, but no effect.


                Code:
                			[B][COLOR="blue"]PlotsConfigurable = false;[/COLOR][/B]
                
                			// add levels plot dynamically
                			for (int index = 1; index < convertedItems1.Length + 1; index++) 
                				Add(new Plot(new Pen(LevelColor, 2), PlotStyle.Line, "Level" + index));
                		
                			[B][COLOR="Blue"]PlotsConfigurable = true;[/COLOR][/B]
                			
                			// add main plot
                			Add(new Plot(new Pen(MainColor, 3), PlotStyle.Line, "Main"));

                Comment


                  #9
                  Originally posted by akushyn View Post
                  Hello,

                  Its weard, I wrote a post and it looks like was deleted..
                  Anyway, ask the same again)))

                  To continue the question of the previous post, I would like to hide configuration of levels and show only configuration for main series. How is it possible to do?

                  I have tried to play with PlotsConfigurable like in example bellow, but no effect.


                  Code:
                              [B][COLOR=blue]PlotsConfigurable = false;[/COLOR][/B]
                  
                              // add levels plot dynamically
                              for (int index = 1; index < convertedItems1.Length + 1; index++) 
                                  Add(new Plot(new Pen(LevelColor, 2), PlotStyle.Line, "Level" + index));
                          
                              [B][COLOR=Blue]PlotsConfigurable = true;[/COLOR][/B]
                              
                              // add main plot
                              Add(new Plot(new Pen(MainColor, 3), PlotStyle.Line, "Main"));
                  PlotsConfigurable is a global parameter. You cannot turn it on and off in the manner that you describe. It affects all Plots, always.

                  Comment


                    #10
                    Hi Akushyn,

                    You will need to just have the PlotsConfigurable set to false and then create user defined variables that you can pass through the ones that you do want to configure.

                    User Defined Inputs
                    Color Defined Inputs

                    Let me know if I can be of further assistance.
                    Cal H.NinjaTrader Customer Service

                    Comment


                      #11
                      Originally posted by NinjaTrader_Cal View Post
                      Hi Akushyn,

                      You will need to just have the PlotsConfigurable set to false and then create user defined variables that you can pass through the ones that you do want to configure.

                      User Defined Inputs
                      Color Defined Inputs

                      Let me know if I can be of further assistance.
                      Thank you for the solution.
                      I did this way and it doesnt work.

                      I have more questions:
                      1) How to configure Label of the indicator? (would like to set programatically to be empty)
                      2) What property configure Price Markets?
                      3) When I change the color, no effect. How to fix it? (source code attached in .cs file)

                      See attached picture what I mean
                      Attached Files

                      Comment


                        #12
                        Akushyn,

                        Try using this instead of passing it through the intialize -

                        Plots[0].Pen.Color = levelColor;

                        Ensure that you throw this in the OnBarUpdate Method. Note that the Plots is a indexed function just like the BarsArray, in which you will need to reference the correct plot.
                        http://www.ninjatrader.com/support/h...html?plots.htm

                        1) How to configure Label of the indicator?
                        Take a look at the reference sample below to do this.
                        http://www.ninjatrader.com/support/f...ead.php?t=4749

                        2) What property configure Price Markets?
                        Below is a link on how to format the price marker from the help guide -
                        http://www.ninjatrader.com/support/h...ricemarker.htm
                        Cal H.NinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by dustydbayer, Today, 01:59 AM
                        0 responses
                        1 view
                        0 likes
                        Last Post dustydbayer  
                        Started by inanazsocial, Today, 01:15 AM
                        0 responses
                        2 views
                        0 likes
                        Last Post inanazsocial  
                        Started by trilliantrader, 04-18-2024, 08:16 AM
                        5 responses
                        22 views
                        0 likes
                        Last Post trilliantrader  
                        Started by Davidtowleii, Today, 12:15 AM
                        0 responses
                        3 views
                        0 likes
                        Last Post Davidtowleii  
                        Started by guillembm, Yesterday, 11:25 AM
                        2 responses
                        10 views
                        0 likes
                        Last Post guillembm  
                        Working...
                        X