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

How to add an indicator to an indicator?

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

    How to add an indicator to an indicator?

    Hi All,

    I am brand new to Ninja Trader and particularly the programming. I was wondering if there is anyone that can help me out. I am looking for an indication that is used by Dr. Elder. it is the Force index but it has a Keltner 3xATR overlaid onto it. I can find the force index and I can find the Keltner Channel Indicator but I can't seem to figure out how to combine the two together.

    Also, The final indicator I am after uses a variable EMA for the Force Index and there is only one. The standard Force Index has two SMA's. The Keltner Channel only needs to show the upper and lower bands. The middle band is not required.

    Thanks in advance for any help you can provide on this.

    #2
    Hello Kaiviti,

    Do you have a source of this indication for comparison?

    Does the Force index use the Keltner calculations in its foruma or is it just for plotting?
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Indicator Source

      Cal, the source is the pdf put out by Dr. Alexander Elder called "Step-by-Step Trading". The Keltner channel is plotted on top of the 13 bar Force index and is a 26 period, 3 x ATR.

      Comment


        #4
        Kaiviti,

        Thank you for your note.

        You would want to just add the Keltner to the chart but change the input series for it to use the ForceIndex for its calculations.

        Right click on the Chart -> Indicators... -> Add the Keltner Channel -> Change Input Series -> Select your new ForceIndex (that you would have created) -> Click OK and OK to save and exit the window.
        Cal H.NinjaTrader Customer Service

        Comment


          #5
          Thanks Cal, but that is not really what I was looking for. The Keltner Channels on the Force Index provide the buy and sell signal. Having the Keltner Channel on the chart does not do this.

          There must be a way to customise the programming of the Force Index to include the Keltner Channel values based on the chart values. I don't know how to do this at present and I was hoping that someone out there may have already done this or can show me how to easily do it. I will learn to do it myself but being shown how to quickly copy and paste programming text and where to place it etc. would be a good kick start for me.

          Comment


            #6
            Hello,

            This is Dave, responding on behalf of Cal. Please take a look at the attached indicator. I may still need a bit of clarification on exactly what you are looking for, but hopefully this will get us pointed in the right direction. What I've done with this indicator is started with the code for the ForceIndex indicator, then added two new lines to plot the KeltnerChannel upper and lower bands. The offset for the bands is 3 ATR, and the period for the Keltner calculations is 26.

            Here is the issue that I'm running into (and the reason I believe I may need a bit of clarification). Since the Keltner bands are based on the market price, rather than the ForceIndex plots, the values of the Keltner bands are so small compared to the ForceIndex plots that the Keltner bands are scrunched together and essentially look like a single flat line (the blue line). For example, right now I'm getting values of 2078 (upper) and 2070 (lower) applied to the ES, but the ForceIndex plot values are -27,000 and 10,000. Since all of these lines are plotted together, the Keltner bands are virtually unreadable when autoscaled along with the other plots.

            Can you please clarify how this code can be changed to accomplish what you are looking for? I just need a bit of clarification on exactly what data the KeltnerChannel bands should be based upon, and how the two indicators should look when plotted together.

            I look forward to your reply.
            Attached Files
            Dave I.NinjaTrader Product Management

            Comment


              #7
              Hi Dave, Thanks for working on this. I have attached an extract from the pdf by Dr. Elder which shows what the ForceKeltner should look like. Notice that this is based on the weekly chart. I downloaded and imported your indicator but it doesn't look any different to the standard Force Index? I don't see any Keltner channel at all and there is no section to adjust the values of the Keltner Channel. I can change the colors of the Keltner lines but this does not show any changes on the chart. Therefore, I would say that the Keltner Channel lines are not being plotted.
              Attached Files

              Comment


                #8
                I wanted to touch base and let you know that I'm still working on this. I've run into a snag, but I should have an update for you soon.
                Dave I.NinjaTrader Product Management

                Comment


                  #9
                  Hello,

                  I've got the indicator all set. In the end, I decided not to integrate the existing KeltnerChannel indicator, but rather just recreate the KeltnerChannel logic using the calculation in the link below:

                  http://stockcharts.com/school/doku.p...ltner_channels

                  This should be a good starting point / template for you to work with to fine tune it to your liking. There are a few things to note:
                  • I've tried to comment the code as much as possible to show you where different things are happening.
                  • The Keltner bands are based off of the FI data series in the script. You can change this to use the FastLine or SlowLine plots instead, if you would like.
                  • You can change the Keltner offset by changing the input passed into the ATR method call when assigning the value to the keltnerOffset variable. It is currently set to 3.


                  Please let me know if I can assist further.
                  Attached Files
                  Dave I.NinjaTrader Product Management

                  Comment


                    #10
                    Hi Dave,

                    Sorry for taking so long in getting back to you on this. Been away for awhile. I have loaded the ForceKeltner index you created and it works. But, not quite as I was hoping. Could you possibly make a few alterations for me. I could (and probably will) try to do it myself but, I may bugger it up completely.

                    1) Can you set the default to EMA instead of SMA.
                    2) Can we remove one of the force indicator lines. The only line required has a default value of 13.
                    3) Only need the upper and lower Keltner Channel lines. The middle is not needed but could be left in with a dot value rather than a solid line.
                    4) The Keltner default values are 26,3,26.
                    5) Can you set in a feature to adjust the Keltner Channel values. Currently, only the force index values can be adjusted.

                    Once again, many thanks for this.

                    Cheers, Ivan

                    Comment


                      #11
                      Originally posted by Kaiviti View Post
                      1) Can you set the default to EMA instead of SMA.
                      2) Can we remove one of the force indicator lines. The only line required has a default value of 13.
                      3) Only need the upper and lower Keltner Channel lines. The middle is not needed but could be left in with a dot value rather than a solid line.
                      4) The Keltner default values are 26,3,26.
                      5) Can you set in a feature to adjust the Keltner Channel values. Currently, only the force index values can be adjusted.
                      I'm glad to hear that it is working well for you. I've attached an updated copy with the changes you requested. I've exposed the keltnerMAPeriod variable, which will allow you to set the MA period for the Keltner Channel. Can you tell me what other parameters should be exposed, and what variables correspond to the 26, 3, 26 values for Keltner? I'm only seeing an MA period for the Keltner portion of the indicator, unless I'm missing something.
                      Attached Files
                      Dave I.NinjaTrader Product Management

                      Comment


                        #12
                        Hi Dave,

                        The file you have attached is a .cs file. I don't know this type and Ninja Trader won't import it. Can you resend it as a .zip file please

                        Comment


                          #13
                          Hello,

                          You will find your C# source files in the following directories:
                          • C:\Users\<username>\Documents\NinjaTrader 7\bin\Custom\Indicator
                          • C:\Users\<username>\Documents\NinjaTrader 7\bin\Custom\Strategy

                          You can place the source file in one of these directories, and you will be able to access it in NinjaTrader (you will need to compile before it appears in the Indicators or Strategies window on charts, etc., but you can edit it right away).
                          Dave I.NinjaTrader Product Management

                          Comment


                            #14
                            Hi Dave,

                            OK, got he file installed and checked it out. However, it is still not quite what I was looking for. Can you please have another go at this. The changes I would like to see are:

                            1) Remove the Fast line for the Force index. I only need one line and this has a default period of 13 and EMA on the close.

                            2)The option to select SMA, EMA or HMA has been removed but it shows up in the parameters. This to me indicates that it is a variable factor. Can you reset this so that it can be changed?

                            3) The Keltner channels are based on a default value of 26 EMA period of the close. They also have a default offset of 3 x ATR. Can you include the option to select the values for both the period and the offset?

                            Comment


                              #15
                              Hello Kaiviti,

                              Thank you for your response.

                              I wanted to advise that we do not provide programming services in general. As this task was simple, Dave was given this as part of his training.

                              I will finish your last three items here, but I must advise that you seek development of this through yourself or a third party.

                              For #1, you are just looking for on line and I can remove the fast and slow lines, correct?
                              For #2, you do not wish to select a Moving Average? What would be the Moving Average used then?

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by judysamnt7, 03-13-2023, 09:11 AM
                              4 responses
                              59 views
                              0 likes
                              Last Post DynamicTest  
                              Started by ScottWalsh, Today, 06:52 PM
                              4 responses
                              36 views
                              0 likes
                              Last Post ScottWalsh  
                              Started by olisav57, Today, 07:39 PM
                              0 responses
                              7 views
                              0 likes
                              Last Post olisav57  
                              Started by trilliantrader, Today, 03:01 PM
                              2 responses
                              21 views
                              0 likes
                              Last Post helpwanted  
                              Started by cre8able, Today, 07:24 PM
                              0 responses
                              10 views
                              0 likes
                              Last Post cre8able  
                              Working...
                              X