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

BarsArray

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

    BarsArray

    Just a question on how to do barsArray on numeric values. I.e a macd:
    MACD(BarsArray[1], 12, 26, 9)[0] < 0)

    The 0) will be calculated from the current timeframe if I understand this correct. How do I add a different timeframe to a numeric value?

    Regards, Finnbjurvoll

    #2
    Hello Finnbjurvoll,

    Series are added in the Initialize() method. You can see a sample with Tools > Edit NinjaScript > Strategy > SampleMultiTimeFrame.

    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thank you Ryan, but I'm not sure if you understood my question. Maybe I missunderstand, but you are only adding the period type in the Initialize()? I have no problem adding the period to a indicator, the problem is how to add it to the numeric value? ex:

      protected override void Initialize()
      {
      Add(PeriodType.Minute, 30);
      }

      and the condition:
      if( MACD(BarsArray[1], 12, 26, 9)[0] < 0)
      {
      Do something
      }
      --------
      When I trade a 5 minute chart, the macd calculation will be from the 30 min, right? The problem now is that the zeroline will be calculated from the 5 minute tradingchart. So what I'm saying in the code is when the 30 minute macd is above the 5 min zeroline it will do something. Maybe this is a very dumb question, but I don't understand how to add that 30 minute timeframe to the numeric value.
      Hope I'm not bugging you to much here

      FinnBjurvoll

      Comment


        #4
        BarsArray

        Sorry for the trouble Ryan, my mistake here. Problem solved.
        Have a great weekend.

        FinnBjurvoll

        Comment


          #5
          Thanks for the update, FinnBjurvoll. Glad to hear you were able to resolve. Have a great weekend.
          Ryan M.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Waxavi, Today, 02:10 AM
          0 responses
          2 views
          0 likes
          Last Post Waxavi
          by Waxavi
           
          Started by TradeForge, Today, 02:09 AM
          0 responses
          5 views
          0 likes
          Last Post TradeForge  
          Started by Waxavi, Today, 02:00 AM
          0 responses
          2 views
          0 likes
          Last Post Waxavi
          by Waxavi
           
          Started by elirion, Today, 01:36 AM
          0 responses
          4 views
          0 likes
          Last Post elirion
          by elirion
           
          Started by gentlebenthebear, Today, 01:30 AM
          0 responses
          4 views
          0 likes
          Last Post gentlebenthebear  
          Working...
          X