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

Why is ADXVMA different?

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

    Why is ADXVMA different?

    ADXVMA has been working fine for me except for the fact that when it is applied it is not visible. Then after refreshing the indicators it will show up. My issue is that I'm trying to write an another indicator that will draw a triangle when price crosses the ADXVMA. As easy as this is I can't get it to print a triangle. What's going on in ADXVMA that causes these issues of calling the indicator from another script or appearing in the first place?
    Attached Files

    #2
    Hi BReal, thanks for posting. This is not a deafault indicator, so the original developer will need to provide support for it. The indicator is failing to initialize, so I moved all the State.Configure code to State.Data loaded, presumably the cbr=ChartBars.ToIndex; was null in State.Configure so I moved it all into State.DataLoaded:

    Code:
    else if (State == State.DataLoaded)
    {
    Period=_Period;
    k = Math.Round(1.0/(double)Period,6);
    up = new double[2];
    down = new double[2];
    ups = new double[2];
    downs = new double[2];
    trend = new int[2];
    //index = new double [period+1];
    index = new Series<double>(this);
    
    Volatility= new double[2];
    _ADXVMA=new double[2];
    
    Start=Core.Globals.Now;
    LoadFlag=true;
    cbr=ChartBars.ToIndex;
    }
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Thanks, this helps!

      Comment


        #4
        Chris to confirm

        the

        else if (State == State.Configure)

        was just changed to

        else if (State == State.DataLoaded)

        so now there is no

        else if (State == State.Configure)

        Thanks

        I changed the line in indicator from Configure to DataLoaded

        but I am still having errors

        error on calling OnStateChange method Object reference not set to an instance of an object
        Last edited by DTSSTS; 02-23-2023, 09:34 AM.

        Comment


          #5
          Hi DTSSTS, you can find the line causing this error by using Visual Studio debugging. See our guide here on how to attach Visual Studio to the NinjaTrader process:



          Once the process is attached, run the code to cause the error and Visual Studio will break at the line that caused the exception.
          Chris L.NinjaTrader Customer Service

          Comment


            #6
            I am in debug mode, when clicking on Visual Studio icon, popup states "failed to find Visual Studio installation

            thanks

            Comment


              #7
              Hi, Make sure you have Visual Studio installed. You can get if for free from the Microsoft website if you Google it, it should be the first result.
              Chris L.NinjaTrader Customer Service

              Comment


                #8
                Thanks i am installing now, but wanted to be sure i updated the script correctly


                I changed the line in indicator from Configure to DataLoaded

                wanted to make sure I was not suppose to keep the configure and copy all the code and repeat the lines of code in the DataLoaded section of code

                Thanks​

                Comment


                  #9
                  Hey DTSSTS!

                  Here is how I've modified the file. It's been working great for me.
                  Attached Files

                  Comment


                    #10
                    I am not real sure what happen with Visual I followed directions up to the attach part and verified Attached to Automatic managed betore I Click ATTACH

                    After that no opportuniity to select my indicator or strategy to inspect

                    it just started processing in the Diagnostics Tools window​



                    build error
                    Last edited by DTSSTS; 02-23-2023, 04:22 PM. Reason: results of Visual Debug

                    Comment


                      #11
                      Hi, the code I posted in Post # 2 is in State.DataLoaded that is correct.
                      Chris L.NinjaTrader Customer Service

                      Comment


                        #12
                        BReal THANKS

                        I Have downloaded you cs, I guess i will have to remove from my strategies and from my indicators before i PASTE in your version

                        I THINK a different similar indicator i likely the issue, but not sure. I installed something from a user and it installed the Lizzard Indicator version amaADXVMA which has alot of other stuff in the indicator and the user had also modified it some as well. So I was going to use ADXVMA to replace the code of the Lizzard version

                        I see the plot using the ADXVMA on my charts as expected, I coded the ADXVMA into one strategy I have and replace the references to the old amaADXVMA and then blocked the code lines of the amaADXVAM as well, all compiled without issue

                        when I test strategy in Back Tester I do not get any results and I get the LOG error

                        Comment


                          #13
                          BReal I am so confused, My ADXVMA shows in my Script Editor, the cs file does not show in my NinjaTrader8 file folders where I pasted it when I installed it, compiled and It is present in my indicators list. HOW can it be an indicator but not have a cs file

                          Comment


                            #14
                            Hi DTSSTS, Could you please post a screen shot of the error you are getting in the Log?
                            Chris L.NinjaTrader Customer Service

                            Comment


                              #15
                              this was the error

                              error on calling OnStateChange method Object reference not set to an instance of an object

                              I removed my cs file that came from the indicator download at

                              https://ninjatraderecosystem.com/use...wnload/adxvma/


                              I installed BReal cs file posted here to day and I do not have an error anymore

                              I had updated the DataLoaded update provided by you, but my indicator had some issue, BReal version works as expected

                              that was my test strategy for the ADXVMA I am about to recode the primary strategy and see if it works there as well
                              If NOT I will repost here

                              Thanks to all

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Trader146, Today, 09:17 PM
                              0 responses
                              5 views
                              0 likes
                              Last Post Trader146  
                              Started by ttrader23, 05-08-2024, 09:04 AM
                              9 responses
                              43 views
                              0 likes
                              Last Post ttrader23  
                              Started by ZeroKuhl, Yesterday, 04:31 PM
                              8 responses
                              46 views
                              0 likes
                              Last Post ZeroKuhl  
                              Started by reynoldsn, Today, 07:04 PM
                              0 responses
                              11 views
                              0 likes
                              Last Post reynoldsn  
                              Started by puapwr, Today, 06:09 PM
                              0 responses
                              5 views
                              0 likes
                              Last Post puapwr
                              by puapwr
                               
                              Working...
                              X