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

PriceType option not showing up in Indicator dialog when PriceTypeSupported in Init

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

    PriceType option not showing up in Indicator dialog when PriceTypeSupported in Init

    My understanding is that when I set PriceTypeSupported = true in Initialize of the indicator in question I will get a PriceType option in the Indicator dialog. Is this true?

    I do set PriceTypeSupported = true, but PriceType is not showing up as an option.

    #2
    Hello bernie_c,
    Thanks for posting today.

    This setting is no longer necessary in the current version of NinjaScript. To change the price type this can be changed directly from the Indicator parameters.
    • From inside a chart right mouse click and select Indicators...
    • Locate the Data>Input Series setting
    • Left mouse click to the left and select the ... symbol
    • Select the price type you would like to use for your Input Series


    The PriceTypeSupported object does not affect this functionality as of the current NinjaScript.

    However, you can add a secondary instrument and control the market data type and the bar type. Here is a link explaining how to do this.
    http://www.ninjatrader.com/support/h....html?add3.htm

    The primary data series can be controlled as listed above...

    Please let us know if we may be of further assistance for anything NinjaTrader.
    Alex G.NinjaTrader Customer Service

    Comment


      #3
      Thank you Alex. This works as you illustrated for a standalone indicator. However, my indicator is started by my strategy. In this case when I go to my indicator dialog the Data section does not exist.

      Comment


        #4
        Hi bernie_c,

        The primary data series of an indicator called from a strategy will be the same primary series of the strategy which is the data series on the chart.

        You can add a secondary series to an indicator that is called from a strategy.

        The primary series of both indicators and strategies will always be the instrument on the chart.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          So the chart dictates the priceType for the strategy and indicator. Chart\Data Series\Price based on: options are: Ask, Bid, Last. Are these my only options? I was hoping for: Close, high, open, low, typical. What am I missing?

          Comment


            #6
            You can call any indicator with a different input series from a strategy. For example if you wish to call an EMA calculated from the typical price, you will not call EMA(period), but EMA(Typical, period). Here is a code sample:

            Code:
            #region Variables
            .....
            private Indicator.EMA   myEMA = null;
            #endregion
            
            protected override void Initialize()
            {
                myEMA = EMA(Typical, period);
                Add(myEMA);
                ....
            }
            In case that you wish to run your strategy with different input series - such as close, median or typical - you can add three different EMAs to your strategy and then select the EMA via an enum that you add to your strategy.

            Comment


              #7
              Hello bernie_c,

              As Harry posted in his example, you can call an indicator with a data series from a strategy and define the priceType for the particular data series.

              Here is a link to the help guide showing a Simple Moving Average method. http://www.ninjatrader.com/support/h...simple_sma.htm

              Code:
              Returns default value
              SMA(int period)[int barsAgo]
              SMA(IDataSeries input, int period)[int barsAgo]
              In this method you can define the data series you wish to use.

              Please let us know if we may be of further assistance for anything NinjaTrader.
              Alex G.NinjaTrader Customer Service

              Comment


                #8
                Thanks Harry and Alex,

                It appears that what you both suggest works without doing anything special in my strategy. My indicator is freerunning. It does not need anything from the strategy. The indicator just creates several plots. The strategy comes along every OnBarUpdate and collects all plot points. I did a test (see below) where I print out Input(0) and it matches Close perfectly. I suppose that if I could change the Input selection I would see it reflected in my test. I am pretty sure I should be able to do this from the control panel, but I can't seem to find it.

                From Strategy:
                Code:
                protected override void Initialize()
                        {
                            Add( bcC() );
                
                protected override void OnBarUpdate()
                        {	
                			if( CurrentBar < 10 )		return;	
                			
                			// ----- Get the data only once: -----
                			for( int i=0; i < 6; i++ )
                			{
                				local_values[ i ][0] = bcC.Values[ i ][0];	
                			}
                The Test:
                From indicator:
                Code:
                protected override void OnBarUpdate()
                        {
                			if( CurrentBar < 10)		
                			{
                				Print( Input[0].ToString() );
                				
                				return;
                			}

                Comment


                  #9
                  Hello bernie_c,

                  Thank you for your response.

                  Do you see the Input Series option in the indicators menu?

                  Comment


                    #10
                    I do see the Input Series option in the indicators dialog when running the indicator standalone which is only when I am debugging the indicator. When my strategy starts the indicator the options in the indicator dialog are not available. The Input Series in the strategy dialog does offer the same options.

                    Comment


                      #11
                      Hello bernie_c,
                      Thanks for your reply.

                      If the indicator is implemented from inside a strategy you will not be able to access the Input series for that specific indicator from the Strategies property as it will be set to the default input series.

                      This must be set from the code as demonstrated from the example from Harry.

                      Code:
                      #region Variables
                      .....
                      private Indicator.EMA   myEMA = null;
                      #endregion
                      
                      protected override void Initialize()
                      {
                          myEMA = EMA(Typical, period);
                          Add(myEMA);
                          ....
                      }
                      If it is a stand alone indicator, not built into a strategy but its own NinjaScript indicator, the input series should be able to be changed from the properties menu.
                      Alex G.NinjaTrader Customer Service

                      Comment


                        #12
                        Understood. Thanks Alex.

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by geddyisodin, Yesterday, 05:20 AM
                        7 responses
                        45 views
                        0 likes
                        Last Post NinjaTrader_Gaby  
                        Started by gbourque, Today, 06:39 AM
                        2 responses
                        5 views
                        0 likes
                        Last Post gbourque  
                        Started by cre8able, Yesterday, 07:24 PM
                        1 response
                        13 views
                        0 likes
                        Last Post NinjaTrader_ChelseaB  
                        Started by cocoescala, 10-12-2018, 11:02 PM
                        6 responses
                        939 views
                        0 likes
                        Last Post Jquiroz1975  
                        Started by cmtjoancolmenero, Yesterday, 03:58 PM
                        1 response
                        17 views
                        0 likes
                        Last Post NinjaTrader_Gaby  
                        Working...
                        X