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 Taddypole, 04-26-2024, 02:47 PM
            1 response
            12 views
            0 likes
            Last Post NinjaTrader_Eduardo  
            Started by futtrader, 04-21-2024, 01:50 AM
            6 responses
            58 views
            0 likes
            Last Post futtrader  
            Started by sgordet, Today, 11:48 AM
            0 responses
            4 views
            0 likes
            Last Post sgordet
            by sgordet
             
            Started by Trader146, Today, 11:41 AM
            0 responses
            5 views
            0 likes
            Last Post Trader146  
            Started by jpapa, 04-23-2024, 07:22 AM
            2 responses
            22 views
            0 likes
            Last Post rene69851  
            Working...
            X