Announcement

Collapse
No announcement yet.

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 Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            574 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            333 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            101 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            553 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            551 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X