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

Divergence Spotter Indicator Bug Fixed

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

    #16
    Kate I do still have an issue. I wish to use more that one indicator in the coding for finding divergence, Since there is NO drop down in the Strategy builder to select the input indicator from the list (as used on a chart application) I have changed the default, which does work, but to use more than one indicator Either a menu to select is needed in the Strategy builder usage OR copy the indicator to a new NAME and change the default - BUT THAT WILL NOT WORK, caused an error the the DivergenceSpotter_IndicatorType already has a definition in the global name space

    So if I rename the DivergenceSpotter_IndicatorType to a different name I still have issues with the global

    Any suggestions?

    Thanks

    Comment


      #17
      Hello DTSSTS,

      Thank you for your reply.

      Since that's a public enum, you should be able to access it from the Strategy code itself.

      Have you tried adding the same user input that the indicator uses to the Strategy?

      Code:
      //instantiate internal variable at class level
      private DivergenceSpotter_IndicatorType indicatorType; // Default setting for IndicatorType
      
      
      // in #region Properties
      [Description("Select the oscillator")]
      [Category("Parameters")]
      [NinjaScriptProperty]
      public DivergenceSpotter_IndicatorType IndicatorType
      {
      get { return indicatorType; }
      set { indicatorType = value; }
      }
      Thanks in advance; I look forward to assisting you further.
      Kate W.NinjaTrader Customer Service

      Comment


        #18
        Since that's a public enum, you should be able to access it from the Strategy code itself.

        I SHOULD BE ABLE TO ACCESS as I add the DivergenceSpotterV2 indicator like it will have a pull down (i did not see that)

        OR I SHOULD ADD THE CODE you provided to THEN be able to access

        thanks

        I see you a suggesting to add the code to my strategy for the input

        Will that create a multi selection in my strategy

        Also if I share the strategy and the end user has the divergence Spotter indicator on there platform, (I will need to instruct to replace there Indicator with my version as I have added more indicators to the enum list

        Thanks
        Last edited by DTSSTS; 05-26-2022, 12:18 PM.

        Comment


          #19
          Hello DTSSTS,

          Thank you for your reply.

          You would add that code in my prior reply to the strategy where noted it should go, and that should allow you to have the dropdown in the strategy parameters.

          Please let us know if we may be of further assistance to you.
          Kate W.NinjaTrader Customer Service

          Comment


            #20
            That was something I was thinking of but there is more to it than what you provided, after adding changing the indicator does not do anything to the strategy the default still remains the selected one, but the menu shows up

            Comment


              #21
              i have this

              private DivergenceSpotterV2 DivergenceSpotterV2AO;

              //instantiate internal variable at class level
              private DivergenceSpotter_IndicatorType indicatorType; // Default setting for IndicatorType

              and then this in the data load area <------------------ I think the input has to be stated in the below

              DivergenceSpotterV2AO = DivergenceSpotterV2(Close);

              need more input in the " = DivergenceSpotterV2(Close);" part of the code

              thanks

              remember the " // if(RunInit) return;" had to be blocked for the divergenceSpotterV2 to work in the strategy
              Last edited by DTSSTS; 05-26-2022, 12:39 PM.

              Comment


                #22
                Even getting this working the issue of used multiple values (ie different indicators in the said strategy will not be possible and you can only select 1

                seems the best solution is to some state the value (indicator preferred in the DataLoaded Area line of code

                EVEN BETTER why do all of the inputs in the Properties of the Actual indicator NOT show up to select or enter when the Indicator is loaded into the Strategy, then you can have as many versions of the indicator included in the strategy as needed
                Last edited by DTSSTS; 05-26-2022, 12:54 PM.

                Comment


                  #23
                  Hello DTSSTS,

                  Thank you for your reply.

                  As I mentioned before, the Divergence Spotter as written was not intended for use in a strategy and does not have its properties necessary to call it as NinjaScript Properties. You would need to add [NinjaScript Property] to those properties or you will not be able to successfully call the indicator from the strategy:

                  Code:
                   #region Properties
                  
                  [Browsable(false)]
                  [XmlIgnore]
                  public Series<double> BuySignal
                  {
                  get { return Values[0]; }
                  }
                  
                  [Browsable(false)]
                  [XmlIgnore]
                  public Series<double> SellSignal
                  {
                  get { return Values[1]; }
                  }
                  
                  [Description("Select the oscillator")]
                  [Category("Parameters")]
                  [B][NinjaScriptProperty][/B]
                  public DivergenceSpotter_IndicatorType IndicatorType
                  {
                  get { return indicatorType; }
                  set { indicatorType = value; }
                  }
                  
                  [Description("Used on all indicators, and is the %K value in Stochs")]
                  [Category("Parameters")]
                  [B][NinjaScriptProperty][/B]
                  public int PeriodFast
                  {
                  get { return fastPeriod; }
                  set { fastPeriod = Math.Max(1, value); }
                  }
                  
                  [Description("Used on MACD and as the %D value in Stochs")]
                  [Category("Parameters")]
                  [B][NinjaScriptProperty][/B]
                  public int PeriodSlow
                  {
                  get { return slowPeriod; }
                  set { slowPeriod = Math.Max(1, value); }
                  }
                  
                  [Description("Used on the MACD indicator and the StochSlowD")]
                  [Category("Parameters")]
                  [B][NinjaScriptProperty][/B]
                  public int PeriodSignal
                  {
                  get { return signalPeriod; }
                  set { signalPeriod = Math.Max(1, value); }
                  }
                  
                  [Description("Determines how far back to look for divergence, a '0' value means since the last crossing of the Zero line")]
                  [Category("Parameters")]
                  [B][NinjaScriptProperty][/B]
                  public int LookbackPeriod
                  {
                  get { return lookbackPeriod; }
                  set { lookbackPeriod = Math.Max(0, value); }
                  }
                  [Description("Low values look for tighter matchups, high values look for loose peaks matchup")]
                  [Category("Parameters")]
                  [B][NinjaScriptProperty][/B]
                  public int BarSensitivity
                  {
                  get { return barSensitivity; }
                  set { barSensitivity = Math.Max(1, value); }
                  }
                  
                  [XmlIgnore()]
                  [B][NinjaScriptProperty][/B]
                  [Description("Opacity of background colors ('0' to disengage background colorizing)")]
                  [Category("Visual background")]
                  public int Opacity
                  {
                  get { return bkgopacity; }
                  set { bkgopacity = Math.Min(10,Math.Max(0,value)); }
                  }
                  #endregion
                  Those would need to be added to the indicator's properties, and you would need to supply the indicator those parameters to be able to call it in the strategy.

                  Please let us know if we may be of further assistance to you.
                  Kate W.NinjaTrader Customer Service

                  Comment


                    #24
                    simple enough, thanks -

                    with the global namespace issue, i suppose that is not way for me to save as a different name, since it is modified, so when I share with other that will not be a confilct

                    the error I was have was on the line that has enum

                    Thanks again

                    Comment


                      #25
                      Hello DTSSTS,

                      Thank you for your reply.

                      You would not need to reproduce the enum within the strategy, you simply would access the enum from the indicator in the strategy as shown in my example code. Since you're going to be calling the indicator within the strategy, the indicator would automatically be included with the export if you wished to share the strategy so it would be available to another user importing it.

                      Please let us know if we may be of further assistance to you.
                      Kate W.NinjaTrader Customer Service

                      Comment


                        #26
                        hello i am using divergence spot indicator V2 with CCI, however, when i change opacity it reverts back to 10%default on next NT sign in. When i cahange colors it doesnt change on vertical lines. IT doesnt save. Can we please fix it? also on CCI only periodFast get used?
                        Thank you
                        Last edited by tkaboris; 06-15-2022, 12:34 PM.

                        Comment


                          #27
                          Hello tkaboris,

                          Thank you for your reply.

                          While we'll fix bugs with conversions, we would not change these by request, though you're perfectly welcome to modify it yourself. The original did not allow for changing the color of the background stripes by the user and in my testing, I'm seeing the colors set for the plot dots maintained when closing and reopening the workspace.

                          The CCI only has one period input, so yes, whatever value you put in for Fast Period would be the period used for the CCI.

                          Please let us know if we may be of further assistance to you.
                          Kate W.NinjaTrader Customer Service

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by bmartz, 03-12-2024, 06:12 AM
                          3 responses
                          26 views
                          0 likes
                          Last Post NinjaTrader_Zachary  
                          Started by Aviram Y, Today, 05:29 AM
                          2 responses
                          8 views
                          0 likes
                          Last Post Aviram Y  
                          Started by gentlebenthebear, Today, 01:30 AM
                          1 response
                          8 views
                          0 likes
                          Last Post NinjaTrader_Jesse  
                          Started by cls71, Today, 04:45 AM
                          1 response
                          7 views
                          0 likes
                          Last Post NinjaTrader_ChelseaB  
                          Started by TradeForge, Today, 02:09 AM
                          1 response
                          23 views
                          0 likes
                          Last Post NinjaTrader_ChelseaB  
                          Working...
                          X