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

Mro

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

    Mro

    The documentation on MRO shows the following,
    "int barsAgo = MRO(delegate {return Close[0] > Open[0];}, 1, 9);
    if (barsAgo > -1)

    I used this in the variables section:
    int barsAgoUp = MRO(delegate {return HeikenAshi().HAClose[0] > HeikenAshi().HAOpen[0];}, 1, 4);
    and also
    int barsAgoDown = MRO(delegate {return HeikenAshi().HAClose[0] <= HeikenAshi().HAOpen[0];}, 1, 4);

    In the On Bar Update section, I used:
    if (barsAgoUp > -1) as part of the code for the long entry
    and then
    if (barsAgoDown > -1) as part of the code for the short entry

    The error I am getting reads: An object reference is required for the non-static field...

    Can anyone please help me with this?

    #2
    Hello birdjaguar,

    I've tested using the HeikenAshi() from the code you have posted in an indicator but I am finding this appears to work without error.

    Are you getting an error when testing this script on your end?
    Attached Files
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I am trying to use this code in a strategy and yes I am getting the error message I mentioned on the two lines in the variables section. I am not able to import the file you attached. I get a message that says I have to resolve the programming errors I have before I can import a NinjaScript archive file. Any advice on where I can go from here?

      Comment


        #4
        Hello birdjaguar,

        Thank you for your patience.

        Please attach a screenshot of the error message in the NinjaScript Editor with the Name and Description fields clearly readable.
        You can also double click on the message to have the NinjaScript Editor take you directly to the line that is generating the message.

        To send a screenshot with Windows 7 or newer I would recommend using Window's Snipping Tool.

        Click here for instructions

        Alternatively to send a screenshot press Alt + PRINT SCREEN to take a screenshot of the selected window. Then go to Start--> Accessories--> Paint, and press CTRL + V to paste the image. Lastly, save as a jpeg file and attach the file to your response.

        Click here for detailed instruction

        Comment


          #5
          Well, I did learn that I cannot import a file if I have any programming errors in any file in my strategies. I have to actually delete that strategy in order to import. Thank you Patrick for your response, but I have moved on to a lookback statement instead. I still don't know why the MRO code did not work, but I will cross this bridge if I need it at a later time. Thanks again.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by bmartz, 03-12-2024, 06:12 AM
          5 responses
          33 views
          0 likes
          Last Post NinjaTrader_Zachary  
          Started by Aviram Y, Today, 05:29 AM
          4 responses
          13 views
          0 likes
          Last Post Aviram Y  
          Started by algospoke, 04-17-2024, 06:40 PM
          3 responses
          28 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by gentlebenthebear, Today, 01:30 AM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by cls71, Today, 04:45 AM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Working...
          X