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

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.
    BertrandNinjaTrader Customer Service

    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.
        BertrandNinjaTrader Customer Service

        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

            BertrandNinjaTrader Customer Service

            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 usazencort, Today, 01:16 AM
                  0 responses
                  1 view
                  0 likes
                  Last Post usazencort  
                  Started by kaywai, 09-01-2023, 08:44 PM
                  5 responses
                  603 views
                  0 likes
                  Last Post NinjaTrader_Jason  
                  Started by xiinteractive, 04-09-2024, 08:08 AM
                  6 responses
                  22 views
                  0 likes
                  Last Post xiinteractive  
                  Started by Pattontje, Yesterday, 02:10 PM
                  2 responses
                  21 views
                  0 likes
                  Last Post Pattontje  
                  Started by flybuzz, 04-21-2024, 04:07 PM
                  17 responses
                  230 views
                  0 likes
                  Last Post TradingLoss  
                  Working...
                  X