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 jxs_xrj, 01-12-2020, 09:49 AM
        6 responses
        3,290 views
        1 like
        Last Post jgualdronc  
        Started by Touch-Ups, Today, 10:36 AM
        0 responses
        7 views
        0 likes
        Last Post Touch-Ups  
        Started by geddyisodin, 04-25-2024, 05:20 AM
        8 responses
        61 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by Option Whisperer, Today, 09:55 AM
        0 responses
        8 views
        0 likes
        Last Post Option Whisperer  
        Started by halgo_boulder, 04-20-2024, 08:44 AM
        2 responses
        24 views
        0 likes
        Last Post halgo_boulder  
        Working...
        X