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

modifying an indicator with an indicator

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

    modifying an indicator with an indicator

    --------------------------------------------------------------------------------
    Simple, I think ... just my first time so please be kind ... already trying for 2 hours
    Could not find a resolution after searching ... and I think I am following the F1 format correctly ...

    The following double works in the strategy,
    b1_EMD2_Upper[0] = EMDT(BarsArray[1],iEMD2delta,iEMD2fraction,iEMD2period).UpperBand[0];

    and now I want a 5 period CMO of that but none of the following is accepted (and yes, I need that 'upperband')
    //
    b1_cEMD66_upper[0] = (CMO(EMDT(BarsArray[1],0.66,0.66,14).UpperBand[0]), 5);
    b1_cEMD66_upper[0] = (CMO(EMDT(BarsArray[1],0.66,0.66,14).UpperBand), 5);
    b1_cEMD66_upper[0] = (CMO(b1_EMD2_Upper[0], 5));
    b1_cEMD66_upper[0] = (CMO(b1_EMD2_Upper, 5));


    Thanks very much in advance,
    Jon

    #2
    In order to use its value as input for other indicators and methods, you will have to turn that double into a dataSeries.

    A tutorial on custom DataSeries is available here.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Ryan,

      Thanks ... I was hoping to not have to do that

      Jon

      Comment


        #4
        so that would be MyEMDu = b1_EMD2_Upper[0] ??
        or is this better ??
        MyEMDu = EMDT(BarsArray[1],iEMD2delta,iEMD2fraction,iEMD2period).UpperBand[0]; ??

        and then (CMO(MyEMDu, 5)

        Comment


          #5
          You're welcome. It should be pretty straight-forward.

          Code:
           
          In variables region:
          private DataSeries MyEMDu;
           
          Initialize():
          MyEMDu= new DataSeries(this);
           
          OnBarUpdate():
          MyEMDu.Set(EMDT(BarsArray[1], iEMD2delta, iEMD2fraction, iEMD2period).UpperBand[0]);
          You can then pass this series (myEMDu) as input for anything that's looking for IDataSeries
          Last edited by NinjaTrader_RyanM1; 11-29-2010, 03:12 PM.
          Ryan M.NinjaTrader Customer Service

          Comment


            #6
            Ryan,
            Sorry for my illogical attempts ... but I cant get this working with either a double or a dataseries !!

            this is accepted:
            EMDT66u.Set(EMDT(BarsArray[1],0.66,0.66,14).UpperBand[0]);

            But either of these gives an error on trying to convert CMO to a double::

            b1_cEMD66_upper[0] = (CMO(EMDT66u, 5));
            b1_cEMD66_upper.Set(CMO(EMDT66u (5)));
            b1_cEMD66_upper.Set(CMO(EMDT66u, 5));

            Thanks very much in advance for your patience,
            Jon

            Originally posted by NinjaTrader_RyanM View Post
            You're welcome. It should be pretty straight-forward.

            Code:
             
            In variables region:
            private DataSeries MyEMDu;
             
            Initialize():
            MyEMDu= new DataSeries(this);
             
            OnBarUpdate():
            MyEMDu.Set(EMDT(BarsArray[1], iEMD2delta, iEMD2fraction, iEMD2period).UpperBand[0]);
            You can then pass this series (myEMDu) as input for anything that's looking for IDataSeries

            Comment


              #7
              The set method needs a double value, which you can get from a data series by applying an index [ ] to the series.

              As long as b1_cEMD66_upper is a data series, the following should compile:

              b1_cEMD66_upper.Set(CMO(EMDT66u, 5)[0]);
              Ryan M.NinjaTrader Customer Service

              Comment


                #8
                Ryan,

                It is, and it did ... THANKS MUCHO !!

                Jon

                Comment


                  #9
                  Editing NT 7 Built-in Indicator : MAEnvelopes

                  Hi NinjaTrader_RyanM,

                  I have NT7.0.0.23 trial. My system is window XP Professional.

                  Could you help me with coding to edit an NT7.0.0.23 built-in indicator - MAEnvelope?.

                  II want to add on extra bands at top and bottom. But, can not complie. Please see the three attachments.TIA

                  Best,

                  cucuclock
                  Attached Files

                  Comment


                    #10
                    My guess is that your compile error has something to do with modifying a default indicator? Try renaming it first and compile, and then make changes

                    Jon

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by wzgy0920, 04-20-2024, 06:09 PM
                    2 responses
                    27 views
                    0 likes
                    Last Post wzgy0920  
                    Started by wzgy0920, 02-22-2024, 01:11 AM
                    5 responses
                    32 views
                    0 likes
                    Last Post wzgy0920  
                    Started by wzgy0920, 04-23-2024, 09:53 PM
                    2 responses
                    49 views
                    0 likes
                    Last Post wzgy0920  
                    Started by Kensonprib, 04-28-2021, 10:11 AM
                    5 responses
                    193 views
                    0 likes
                    Last Post Hasadafa  
                    Started by GussJ, 03-04-2020, 03:11 PM
                    11 responses
                    3,235 views
                    0 likes
                    Last Post xiinteractive  
                    Working...
                    X