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 NT8 on strategy

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

    Divergence Spotter NT8 on strategy

    Hi,
    I want to build a strategy based on Divergence Spotter for NT8, and I saw this: https://ninjatraderecosystem.com/use...e-spotter-nt8/ but, if i use this indicator the strategy never gets the signal from this indicator.
    Looks like it works only in the chart. How can i use this indicator in the strategy?

    Thank's,
    Massimo

    #2
    Hello bergimax,

    Thank you for the post.

    Are you using the strategy builder or manually coding? The easiest way to see whats happening would be to use a print and output the plot you are using to see what values are being reported.

    I would otherwise need to see how you used the indicator to get a better idea of what may be happening. If you can provide an export sample that would be helpful.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hi Jesse, thank's for the replay. I'm using manually coding, and using this prints i got always 0:

      Print("DivergenceSpotterV2().Entry[1]: " + DivergenceSpotterV2().Entry[1]);
      Print("DivergenceSpotterV2().Entry[0]: " + DivergenceSpotterV2().Entry[0]);
      Print("DivergenceSpotterV2().IndicatorType: " + DivergenceSpotterV2().IndicatorType);
      Print("DivergenceSpotterV2().SellSignal[0]: " + DivergenceSpotterV2().SellSignal[0]);
      Print("DivergenceSpotterV2().BuySignal[0]: " + DivergenceSpotterV2().BuySignal[0]);

      I use the indicator in this way:
      if( DivergenceSpotterV2().Entry[0] == 1){
      //Do something
      }

      I tried all of the variable used in the Print, but it never works.
      I also tried to change the indicator type in this way:

      DivergenceSpotterV2().IndicatorType = DivergenceSpotter_IndicatorType.RSI;

      Where am i wrong?
      Thank's for the help,
      Massimo

      Comment


        #4
        Hello bergimax,

        Thank you for the reply.

        I don't necessarily see anything wrong there. Could you try doing the following test, this will both test that you have the correct syntax and also produce a sample.

        From the control center open the strategy builder.
        As a action, Print the DivergenceSpotterV2 plot
        Run the script and see if its still 0. If so I can use the same steps to test that on my end.

        Can you also link which specific file you downloaded from the app share again? It looks like the link you posted was cut off, you may need to Control + Shift + V to paste without formatting.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Ok Jesse, i did the tests and this is what i found that using the strategy builder it doesn't work anyway, the values are everytime 0.
          - Doing the manual load of the indicator on the chart (not with strategy), the indicator doesn't show the entry point. If i change the plot, for example from Macd to BOP, it start working and showing the entry point. If i come back, from BOP to MACD, it show the entry point based on the MACD.

          The full link is: https:// ninjatraderecosystem.com/user-app-share-download/divergence-spotter-nt8/

          Thank's,
          Massimo
          Last edited by bergimax; 02-05-2021, 11:41 AM.

          Comment


            #6
            Hello bergimax,

            Thank you for the reply.

            I took a look at the indicator and from what I can see the 0 is controlled by both how the plots are being set and also this logic:

            Code:
            else if (State == State.Configure)
            {
            if(RunInit && ChartControl != null)
            {
            [B]RunInit[/B]=false;
            IsAutoScale = false;
            }
            }
            
            
            if(RunInit) return;
            Commenting out the if(RunInit) return; was required for me to see anything happen. I did not invest time into figuring out what that was specifically used for but that seems to allow it to print not 0.

            Another factor is how the plots are infrequently set. You will still see 0's or a price value depending if the plot had been set on that bar. You could replace the following:


            Code:
            SellSignal[0] = 0;
            BuySignal[0] = 0;
            with


            Code:
            SellSignal[0] = SellSignal[1];
            BuySignal[0] = BuySignal[1];
            If you wanted to persist the plot values to give a constant plot or constant price output from the plot.



            I look forward to being of further assistance.

            JesseNinjaTrader Customer Service

            Comment


              #7
              Perfect, now it works! Thank you very much.

              Have a nice weekend,
              Massimo

              Comment


                #8
                Hello, I have been trying to do the same thing for a while now and just cant seem to get it to spit out numerical value =1
                Anyway to have a better guide or maybe just a new script as a whole that I can import?

                Comment


                  #9
                  Originally posted by NinjaTrader_Jesse View Post
                  Hello bergimax,

                  Thank you for the reply.

                  I took a look at the indicator and from what I can see the 0 is controlled by both how the plots are being set and also this logic:

                  Code:
                  else if (State == State.Configure)
                  {
                  if(RunInit && ChartControl != null)
                  {
                  [B]RunInit[/B]=false;
                  IsAutoScale = false;
                  }
                  }
                  
                  
                  if(RunInit) return;
                  Commenting out the if(RunInit) return; was required for me to see anything happen. I did not invest time into figuring out what that was specifically used for but that seems to allow it to print not 0.

                  Another factor is how the plots are infrequently set. You will still see 0's or a price value depending if the plot had been set on that bar. You could replace the following:


                  Code:
                  SellSignal[0] = 0;
                  BuySignal[0] = 0;
                  with


                  Code:
                  SellSignal[0] = SellSignal[1];
                  BuySignal[0] = BuySignal[1];
                  If you wanted to persist the plot values to give a constant plot or constant price output from the plot.



                  I look forward to being of further assistance.
                  Hi Jesse,

                  I'm trying to get a simple strategy to paint the bar if the value is above 0, showing a divergence.

                  I removed the
                  Code:
                  if(RunInit) return;
                  into the indicator but still does not work for me. The chart plots the values correctly, showing divergences as greater than 0 but the strategy does not detect any values greater than 0.
                  Any idea?

                  Thanks!

                  EDIT:
                  There was the code
                  Code:
                  if(RunInit) return;
                  under the OnBarUpdate that I didnt see. I removed that and works now
                  Last edited by Ousher; 01-17-2022, 10:17 PM.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by geddyisodin, Today, 05:20 AM
                  0 responses
                  3 views
                  0 likes
                  Last Post geddyisodin  
                  Started by JonesJoker, 04-22-2024, 12:23 PM
                  6 responses
                  33 views
                  0 likes
                  Last Post JonesJoker  
                  Started by GussJ, 03-04-2020, 03:11 PM
                  12 responses
                  3,239 views
                  0 likes
                  Last Post Leafcutter  
                  Started by AveryFlynn, Today, 04:57 AM
                  0 responses
                  6 views
                  0 likes
                  Last Post AveryFlynn  
                  Started by RubenCazorla, 08-30-2022, 06:36 AM
                  3 responses
                  79 views
                  0 likes
                  Last Post PaulMohn  
                  Working...
                  X