Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Default 'VMA' not available in strategy

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

    Default 'VMA' not available in strategy

    Greetings,

    I was using the default VMA in a strategy, but an error on each compile. I do believe that the dataseries in VMA is available to use in a strategy?!

    I used a double :
    b1_VMA[0] = VMA(BarsArray[1],iUseVMAPeriod,iUseVMAPeriodCMO).VMA[0];

    and received an error:
    " Cannot apply indexing with [] to an expression of type 'method group',CS0021 " ...which to me made no sense.

    I tried another VMA (jhlVMA from BMT) that also contained a VMA plot and compiles without a problem, without any code change except for indie name:

    b1_VMA[0] = jhlVMA(BarsArray[1],iUseVMAPeriod,iUseVMAPeriodCMO).VMA[0];

    Problem solved, but I am curious why this is with a default indicator?

    Jon

    #2
    Yes, all indicators would implement the IDataSeries interface, your snippet gave me no issues and I could pass any BarsArray into the VMA - which NT version would you use here?

    Thanks,

    Comment


      #3
      Bertrand,

      I am using RC1 ... I also tried renaming @VMA to jtVMA and the issue persists after compile. I tried on RC1 on a virtual machine and same issue.

      'shrug' Jon

      Comment


        #4
        Hi Jon,

        Default indicator VMA has only one plot, so it's not necessary to specify the .VMA at the end.

        double b1_VMA = VMA(BarsArray[1], iUseVMAPeriod, iUseVMAPeriodCMO)[0];
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Ryan,

          Thanks !!

          Comment


            #6
            new thread

            Simple, I think ...need new thread

            Jon
            Last edited by Trader.Jon; 11-29-2010, 02:17 PM. Reason: typo

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            576 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            334 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
            553 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            551 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X