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 appreciated by a newbie

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

    Help appreciated by a newbie

    I have a simple script I would like to import into Ninja 6.5 that would paint the bars different colors based on whether price were completely above, completely below or intersecting a moving average line. Here is my best attempt at the code:

    if (High[0] < SMA(25)[0]) Bar Color = Color.Red;
    if (Low[0] > SMA(25)[0]) Bar Color = Color.Green;
    if (High[0] >= SMA(25)[0] && Low[0] <= SMA(25)[0]) Bar Color = Color.Black;


    I would appreciate it if someone could check over the code and tell me what to do next so I can import this into Ninja, or provide me with an import file. Thanks so much.

    #2
    Sorry, I don't follow. Please create a new indicator in Tools->New NinjaScript->Indicator, edit this indicator, compile it and you are ready to go. No need to import anything.

    The help guide holds tutorials on how to create indicators from scratch.

    Comment


      #3
      Cannot find New NinjaScript

      Please forgive my ignorance, but there are only 4 items under Control Center Tools. They are Instrument Manager, Historical Data, Account Connections, and Options. I cannot find New Ninja Script there or anywhere else.

      Comment


        #4
        You likely are on a free NinjaTrader Direct license which does not support NinjaScript. If you want to trade and use/edit NinjaScript you would to purchase a regular license.

        Comment


          #5
          Problems still

          Thank you for pointing this out. I upgraded and was able to find the new NinjaScript item. I followed the wizard directions and inserted the code I posted earlier. I got this from reading some of the documentation examples. I get 3 compile errors, one for each line saying that a ";" is expected. Could you please look at the code and tell me what to do now. I never had problems like this with EasyLanguage or with writing QuoteTracker paintbars. My logic is simple and straight forward. I want to paint the bars one of 3 different colours based on the relationship of the closing price to a moving average. Thank you.

          Comment


            #6
            If you are referring to the code in your original post, that looks fine. Using NinjaScript assumes some level of C# programming understanding. The error that you come across falls into this category.

            Here is a tip we wrote up to help debug your code - http://www.ninjatrader-support.com/v...ead.php?t=3418
            RayNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by AaronKoRn, Today, 09:49 PM
            0 responses
            6 views
            0 likes
            Last Post AaronKoRn  
            Started by carnitron, Today, 08:42 PM
            0 responses
            9 views
            0 likes
            Last Post carnitron  
            Started by strategist007, Today, 07:51 PM
            0 responses
            10 views
            0 likes
            Last Post strategist007  
            Started by StockTrader88, 03-06-2021, 08:58 AM
            44 responses
            3,976 views
            3 likes
            Last Post jhudas88  
            Started by rbeckmann05, Today, 06:48 PM
            0 responses
            9 views
            0 likes
            Last Post rbeckmann05  
            Working...
            X