Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Normal Distribution

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

    Normal Distribution

    Hi everyone , i'm trying to create an indicator that plot a log normal distribution of price , but the problem is when i imported the meta numerics library , i couldn't know where to begin . please if you have some ideas , let me know . thanks .

    #2
    Hello tarikghost,

    While using this 3rd party library would be outside of what is supported by NinjaTrader Support, there are some general steps for using a dll.

    Usually the dll is added to the Documents\NinjaTrader 7\bin\Custom folder.

    Then a reference is added in NinjaTrader.
    • Right click in the code section of the NinjaScript editor.
    • In the context menu click on ‘References’.
    • In the Reference dialog, Click on the ‘Add’ button.
    • Select the DLL and then click ‘Ok’.
    • Compile the indicator now by pressing F5.


    Please also see the section “How to add a reference” from our help guide

    After the reference is added, generally a using statement is included in the using region of the script.

    Below is a publicly available link to the installation page for meta numerics.
    https://metanumerics.codeplex.com/wi...=Documentation
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks Chelsea B , in fact all what you have mentionned is true and i did it before , my question is how can we PLOT a normal distribution of price .

      Comment


        #4
        Hello tarikghost,

        If you have a number value and you want to plot this, you can do this from an indicator in NT7.

        To add a plot to your script:
        Add(new Plot(Color.Blue, "MyPlot"));
        http://ninjatrader.com/support/helpGuides/nt7/add.htm

        To set a plot on a bar with a variable:
        int aValue = 99
        Value.Set(aValue);
        http://ninjatrader.com/support/helpGuides/nt7/value.htm
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by tarikghost View Post
          Thanks Chelsea B , in fact all what you have mentionned is true and i did it before , my question is how can we PLOT a normal distribution of price .
          ?? How do you mean? Prices do not have a Gaussian distribution. This has been shown repeatedly, and is hardly surprising. So how do you mean that you want to plot a Gaussian distribution of a distribution that is not Gaussian?

          Of course, you can apply a Fisher Transform, which has been demonstrated to make any non-constant distribution to become approximately Gaussian.

          I am presuming here that by "normal distribution", you are referring to a "Gaussian distribution".

          ref: https://en.wikipedia.org/wiki/Fisher_transformation

          Comment


            #6
            Thanks Koganam for your reply , actually my purpose is to choose an interval on wich i could plot some bars of price close using lognormal distribution .

            My problem now is when a declare a variable Interval intrv , and want to set my intrv leftend point and rightend point it doesn't work ; it shows this error message :" Property or indexer 'Meta.numerics.interval.LeftEndpoint' cannot be assigned to -- it is read only"

            Interval intrv ;
            else if (State == State.Configure)
            {

            intrv.LeftEndpoint = 2 ;
            }
            }

            protected override void OnBarUpdate()
            {
            //Add your custom indicator logic here.


            Print("Interval: " +intrv.LeftEndpoint ) ;

            }


            }

            Comment


              #7
              Hi tarikghost,

              Do you need the new keyword to instantiate a new class object to that variable?

              Interval intrv;
              intrv = new Interval() { LeftEndPoint = 2 };
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                it didn't work Chelsea B unfortunately :/ , it says 'Meta.Numeric.Interval' doesn't contain a definition for 'LeftEndpoint' .

                Comment


                  #9
                  Hello tarikghost,

                  I wouldn't know for sure, but you may need to use the full namespace.

                  Interval intrv;
                  intrv = new Interval() { Meta.Numerics.Interval.LeftEndPoint = 2 };

                  (Also, it may be read only in the library class meaning that it has a get and not a set for that property, I wouldn't be able to say)

                  You might look to see if there is an overload parameter in the constructor that allows this to be passed in.
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    Originally posted by tarikghost View Post
                    Thanks Koganam for your reply , actually my purpose is to choose an interval on wich i could plot some bars of price close using lognormal distribution .

                    My problem now is when a declare a variable Interval intrv , and want to set my intrv leftend point and rightend point it doesn't work ; it shows this error message :" Property or indexer 'Meta.numerics.interval.LeftEndpoint' cannot be assigned to -- it is read only"

                    Interval intrv ;
                    else if (State == State.Configure)
                    {

                    intrv.LeftEndpoint = 2 ;
                    }
                    }

                    protected override void OnBarUpdate()
                    {
                    //Add your custom indicator logic here.


                    Print("Interval: " +intrv.LeftEndpoint ) ;

                    }


                    }
                    I still do not understand your larger purpose, but in regard only to dealing with intervals, have you RTFreeManual?

                    This is the first time I have ever looked at that library and already I see that to define an interval, as the manual says: "Use the static methods FromEndpoints(Double, Double), FromMidpointAndWidth(Double, Double), and FromEndpointAndWidth(Double, Double) to instantiate intervals."

                    You may want to read the documentation to find out what you can do and how to do it.

                    Comment


                      #11
                      Thanks koganam for your reply , actually i didn't find that static method that they are talking about in documentation unfortunatly , it generates that it doesn't exist . if it's possible to generate an interval in your ninjatrader , and share your code , i would appreciate it .

                      Comment


                        #12
                        Ohh finaly i figure it out ,



                        Interval intrv ;

                        intrv = Interval.FromEndpoints(-1,1);

                        Print("intrv " + intrv ) ;


                        Thank you guys you are awesome : Chelsea _B and koganam i appreciate your help .

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by kujista, Today, 06:23 AM
                        0 responses
                        1 view
                        0 likes
                        Last Post kujista
                        by kujista
                         
                        Started by traderqz, Yesterday, 04:32 PM
                        1 response
                        11 views
                        0 likes
                        Last Post NinjaTrader_Gaby  
                        Started by f.saeidi, Today, 05:56 AM
                        1 response
                        4 views
                        0 likes
                        Last Post Jltarrau  
                        Started by Jltarrau, Today, 05:57 AM
                        0 responses
                        4 views
                        0 likes
                        Last Post Jltarrau  
                        Started by Stanfillirenfro, Yesterday, 09:19 AM
                        7 responses
                        53 views
                        0 likes
                        Last Post NinjaTrader_Gaby  
                        Working...
                        X