Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using current indicator for development of new one

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

    Using current indicator for development of new one

    Hi -
    If i create a new indicator and call it "WilliamsAccumDist" is there i way i can use the indicator by that name in the development of a more complex indicator?
    I know for example if i wanted to use the simple moving average when developing a new indicator i can just use its name "SMA" to refer to it in my code.
    Is it the same when you use an indicator you develop? or would i need to write out the entire formula for it in my new code?

    #2
    Originally posted by maggiej12 View Post
    Hi -
    If i create a new indicator and call it "WilliamsAccumDist" is there i way i can use the indicator by that name in the development of a more complex indicator?
    I know for example if i wanted to use the simple moving average when developing a new indicator i can just use its name "SMA" to refer to it in my code.
    Is it the same when you use an indicator you develop? or would i need to write out the entire formula for it in my new code?
    You just use the name, like you would any other shipping system indicator.

    Code:
    double newValue = WilliamsAccumDist(ParameterList)[0];
    gives you the current value

    Comment


      #3
      I added the code under my variables and i'm getting an error message:

      the name 'ParameterList' does not exist in the current context

      Comment


        #4
        Maggie, please don't use the sample verbatim. Substitute "ParameterList" with the parameters needed for that indicator ie something like (whatever your indicator needs):
        double newValue = WilliamsAccumDist(Close, 7, 14)[0];
        eDanny
        NinjaTrader Ecosystem Vendor - Integrity Traders

        Comment


          #5
          thanks, yeah i figured it out

          Comment


            #6
            Hi-

            I'm am almost done developing my indicator & i have one little thing that needs changed.
            I want to take the 30 day Moving Average of my indicator MyWAD. But WAD sometimes can return a negative value and sometimes positive. When i take the moving average of WAD, i dont want the negative to be in the formula. So if WAD for a day is '-15', i just want to use the value '15'. What can i add to this equation to always use WAD as a positive value?
            Can anyone help? Thanks

            MovAvg.Set(SMA(MyWAD(1), 3)[0]) ;

            Comment


              #7
              Maggie, you can use the absolute function value to make any number positive.
              Code:
              double negnumber = -15;
              double posnumber;
              posnumber = Math.Abs(negnumber);
              AustinNinjaTrader Customer Service

              Comment


                #8
                Originally posted by maggiej12 View Post
                Hi-

                I'm am almost done developing my indicator & i have one little thing that needs changed.
                I want to take the 30 day Moving Average of my indicator MyWAD. But WAD sometimes can return a negative value and sometimes positive. When i take the moving average of WAD, i dont want the negative to be in the formula. So if WAD for a day is '-15', i just want to use the value '15'. What can i add to this equation to always use WAD as a positive value?
                Can anyone help? Thanks

                MovAvg.Set(SMA(MyWAD(1), 3)[0]) ;
                You will have to create a new DataSeries, for example, absWAD; populate it with the absolute values of WAD, then take the SMA of absWAD.

                Comment


                  #9
                  Ok, here's what i have:


                  MovAvg.Set(SMA((Math.Abs(MyWAD(1)), 3)[0]) ;

                  I'm getting error messages though saying invalid argument CS1502 & cannot convert from method group to sbyte CS1503.


                  The other option i came up with is:

                  double PosWAD;
                  PosWAD = Math.Abs(MyWAD);

                  MovAvg.Set(SMA(PosWAD(1), 3)[0]) ;

                  Error message when i do this is: PosWAD is a variable but is used like a method, Math.Abs has invalid arguments, and cannot convert MyWAD to sbyte.

                  I dont know what any of this means, can anyone give me any assistance?
                  Thanks

                  Comment


                    #10
                    Hi maggiej12,

                    If you want to pass this in as input for SMA, then it must be custom data series as koganam indicates.

                    We have a sample available on creating your own data series here:


                    Import that sample and then edit to see the structure needed for data series.
                    Ryan M.NinjaTrader Customer Service

                    Comment


                      #11
                      Thanks everyone for your help!! I got everything set up & working now!

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by bortz, 11-06-2023, 08:04 AM
                      47 responses
                      1,607 views
                      0 likes
                      Last Post aligator  
                      Started by jaybedreamin, Today, 05:56 PM
                      0 responses
                      9 views
                      0 likes
                      Last Post jaybedreamin  
                      Started by DJ888, 04-16-2024, 06:09 PM
                      6 responses
                      19 views
                      0 likes
                      Last Post DJ888
                      by DJ888
                       
                      Started by Jon17, Today, 04:33 PM
                      0 responses
                      6 views
                      0 likes
                      Last Post Jon17
                      by Jon17
                       
                      Started by Javierw.ok, Today, 04:12 PM
                      0 responses
                      16 views
                      0 likes
                      Last Post Javierw.ok  
                      Working...
                      X