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 cmoran13, 04-16-2026, 01:02 PM
        0 responses
        43 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        25 views
        0 likes
        Last Post PaulMohn  
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        163 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        98 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        158 views
        2 likes
        Last Post CaptainJack  
        Working...
        X