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

Selecting colors dots, triangles and arrows in indicators

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

    Selecting colors dots, triangles and arrows in indicators

    Hello

    I am writing my first indicator, a very simple one. It is already running ok, but I would like to improve it and, when I put it in my chart, to be able to select the color of the objects that draws in, not just the one selected in the code.

    Thanks

    #2
    Hello Impeesa, thanks for your question.

    All of our drawing methods have an override that takes a templateName property. So you can draw the object you want, set up the drawing object manually on a chart then save it as a template. Use that template name in the method override and it will use all of the settings you have in the Template. e.g. If I set up a template named "MyTemplate":

    Code:
    Draw.Dot(NinjaScriptBase owner, string tag, bool isAutoScale, DateTime time, double y, bool isGlobal, string templateName)
    Draw.Dot(this, "MyDot", false, MyTime, MyYValue, false, "MyTemplate");
    Please let me know if I can assist any further.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Hello, Chris

      I have not programmation skills and all I can do is analyse indicator examples and copy and paste parts of the code and run them, again and again...

      Can you remember a free stuff indicator in Ninjatrader Ecosystem that I can use as example?

      Thanks

      Comment


        #4
        Hello Impeesa,

        You can use the Strategy Builder to have it generate syntax for drawing objects.

        Strategy Builder 301 (publicly available recording) - https://www.youtube.com/watch?v=HCyt90GAs9k

        Drawing On a Chart - https://ninjatrader.com/support/help...ToDrawOnAChart

        You can then copy the generated drawing code in an indicator that has Brush inputs added from a New Indicator Wizard. Then replace the Brush in the Draw method (Brushes.Green for example) with the Brush property you created with the wizard.

        New Indicator Wizard - https://ninjatrader.com/support/help...?ns_wizard.htm

        We look forward to assisting.
        JimNinjaTrader Customer Service

        Comment


          #5
          Hello Jim

          In New Indicator Wizard there are only Plot style, nor triangles, diamond and arrow objects. What I want is to be able to select the colors of this objects whan I open the indicator in a chart, as I can do in others. Click image for larger version

Name:	02_07_2020_1351.jpg
Views:	305
Size:	38.3 KB
ID:	1107690Click image for larger version

Name:	02_07_2020_1352.jpg
Views:	292
Size:	36.0 KB
ID:	1107691

          Comment


            #6
            Hello Impeesa,

            The New Indicator Wizard allows for creating Brush inputs. I have attached some screenshots.

            You would then use the Brush inputs to control the Brush used with the Draw method.

            I.E.:

            Draw.Dot(this, "tag1", true, 0, Low[0] - TickSize, Brushes.Red);

            would by replaced with your Brush input. In the case of the attached screenshots, this would be "MyBrush"

            You can use the Strategy Builder to generate syntax for using Drawing methods and you can implement those in an indicator after you observe how the Strategy Builder generates the code.

            We look forward to assisting.
            Attached Files
            JimNinjaTrader Customer Service

            Comment


              #7
              Great! Thanks a lot!

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Waxavi, Today, 02:10 AM
              0 responses
              3 views
              0 likes
              Last Post Waxavi
              by Waxavi
               
              Started by TradeForge, Today, 02:09 AM
              0 responses
              9 views
              0 likes
              Last Post TradeForge  
              Started by Waxavi, Today, 02:00 AM
              0 responses
              2 views
              0 likes
              Last Post Waxavi
              by Waxavi
               
              Started by elirion, Today, 01:36 AM
              0 responses
              4 views
              0 likes
              Last Post elirion
              by elirion
               
              Started by gentlebenthebear, Today, 01:30 AM
              0 responses
              4 views
              0 likes
              Last Post gentlebenthebear  
              Working...
              X