Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error Message

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

    Error Message

    Hi,

    I am trying to make an EMA angle indicator but for some reason I get the following error message when I try run the code (I made it into a strategy to try and print off the errors)

    **NT** Error on getting/setting property 'Time' for strategy 'PrintEMAangle/61efed26271e48a4b09c3bfbeca12ecd': Object of type 'NinjaTrader.Indicator.TimeSeriesHelper' cannot be converted to type 'System.Int32'.

    I cant even run the following code

    PHP Code:
            protected override void OnBarUpdate()
            {
            double closes1 = EMA(length)[1] - EMA(length)[2];
            PrintWithTimeStamp(closes1.ToString());
    //            double radians = Math.Asin(closes1 / TickSize);
    //            double degrees = radians * 180/Math.PI;    
    //        PrintWithTimeStamp(degrees.ToString());
            } 
    
    any suggestions as to what I am doing wrong

    PS - I already found the indicator in the form to download but I want to work on my coding skills and I cant figure out what is wrong

    #2
    Euro,

    Thanks for your note.

    Would have you have to send full code to support at ninjatrader dot com and reference this forum post for me to look into as the issue where the problem is not posted.

    My guess would be you have a property in your starting properties off being set to an int variable when it should be a DateTime. Are you setting a time in your indicator properties on addition of the indicator to a chart?

    I look forward to assisting you further.
    BrettNinjaTrader Product Management

    Comment


      #3
      opps

      I resolved the conflict as I was trying to access more historical bars then were called. (i was trying to use the equation EMA(20)[0] - EMA(20)[1], which needs historical information that was not in the chart... I added in the following code to fix that

      if (CurrentBar < (length + 2)) return;


      I also realized i had made a variable named "time", which was messing things up.. thanks

      Comment


        #4
        Hello,

        Excellent, glad your up and running.

        Let me know if I can be of further assistance.
        BrettNinjaTrader Product Management

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        596 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        343 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        103 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        556 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        554 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X