Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

PriceTypeSupported = false has no bearing when adding an indicator to an MA

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

    PriceTypeSupported = false has no bearing when adding an indicator to an MA

    Hi,

    I created an indicator with PriceTypeSupported = false which has no impact when I add the indicator to an MA - I can still select price type.

    Also - the indicator I am using seems to be fairly taxing on the comp's resources and about every other time I adjust the columns NT hangs up on data load/calc. I am using B22 and DTN IQFeed. If you are interested I can send you the indicator and MA template.

    Thanks.

    #2
    I have been messing around with this some more and realized that I am not getting the same value on the MA indicator as the chart indicator. Seems that '# of bars to look back' property has a definite influence on the result. But - with that being said, I made the property value 10000 bars and still did not receive the correct value on the MA.

    I am using range 15 bars.

    I have also run across this problem with a very simple indicator for the MA, something that lists the HOD - the last price, but I eventually got it figured out. I set the data series to the 5 minute and had to include at least 78 bars (6.5 hours the market is open * 60/5) for the indicator to list the correct value on the MA. I am not sure how to come up with a universal value for range bars. I would think 10000 bars would cover the vast majority of stocks.

    But - that being said, the indicator is based on a several EMA's - one with a period of 300. I am not sure that any of this has relevance or how to even go about calculating the correct number of lookback bars.

    Any help appreciated.
    Attached Files
    Last edited by Day Trading Fool; 10-23-2010, 08:18 PM. Reason: Forgot attachment

    Comment


      #3
      Day Trading Fool, can you please post the code you're using so we can see what's going on?
      AustinNinjaTrader Customer Service

      Comment


        #4
        Sure.

        This is not the code is not for the indicator in the picture - I broke this down to a single series to try and debug it.

        Code:
                #region Variables
                // Wizard generated variables
                    private int series1 = 15; // Default setting for Series1
                    private int series2 = 22; // Default setting for Series2
        			private int holyGrail_1 = 55; // Default setting for HolyGrail_1
                    private int holyGrail_2 = 55; // Default setting for HolyGrail_2
        			private int holtEMA_1 = 300; // Default setting for HoltEMA_1
        			private int holtEMA_2 = 200; // Default setting for HoltEMA_2
        			private NinjaTrader.Indicator.DoubleMA_internal_SharkyPkg.DMAType mA1Type = NinjaTrader.Indicator.DoubleMA_internal_SharkyPkg.DMAType.EMA;
        			private NinjaTrader.Indicator.DoubleMA_internal_SharkyPkg.DMAType mA2Type = NinjaTrader.Indicator.DoubleMA_internal_SharkyPkg.DMAType.EMA;
                // User defined variables (add any user defined variables below)
        		
        			private double holtEMA1_1, holtEMA1_2, holtEMA2_1, holtEMA2_2;
        			private int hGSignal1_1, hGSignal1_2, hGSignal2_1, hGSignal2_2;
        			private double hGDMV;
        			private int trend;
        			private int holtTrend1, holtTrend2;
        			private int holyTrend1, holyTrend2;
        		
                #endregion
        
                /// <summary>
                /// This method is used to configure the indicator and is called once before any bar data is loaded.
                /// </summary>
                protected override void Initialize()
                {
                    Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Signal"));
        //			Add(PeriodType.Range, series1);
        			Add(PeriodType.Range, series2);
                    Overlay				= false;
        			CalculateOnBarClose = true;
        //			PriceTypeSupported = false;
                }
        
                /// <summary>
                /// Called on each bar update event (incoming tick)
                /// </summary>
                protected override void OnBarUpdate()
                {
                    // Use this method for calculating your indicator values. Assign a value to each
                    // plot below by replacing 'Close[0]' with your own formula.
                    
        //			if ( CurrentBar < Math.Max(Math.Max(Math.Max(holyGrail_1, holyGrail_2), holtEMA_1), holtEMA_2)+ 1)
        //          	{
        //				return;
        //			}
        			if ( CurrentBar == 0 )
        				return;
        			
        			
        			trend = 0;
        			holtEMA1_1 = jhlHoltEMA ( holtEMA_1, holtEMA_2 ) .Avg[0];
        			holtEMA1_2 = jhlHoltEMA ( holtEMA_1, holtEMA_2 ) .Avg[1];
        			holtEMA2_1 = jhlHoltEMA ( holtEMA_1, holtEMA_2 ) .Avg[0];
        			holtEMA2_2 = jhlHoltEMA ( holtEMA_1, holtEMA_2 ) .Avg[1];
        			hGSignal1_1 = (int)DoubleMAPaintHolyGrailV2 ( BarsArray[0], holyGrail_1, MA1Type, holyGrail_2, MA2Type ).Signal[0];
        			hGSignal1_2 = (int)DoubleMAPaintHolyGrailV2 ( BarsArray[0], holyGrail_1, MA1Type, holyGrail_2, MA2Type ) .Signal[1];
        			hGSignal2_1 = (int)DoubleMAPaintHolyGrailV2 ( BarsArray[1], holyGrail_1, MA1Type, holyGrail_2, MA2Type ) .Signal[0];
        			hGSignal2_2 = (int)DoubleMAPaintHolyGrailV2 ( BarsArray[1], holyGrail_1, MA1Type, holyGrail_2, MA2Type ) .Signal[1];
        			
        			
        			// Checks trend on the HoltEMA1
        			if ( holtEMA1_1 > holtEMA1_2 ) 
        			{
        				holtTrend1 = 1 ;
        			}
        			else if ( holtEMA1_1 < holtEMA1_2 ) 
        			{
        				holtTrend1 = -1 ;
        			}
        			
        			else
        			
        			{
        				holtTrend1 = 0 ;
        			}
        			// Checks trend on the HoltEMA2
        			if ( holtEMA2_1 > holtEMA2_2 ) 
        			{
        				holtTrend2 = 1 ;
        			}
        			else if ( holtEMA2_1 < holtEMA2_2 ) 
        			{
        				holtTrend2 = -1 ;
        			}
        			
        			else
        			
        			{
        				holtTrend2 = 0 ;
        			}
        			
        			//Checks trend on HolyGrail1
        			
        			if ( hGSignal1_1 == 1 && hGSignal1_2 == 1 )
        			{
        				holyTrend1 = 1;
        			}
        			else if ( hGSignal1_1 == -1 && hGSignal1_2 == - 1)
        			{
        				holyTrend1 = -1;
        			}
        			else 
        			{
        				holyTrend1 = 0;
        			}
        			
        			//Checks trend on HolyGrail2
        			
        			if ( hGSignal2_1 == 1 && hGSignal2_2 == 1 )
        			{
        				holyTrend2 = 1;
        			}
        			else if ( hGSignal2_1 == -1 && hGSignal2_2 == - 1)
        			{
        				holyTrend2 = -1;
        			}
        			else 
        			{
        				holyTrend2 = 0;
        			}
        			
        			//Checks for trend - based on 3 out of 4 colors matching
        			
        			if (holtTrend1 + holtTrend2 + holyTrend1 +holyTrend2 >= 3)
        			{
        				trend = 1;
        			}
        			else if (holtTrend1 + holtTrend2 + holyTrend1 +holyTrend2 <= -3)
        			{
        				trend = -1;
        			}
        			else
        			{
        				trend = 0;
        			}
        			Print("TrendSpotter " + ", Holt1: " + holtTrend1 + ", Holt2: " + holtTrend2+ ", Holy1:" + holyTrend1 + ", Holy2: " + holyTrend2+ ", " + "Trend: " +trend);
        			
        			Signal.Set(trend);
                }

        Comment


          #5
          I am still messing around with this. It appears as though a shorter range parameter works fine. If I set the primary to 5 and the secondary to 6 and the number of bars to look back to > 300 then I get matching results on the MA.

          Not sure what this means.

          The value of the indicator on the MA changes significantly with # of bars to look back. I even went as far as trying 100,000 bars on the 15/22 range bar periods with no success.

          Comment


            #6
            I re-did the conditionals if you want to play around with the results and brick size.

            Code:
            			//Checks for trend - based on 3 out of 4 colors matching
            			
            			if ((holtTrend1 == 1 && holtTrend2 == 1 && holyTrend1 == 1  && holyTrend2 == 1) 
            				|| (holtTrend1 == -1 && holtTrend2 == 1 && holyTrend1 == 1  && holyTrend2 == 1)
            				|| (holtTrend1 == 1 && holtTrend2 == -1 && holyTrend1 == 1  && holyTrend2 == 1)
            				|| (holtTrend1 == 1 && holtTrend2 == 1 && holyTrend1 == -1  && holyTrend2 == 1)
            				|| (holtTrend1 == 1 && holtTrend2 == 1 && holyTrend1 == 1  && holyTrend2 == -1))
            			{
            				trend = 1;
            			}
            			else if ((holtTrend1 == -1 && holtTrend2 == -1 && holyTrend1 == -1  && holyTrend2 == -1) 
            				|| (holtTrend1 == -1 && holtTrend2 == -1 && holyTrend1 == -1  && holyTrend2 == 1)
            				|| (holtTrend1 == -1 && holtTrend2 == -1 && holyTrend1 == 1  && holyTrend2 == -1)
            				|| (holtTrend1 == -1 && holtTrend2 == 1 && holyTrend1 == -1  && holyTrend2 == -1)
            				|| (holtTrend1 == 1 && holtTrend2 == -1 && holyTrend1 == -1  && holyTrend2 == -1))
            			{
            				trend = -1;
            			}
            			else
            			{
            				trend = 0;
            			}
            			test =  holtTrend1 + holtTrend2 + holyTrend1 +holyTrend2;
            			
            			Print("TrendSpotter " + test + ", Holt1: " + holtTrend1 + ", Holt2: " + holtTrend2+ ", Holy1:" + holyTrend1 + ", Holy2: " + holyTrend2+ ", " + "Trend: " +trend);
            			
            			Signal.Set(trend);

            Comment


              #7
              Hello there, can you please explain how the values differ from the values you're expecting for using all these bars back? Are you sure the indicator you're using doesn't "accumulate" error over so many bars?
              AustinNinjaTrader Customer Service

              Comment


                #8
                Yes - in fact, I have no idea what the # of bars back is actually supposed to do - I assumed that since there is a 300 period EMA in the indicator that the MA needs at least 300 bars to calculate the correct value.

                I am simply checking the position of one ema with respect to another. I am assigning simple integer values to the assessment. I think the setup in the picture used something like -2, -1, 0, 1, 2.

                When I select a very low # of bars to look the value is way off - I get a weird value of 169.25 or something - which should be impossible (the indicator can only assign the range of values above). As I increase the # of bars the value begins to reflect the domain, I know at 50 bars I get domain values., but they do not match the chart output, e.g., the chart shows -1 and the MA shows 0 or something. As I increase the # of bars the MA value changes. At some # of bars it begins to sporadically match the chart output.

                I also run into a 'not enough bars' error (can't recall the exact syntax) on the log if I select too large of a value - I do not understand that relationship either.

                Comment


                  #9
                  Day Trading Fool, can you also post the code for the DoubleMA referenced in your post so we can test this out?
                  AustinNinjaTrader Customer Service

                  Comment


                    #10
                    DayTradingFool - would you mind emailing the files needed to set this up to test on our end? You can reach me at support at ninjatrader dot com - thanks
                    BertrandNinjaTrader Customer Service

                    Comment


                      #11
                      Sure.

                      Recall - the indicator has the correct output on the chart - well, it is at least assumed that what is displayed on the primary panel is correct. I will setup up a new workspace so you can see what I am talking about.

                      Comment


                        #12
                        Any progress on this?

                        Comment


                          #13
                          Yes, I sent you a reply yesterday already on your email, please check your inbox...

                          Thanks
                          BertrandNinjaTrader Customer Service

                          Comment


                            #14
                            I changed the MA session to 24/7. Unfortunately, the indicator still does not match the value displayed on a chart.

                            Comment


                              #15
                              Do you then load enough historical data in the MA to replicate the chart the indicator is applied to?
                              BertrandNinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by fx.practic, 10-15-2013, 12:53 AM
                              5 responses
                              5,404 views
                              0 likes
                              Last Post Bidder
                              by Bidder
                               
                              Started by Shai Samuel, 07-02-2022, 02:46 PM
                              4 responses
                              95 views
                              0 likes
                              Last Post Bidder
                              by Bidder
                               
                              Started by DJ888, Yesterday, 10:57 PM
                              0 responses
                              8 views
                              0 likes
                              Last Post DJ888
                              by DJ888
                               
                              Started by MacDad, 02-25-2024, 11:48 PM
                              7 responses
                              159 views
                              0 likes
                              Last Post loganjarosz123  
                              Started by Belfortbucks, Yesterday, 09:29 PM
                              0 responses
                              8 views
                              0 likes
                              Last Post Belfortbucks  
                              Working...
                              X