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 burtoninlondon, Today, 12:38 AM
            0 responses
            10 views
            0 likes
            Last Post burtoninlondon  
            Started by AaronKoRn, Yesterday, 09:49 PM
            0 responses
            14 views
            0 likes
            Last Post AaronKoRn  
            Started by carnitron, Yesterday, 08:42 PM
            0 responses
            11 views
            0 likes
            Last Post carnitron  
            Started by strategist007, Yesterday, 07:51 PM
            0 responses
            14 views
            0 likes
            Last Post strategist007  
            Started by StockTrader88, 03-06-2021, 08:58 AM
            44 responses
            3,983 views
            3 likes
            Last Post jhudas88  
            Working...
            X