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

Shortcut?

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

    Shortcut?

    Let me preface this with saying I'm a complete programming noob.

    I wanted to tinker around with the coding for an existing Ninjascript system indicator. I created a new custom indicator, then copied and pasted a system indicator (CandleStickPattern) into my newly created indicator. When I tried compiling it, the errors popped up. I would like to find a NinjaSript similar to what I'm looking for and see what I can do with playing around with it. Anyone know if there is a way to do this?

    Thanks,

    #2
    Gennaker, welcome to our forums - please delete just created custom indicator again from the platform.

    And then start this process by opening up a system indicator you wish to copy and right click in the code selecting then 'save as' and enter a new name for the script to be copied into. Then you could gradually work your changes in this script.

    For getting started in NinjaScript, I generally recommend taking a look at those tutorials:

    BertrandNinjaTrader Customer Service

    Comment


      #3
      The tutorials were helpful and I've been able to manipulate some of the coding to create a few indicators I want. However, I tried to delete a draft NinjaScript and got an error message saying it was referenced by another NinjaScript and these dependencies must be removed first. I've gone back through all the files I worked on today and can not find where I may have done this. I guess there is no harm in leaving it there?

      Comment


        #4
        Gennaker, great to hear on your successes - I would then simply leave it there for now.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          NinjaTrader_Bertrand, when trying to use the following statement: if (SMA(10) > High[1]), I get an error message saying I can use '>' with Ninja.Trader.SMA and 'double'. I've used a similar 'double' statement in other indicators. Would appreciate your insight.

          Comment


            #6
            Gennaker, you would need to pick a double value from the SMA series for comparison :

            if (SMA(10)[0] > High[1])
            BertrandNinjaTrader Customer Service

            Comment


              #7
              That did the trick. Thanks. I've run into a different problem. I was able to create 4 indicators that worked by editing an existing ninjascript. Now 3 of the 4 will not work. I haven't been diligent about deleting previous versions of ninjascripts as I work through different approaches. Could this cause them to stop workin?

              Comment


                #8
                Gennaker, can you please clarify what you mean by 'not working'? So they stopped working as you applied them to your charts? Or would they show compile errors? This could be the case already if one script has as issue in the code, NinjaTrader compiles all scripts into one assembly to be used at runtime then, so they all would have to be compilable and free of any offending code.
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  They stopped working as I applied them to the charts.

                  Comment


                    #10
                    Any errors then in your Control Center log tab after you've applied them on the charts?
                    BertrandNinjaTrader Customer Service

                    Comment


                      #11
                      I hadn't checked that. It did register an OnUpdateBar error saying I was accessing an invalid index since it's out of range. It doesn't make sense because I'm dealing with candlestick scripts that only go back one bar. I tried to comment out anything else including indexes. Plus I've downloaded 5 days of historical data and am using a 5 minute chart. Can't figure out why this would happen.

                      Comment


                        #12
                        Please check into this tip here - http://www.ninjatrader.com/support/f...ead.php?t=3170

                        and then ensure a CurrentBar's check is added to all your scripts OnBarUpdate() as needed.
                        BertrandNinjaTrader Customer Service

                        Comment


                          #13
                          I did use an SMA(10) index, but that's only 10 bars back.

                          Comment


                            #14
                            So for SMA(10), I would need to use a code like,

                            If (CurrentBar < 10)
                            Return;
                            ?

                            Comment


                              #15
                              Yes, that did the trick. Danke shoen, Bertrand.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by gentlebenthebear, Today, 01:30 AM
                              1 response
                              8 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by Aviram Y, Today, 05:29 AM
                              1 response
                              7 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by cls71, Today, 04:45 AM
                              1 response
                              7 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by TradeForge, Today, 02:09 AM
                              1 response
                              22 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by elirion, Today, 01:36 AM
                              2 responses
                              14 views
                              0 likes
                              Last Post elirion
                              by elirion
                               
                              Working...
                              X