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

Add horizontal lines to indicator in strategy script

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

    #16
    You will need to run a compile of the indicator in the Edit NinjaScript so that it compiles error free and the system then recognizes it in the Indicators list
    Cal H.NinjaTrader Customer Service

    Comment


      #17
      In your example you use
      Code:
      Overlay=true;
      But with this property indicator is drawn on price panel. Even if I use
      Code:
      DrawOnPricePanel = false;
      So, if I set
      Code:
      Overlay=false;
      this mean just that indicator chart will be behind price chart?

      I tried to use
      Code:
      Middle.Panel=1;
      parameter but indicator script warn about error.
      How can I set the panel for every indicator in indicator script?

      Comment


        #18
        Alexstox,

        Changing the Overlay to false will plot on a new panel.
        Cal H.NinjaTrader Customer Service

        Comment


          #19
          Originally posted by NinjaTrader_Cal View Post
          Alexstox,

          Changing the Overlay to false will plot on a new panel.
          So, what the difference between DrawOnPricePanel and Overlay?

          I tried to use
          Code:
          Middle.Panel=1;
          parameter but indicator script warn about error.
          How can I set the panel for every indicator in indicator script? (One indicator in panel 2, second in panel 3 ...)

          Comment


            #20
            DrawOnPricePanel is for the draw objects. This will let you either display them on the Price series or in its own separate panel.

            The Overlay is meant for plots and lines. When set to true it will display over the price in the same panel as the bars.

            When set to false it will display in its own panel. Setting to false as well, will set the Panel parameter in the indicator settings to New Panel when first applying it.

            You can assign an indicator its own panel however, this is unsupported code and would be able to provided documentation or assistance for it.

            ChartControl.Indicators[0].PanelUI = 1;
            Cal H.NinjaTrader Customer Service

            Comment


              #21
              Originally posted by NinjaTrader_Cal View Post
              Alexstox,

              You won't be able to use DrawOnPricePanel in the Strategy script. However, what you can do is create an indicator that does all this functionality and then call that indicator from the Strategy.

              Example of adding the SMA to a Strategy -
              Code:
              Add(SMA(14));
              Otherwise, you would need to use the plot option that I outlined in posts 6 and 8
              So, I've moved indicator code from strategy to separate indicator. I need one thing. How can I "manipulate" the indicator from strategy? Just add the same variables to strategy?

              Comment


                #22
                Alexstox,

                You can modify the indicators' pen class and more inside the initialize or OnBarUpdate. You will need to use the Plot method -
                http://www.ninjatrader.com/support/h...html?plots.htm

                Additionally, take a look at this link below -
                http://www.ninjatrader.com/support/f...ad.php?t=48853
                Cal H.NinjaTrader Customer Service

                Comment


                  #23
                  Hello guys! HAPPY NEW YEAR!!!
                  What if my strategy should do something if my indicator conditions come true?! How to implement this interaction in strategy?

                  For example, there are some conditions for long and other for short in Indicator1. So, variables only in Indicator1. And I should buy or sell in my strategy, but strategy script without those variables. So, how to write conditions for entries?

                  Variable A=1 in indicator. How can I check value of this variable in strategy script?

                  2) How to <<AutoScale = false;>> only for several component of indicator?
                  3) If my indicator has 3 arguments, and I Add(MyIndicator(argument1, argument2, argument3));
                  How to add MyIndicator with default value of arguments? (Add(MyIndicator())
                  Last edited by alexstox; 01-04-2014, 01:49 PM.

                  Comment


                    #24
                    please help

                    Please help!

                    Comment


                      #25
                      Please help! =(

                      Comment


                        #26
                        Alexstox,

                        You may want to take a look at the link below on Vaild input data for indicators -
                        http://www.ninjatrader.com/support/h..._indicator.htm
                        Cal H.NinjaTrader Customer Service

                        Comment


                          #27
                          For example, there are some conditions for long and other for short in Indicator1. So, variables only in Indicator1. And I should buy or sell in my strategy, but strategy script without those variables. So, how to write conditions for entries?

                          Variable A=1 in indicator. How can I check value of this variable in strategy script?

                          Comment


                            #28
                            OK. Maybe as always my English is not perfect

                            MyIndicator output MyVariable1=1. How to check value of MyVariable1 in my strategy?

                            P.S. Please answer my questions in previous post #23

                            Comment


                              #29
                              Alexstox,

                              You can set up conditional statements to check values, if those values are not plots then you would want to take a look at the link below on exposing your values -
                              http://www.ninjatrader.com/support/f...ead.php?t=4991

                              If they are plots then you would want to look at the Valid Input link from the help guide -
                              http://www.ninjatrader.com/support/h..._indicator.htm
                              Cal H.NinjaTrader Customer Service

                              Comment


                                #30
                                I will check this. Thanks.
                                May I use IF() in Initialize()? For example, to filter ADD() only for some instruments?
                                Code:
                                if(instrument==MSFT) do something
                                And how to check what instrument now is using in strategy or indicator?

                                2) When I tried to call for MyIndicator() in strategy, this caused an error because strategy required MyIndicator(1var, 2var, 3var). That's why I asked about how to call MyIndicator as default just MyIndicator()?
                                Last edited by alexstox; 01-07-2014, 02:52 PM.

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Graci117, Today, 09:02 PM
                                1 response
                                6 views
                                0 likes
                                Last Post NinjaTrader_Manfred  
                                Started by ETFVoyageur, Today, 07:55 PM
                                0 responses
                                7 views
                                0 likes
                                Last Post ETFVoyageur  
                                Started by janio973, Today, 07:24 PM
                                1 response
                                7 views
                                0 likes
                                Last Post NinjaTrader_Manfred  
                                Started by aligator, 01-06-2022, 12:14 PM
                                4 responses
                                246 views
                                0 likes
                                Last Post john_44573  
                                Started by reynoldsn, Today, 05:56 PM
                                0 responses
                                14 views
                                0 likes
                                Last Post reynoldsn  
                                Working...
                                X