Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Porting NT7-->NT8, not getting something here

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

    Porting NT7-->NT8, not getting something here

    Hey-

    I'm just getting used to NT8 and I'm working to port an NT7 strategy over.

    I've created a list that houses a bunch of instances of MyIndicator:
    Code:
    private List<MyIndicator>MyIndicators = new List<MyIndicator>();
    Now if I'm correct, I should be waiting until State.DataLoaded() is called. Then I try to assign an instance of MyIndicator to my list, going through BarsArray[] to do it:

    Code:
    if (State == State.DataLoaded)
    {
    	for (int i = 0; i < BarsArray.Count(); i++)
    	{
                  MyIndicators.Add(MyIndicator(BarsArray[i], foo1, foo2, foo3, foo4, foo5));
            }
    }
    This is not working as it did in NT7. In NT7, this code was run within "OnStartup()". The compiler error says:
    Code:
    "No overload for method "MyIndicator" takes 6 arguments."
    In NT7, I would later update these indicators in "OnBarUpdate() in the following fashion (though I haven't gotten to porting this portion):

    Code:
    MyIndicators[BarsInProgress] = MyIndicator(BarsArray[BarsInProgress], foo1, foo2, foo3,foo4, foo5);
    Can't figure out what in the heck I'm doing. I'm sure it's something simple. Thoughts?

    Thanks!

    #2
    Hello,

    The error
    "No overload for method "MyIndicator" takes 6 arguments."
    would indicate that your call to the indicator is not correctly formed:

    MyIndicators.Add(MyIndicator(BarsArray[i], foo1, foo2, foo3, foo4, foo5));

    Specifically that it does not take 6 arguments, that would mean it likely takes less than or greater than 6 arguments.

    You could type the indicators name MyIndicator followed by the parenthesis MyIndicator( and you should see the available usages in the intelleprompt window.

    I look forward to being of further assistance
    JesseNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Jesse View Post
      Hello,

      The error would indicate that your call to the indicator is not correctly formed:

      MyIndicators.Add(MyIndicator(BarsArray[i], foo1, foo2, foo3, foo4, foo5));

      Specifically that it does not take 6 arguments, that would mean it likely takes less than or greater than 6 arguments.

      You could type the indicators name MyIndicator followed by the parenthesis MyIndicator( and you should see the available usages in the intelleprompt window.

      I look forward to being of further assistance
      Thank you for the assistance.

      As it turns out, I was using the old NT7 methods in the indicator. That is:

      Code:
      #region Properties
      [Description("Long Term Rate of Change EMA Period")]
      [Category("Parameters")]
      public int LT_ROC_EMA_Period
      {
             get { return lT_ROC_EMA_Period; }
             set { lT_ROC_EMA_Period = Math.Max(1, value); }
      }
      #endregion
      This compiles and works fine when I put the indicator on a chart, so I figured it wouldn't be a problem if I called the indicator from a script.

      None of that was recognized when being called from within the script in NT8, however. When I went to initiate the indicator with no arguments, it worked fine.

      So I updated the methods with the NT8 way of doing it:

      Code:
      #region Properties
      [Range(1, int.MaxValue), NinjaScriptProperty]
      [Display(ResourceType = typeof(Custom.Resource), Name = "Long Term Rate of Change EMA Period", GroupName = "NinjaScriptParameters", Order = 0)]
      public int LT_ROC_EMA_Period  { get; set; }
      #endregion
      This works now.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Aviram Y, Today, 05:29 AM
      0 responses
      2 views
      0 likes
      Last Post Aviram Y  
      Started by quantismo, 04-17-2024, 05:13 PM
      3 responses
      25 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by ScottWalsh, 04-16-2024, 04:29 PM
      7 responses
      34 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by cls71, Today, 04:45 AM
      0 responses
      6 views
      0 likes
      Last Post cls71
      by cls71
       
      Started by mjairg, 07-20-2023, 11:57 PM
      3 responses
      217 views
      1 like
      Last Post PaulMohn  
      Working...
      X