Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Calling indicator variables from another indicator

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

    Calling indicator variables from another indicator

    I want to create an indicator that can be used in the Market analyzer that will send an alert when the Bollinger Bands are inside the Keltner Channel. I have found examples of how to call an indicator from within another indicator however I believe I need to test Upper Bollinger Band < Upper Keltner Channel and Lower Bollinger > Lower Keltner Channel. Is it possible to call the individual variables (upper & lower bands) for each of the BB & KC from within a 3rd indicator to test for these conditions?.

    Thanks,
    Dave H.

    #2
    dwh112655,

    Yes, it would be something like :

    Bollinger(double numStdDev, int period).Upper[int barsAgo]

    Bollinger(double numStdDev, int period).Lower[int barsAgo]

    You can find out more about the Keltner channel using our help guide.

    http://www.ninjatrader.com/support/h...er_channel.htm

    Please let me know if I may assist further.
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Thanks NinjaTrader_AdamP

      Thats just the example and link I needed. Thanks for the quick response.

      Dave H.

      Comment


        #4
        Calling RValueChart

        Hello, whats the proper way to call the RValueChart indicator from withing an other indicator?

        ive did couple tests but i guess im doing something wrong.

        Comment


          #5
          kabott,

          I am not familiar with this indicator, could you please post a link to it?
          Adam P.NinjaTrader Customer Service

          Comment


            #6
            Hi Adam, sure, here it is.RValueChart.zip

            Comment


              #7
              kabott,

              RValueCharts(bool changeBackground, bool dotDraw, int dotOffset, Color dotOverBought, Color dotOverSold, Color downColor, Color extremeOver, int length, Color lineCol, bool mainChartSettings, Color moderateOver, Color outlineColor, float outlineWidth, int soundAlertInterval, bool soundWarnings, bool textWarnings, Color upColor, ValueChartStyle vct)[int index]

              Is the way to call it. You would need to replace all the different things like Color outlineColor with the appropriate inputs.

              It looks like it may be drawing objects inside its code, and you would need to find a way to access these values possibly using the following example.

              http://www.ninjatrader.com/support/f...ead.php?t=4991
              Last edited by NinjaTrader_AdamP; 02-13-2012, 10:33 AM.
              Adam P.NinjaTrader Customer Service

              Comment


                #8
                For anyone following:

                This is the abbreviated code for the Bollinger Band Keltner Channel squeeze indicator for Market Analyzer. Works well but I will improve it:

                privateint SA = 0;

                if(Bollinger(2, 20).Upper[0] < KeltnerChannel(1.5, 20).Upper[0] && Bollinger(2, 20).Lower[0] > KeltnerChannel(1.5, 20).Lower[0])
                SA = 1;
                else
                SA = 0;
                Value.Set (SA);

                Comment


                  #9
                  Defining a DataSeries

                  I have a follow-up question regarding the Market Analyzer Indicator I developed at the beginning of this thread. The Indicator checks for the "Squeeze" condition, when the Bollinger Bands are inside the Kelner Channel and delivers a numeric value that the Market Analyzer can evaluate. I have it working. Now I would like to add a Momemtum check, but I would like to evaluate Momentum on "smoothed" price data using Linear Regression. I created a DataSeries named LRDataSeries and Double Value named MOM. My intend was to create the LRDataSeries from Linear Regression of the Input Data without efecting the Input Data so it could be used for BBand & KC calcs: Calulate BB & KC from Input Data; calculate Momentum using 20 period Linear Rgression. Here's what I have:

                  protectedoverridevoid OnBarUpdate()

                  {

                  LRDataSeries.Set(LinReg(20)[0]);
                  MOM = Momentum(LRDataSeries,12)[0];



                  if(Bollinger(2, 20).Upper[0] <= KeltnerChannel(1.5, 20).Upper[0] && Bollinger(2, 20).Lower[0] >= KeltnerChannel(1.5, 20).Lower[0])

                  if (MOM > .0002)
                  SA = 1;
                  elseif (MOM < -.0002)
                  SA = 2;
                  else
                  SA = 3;
                  else
                  SA = 0;
                  Value.Set (SA);

                  The problem is that the BB and KC calcs do not appear to be using the original Inut Data. The indicator compiles without error, but no longer calulates the BB & KC correctly. I can only get this to work if I use Input Data for all calculation. Any help from the NT experts would be appreciated.

                  Thanks
                  Dave H

                  Comment


                    #10
                    OK I was making this more complicated that it is. Just need the correct placement of executions, this should work:
                    protected override void OnBarUpdate()

                    {



                    if(Bollinger(2, 20).Upper[0] <= KeltnerChannel(1.5, 20).Upper[0] && Bollinger(2, 20).Lower[0] >= KeltnerChannel(1.5, 20).Lower[0])
                    {
                    Value.Set(LinReg(12)[0]);
                    MOM = Momentum(12)[0];
                    if (MOM0 > .0002 && MOM0 >= MOM1)
                    SA = 1;
                    else if (MOM0 < -.0002 && MOM0 <= MOM1)
                    SA = 2;
                    else
                    SA = 3;
                    }
                    else
                    SA = 0;
                    Value.Set (SA);

                    Compile & produces correct results.

                    Comment


                      #11
                      keltner channel

                      working on a modified keltner indicator, what is the entire math behind the keltner channel that nija trader uses. thanks if possible

                      Comment


                        #12
                        Hello Dave,
                        Thanks for your note and I am replying for Adam.

                        You can find the calculation for the Keltner channel from:
                        • In Control Center menu bar goto Tools>Edit NinjaScript>Indicators...
                        • In the Indicator dialog, select KeltnerChannel indicator and click on the Ok button.


                        Please let me know if I can assist you any further.
                        JoydeepNinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by mg.watts, Today, 03:17 PM
                        1 response
                        13 views
                        0 likes
                        Last Post NinjaTrader_ChrisL  
                        Started by JTizz, Today, 01:20 PM
                        1 response
                        7 views
                        0 likes
                        Last Post NinjaTrader_Jesse  
                        Started by omermirza, Today, 12:39 PM
                        2 responses
                        12 views
                        0 likes
                        Last Post omermirza  
                        Started by mballagan, Today, 01:02 PM
                        1 response
                        7 views
                        0 likes
                        Last Post NinjaTrader_Kate  
                        Started by larkmail, Today, 12:30 PM
                        3 responses
                        12 views
                        0 likes
                        Last Post NinjaTrader_Kate  
                        Working...
                        X