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 The_Sec, Yesterday, 03:37 PM
            1 response
            11 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by vecnopus, Today, 06:15 AM
            0 responses
            1 view
            0 likes
            Last Post vecnopus  
            Started by Aviram Y, Today, 05:29 AM
            0 responses
            5 views
            0 likes
            Last Post Aviram Y  
            Started by quantismo, 04-17-2024, 05:13 PM
            3 responses
            27 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by ScottWalsh, 04-16-2024, 04:29 PM
            7 responses
            36 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Working...
            X