Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

type question

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

    type question

    Hello,
    I'm getting an error when adding the Channel This indicator to a strategy can anyone explain how to fix it?

    "'Ninja Trader.Indicator.DoubleMA_internal' is a 'type', which is not valid in the given context".

    How to I change the indicator 'type' and what would I change it to?
    Thanks

    #2
    CaptainAmericaXX, unfortunately we would not be familiar enough with this custom indicator code, it would be best you contacted the developer directly.

    Comment


      #3
      Understood. I did put in a pm, but no response. I guess I'm going to have to create what I want. I have gone through the tutorials on creating indicators. Could you point me to something specific that would give me information on creating channels with MA?
      Thanks

      Comment


        #4
        A channel can be created several ways...adding a percent constant above below MA value, a standard deviation value, ATR, even a fixed offset sometimes makes sense - it would be really up to your needs and uses. A basic example might be Bollinger Bands or the Keltner one.

        Comment


          #5
          Bertrand,
          I've studied the Keltner Channel logic and compared it to the MAVinStrat that you created. I've also studied the Channel This thoroughly. I'm still unclear on how to put it all together another suggestion would be very helpful.
          Here is the logic for Keltner:
          diff.Set(High[0] - Low[0]);
          double middle = SMA(Typical, Period)[0];
          double offset = SMA(diff, Period)[0] * offsetMultiplier;
          double upper = middle + offset;
          double lower = middle - offset;

          I understand how that all works. Where I run into a challenge is how to plug in your indicator from MAVinStrat:
          (MAV( MAV(Input, MA1Period, (int)MA1Type ), MA2Period, (int)MA2Type))
          since I can't convert the indicator to a double.
          Can you please give me an example of how to add your indicator to the channel logic?
          Thanks

          Comment


            #6
            This normally means you do not apply the needed index to the indicator series to get the double value you're interested in to work with, for example:

            myDouble = SMA(20) > will give you this error while

            myDouble = SMA(20)[0] > will work ok

            Comment


              #7
              Bertrand
              Continuing on, I used the ChannelThis as a template with the MAV you created to create the midline of the channel. It doesn't work because the MAV doesn't take 4 arguments.

              Mid.Set(MAV(MA1Period, (int)MA1Type, MA2Period, (int)MA2Type)[0])

              Mid.Set(DoubleMA(MA1, MA1Type, MA2, MA2Type).DMV[0]);

              Is there a way to use the MAV in this formula?

              Comment


                #8
                All right. I figured it out. Was using the Set() in a strategy. Apparently that's a no no. Made a new channel indicator using the indicator that Bertrand made for MAVinStrat, (MAV(MAV(Input, MA1Period, (int)MA1Type ), MA2Period, (int)MA2Type)[0]) but a strategy will still not compile. I'm still getting the error:
                "'NinjaTrader.Indicator.MAV' is a 'type', which is not valid in the given context
                I still don't know how to fix it. There is something in that MAV indicator that is messed up. Certainly would like some help on this 'type' issue.

                Comment


                  #9
                  Hi CaptainAmericaXX,

                  I am not sure what is contained in the file Bertrand made as he is offline right now, but the message you are getting suggests somewhere you are trying to access it incorrectly. Unfortunately I will not be able to tell you what exactly is wrong without seeing what exactly MAV is. Bertrand will follow up with you on Monday at the latest when he gets back into the office. Thank you for your patience.
                  Josh P.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  571 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  330 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  101 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  548 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  549 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X