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

Help with my highertimeframe indicator

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

    Help with my highertimeframe indicator

    Hey guys i made a simple indicator using the Strat builder, but there's not much info on what i need to change to make it into an indicator, i tried making a indicator script and copying over the info but that didn't seem to work. its a simple one that lets you chose a higher time frame chart and it color codes the background when the trends are in sync on both charts.

    included is the indicator which is now in strategy format
    Attached Files

    #2
    Hello CoffeeOutlaw,

    Thank you for your note.

    The strategy as exported is in a compiled assembly and the code cannot be reviewed - I would suggest exporting again without checking the box to export as a compiled assembly so we may take a look at your source code to give you some pointers.

    What I usually recommend is that once you've created the item as a strategy in the Builder that you unlock the code as you'll need to see the source code to turn it into an indicator script. You can then right click on the Indicators folder in the NinjaScript Editor and select New Indicator to bring up the new indicator wizard, where you can set up any additional data series, user inputs, plots or variables, then once you have those set up, it will give you a skeleton outline. You can then pretty much copy and paste your code from the strategy into the indicator and make any changes necessary for items that may be used in a strategy but not an indicator. If you run into specific questions we're here to assist!

    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      oooops
      i do a mix of strat builder and code work to make this , exported without compiled assembly
      Attached Files

      Comment


        #4
        Hello CoffeeOutlaw,

        Thank you for your reply.

        While we can't convert it for you, this one looks very straightforward. I'd follow the workflow I suggested above - make sure you copy all the code from the Strategy OnBarUpdate() to the Indicator OnBarUpdate, make sure you copy over the initialization of variables above OnStateChange to the same place in the new indicator, and make sure you have everything from State == State.Configure and State.DataLoaded copied from one to the other - if you run into specific compile errors, let us know.

        Please let us know if we may be of further assistance to you.
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          NinjaTrader_Kate i did as suggested but it does not seem to be working, the coloring does not show up in the background, and even tho i get the text in the right top it does not seem to update with the data.
          Attached Files

          Comment


            #6
            Hello CoffeeOutlaw,

            Thank you for your note.

            You're hitting a reference not set to an instance of an object error here, because on Line 101 you're referring to EMA5 and EMA6 but haven't assigned an EMA to those, you've only assigned EMAs to EMA1 though EMA4. You'll either need to set those up like you have 1 through 4 in State.DataLoaded or switch them so that line uses ones that you do have set up.

            Once that's done, you should see everything update as you'd expect.

            Please let us know if we may be of further assistance to you.
            Kate W.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by PaulMohn, Today, 12:36 PM
            0 responses
            1 view
            0 likes
            Last Post PaulMohn  
            Started by love2code2trade, 04-17-2024, 01:45 PM
            4 responses
            38 views
            0 likes
            Last Post love2code2trade  
            Started by alifarahani, Today, 09:40 AM
            2 responses
            14 views
            0 likes
            Last Post alifarahani  
            Started by junkone, Today, 11:37 AM
            3 responses
            20 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by frankthearm, Yesterday, 09:08 AM
            12 responses
            44 views
            0 likes
            Last Post NinjaTrader_Clayton  
            Working...
            X