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

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

    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 PhillT, 04-19-2024, 02:16 PM
            4 responses
            33 views
            0 likes
            Last Post PhillT
            by PhillT
             
            Started by ageeholdings, 05-01-2024, 05:22 AM
            5 responses
            36 views
            0 likes
            Last Post ageeholdings  
            Started by reynoldsn, Today, 02:34 PM
            0 responses
            11 views
            0 likes
            Last Post reynoldsn  
            Started by nightstalker, Today, 02:05 PM
            0 responses
            18 views
            0 likes
            Last Post nightstalker  
            Started by llanqui, Yesterday, 09:59 AM
            8 responses
            30 views
            0 likes
            Last Post llanqui
            by llanqui
             
            Working...
            X