Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Error

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

    Strategy Error

    Hi All,

    I tried creating a strategy that goes long when two custom indicators (Double MA and TSSuperTrend) are both rising and NT doesn't seem to like it:

    // Condition set 1
    if (TSSuperTrend(3, TSSuperTrend.Utility.MovingAverageType.VMA, 1.23, 3, TSSuperTrend.Utility.SuperTrendMode.ATR).UpTrend[0] && DoubleMA(5, NinjaTrader.Indicator.MAV+MAType.HMA, 45, NinjaTrader.Indicator.MAV+MAType.VMA).RisingPlot[0])

    I'm getting two each of the following error messages:

    'NinjaTrader.Strategy.Strategy.TSSuperTrend(int, TSSuperTrend.Utility.MovingAverageType. double, int, TSSuperTrend.Utility.SuperTrendMode)' is a 'method' which is not valid in the given context

    AND

    'NinjaTrader.Indicator.Mav' is a 'type', which is not vaild in the given context

    Any thoughts?

    Thanks - Dave

    #2
    Hello,

    I'm not really sure since I can't see the required parameters for the custom's you have built.
    However, what are you trying to do with this, for example?:
    TSSuperTrend.Utility.MovingAverageType.VMA
    and this:
    NinjaTrader.Indicator.MAV+MAType.HMA

    What are the custom indicator parameter types required?
    For example one of the ways to use Bollinger() is like this:

    Bollinger(IDataSeries inputData, double numStdDev,int period)

    The required parameter types are in blue.
    DenNinjaTrader Customer Service

    Comment


      #3
      Thanks for replying, Ben.

      In English, the Double MA is a combo of two different MAs. When they cross, the Double changes color to define the trend. The SuperTrend is a trailing stop indicator. Based on price movement, it also changes color to show trend. I am trying to enter when both agree.

      In NT terms, I'm not really sure how to answer you as I admittedly don't know ninjascript well at all. Is there anything else I can post that would help?

      Thanks,
      Dave

      Comment


        #4
        Wanted to add:

        Tried using the wizard to help. Set up my indicator (DoubleMA) on the left, == in the middle and "Rising" on the right. Got the following error message:

        Return type of left expression 'DoubleMA' and right expression 'Boolean' do not match. You need to select a different item.

        I get the same message when I set the indicator to rising == true.

        What am I doing wrong?

        Thanks

        Comment


          #5
          Hello,

          There could be multiple issues going on and I can't tell what you are doing or what you want etc.

          I recommend starting very basic building from there.

          For example save a default indicator under a different name then try to use it in your strategy. Check the values with Print():


          Then try modifying the indicator input parameters and repeat the process above.
          DenNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          627 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          359 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          105 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          562 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          567 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X