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

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.

    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.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by haas88, 03-21-2024, 02:22 AM
        18 responses
        207 views
        0 likes
        Last Post haas88
        by haas88
         
        Started by Board game geek, Today, 02:20 AM
        0 responses
        1 view
        0 likes
        Last Post Board game geek  
        Started by knighty6508, Today, 01:20 AM
        2 responses
        13 views
        0 likes
        Last Post knighty6508  
        Started by franatas, Today, 01:53 AM
        0 responses
        2 views
        0 likes
        Last Post franatas  
        Started by knighty6508, Today, 01:17 AM
        0 responses
        9 views
        0 likes
        Last Post knighty6508  
        Working...
        X