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

Using the Strategy Builder is there a way of setting Indicator Line attributes?

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

    Using the Strategy Builder is there a way of setting Indicator Line attributes?

    Hi,

    I use the Strategy for as much as possible and do have to make some final locked changes to paint the background when long and short for example.

    I'm having two problems. When I load the strategy I have to change all the indicator line styles, width's colors by hand for each chart.

    That would not be as big an issue but when I save what I thought would be a template for the chart with the Strategy and the modified indicators it did not behave as I thought it would.

    How can I save a chart template with a Strategy loaded as when a new chart is created using New Duplicate, New chart or a NT restart the strategy is always gone.

    Any suggestions on who to come as close to have the strategies with my modified indicators in tact as I have 30 charts and it's taking me a long time to rebuilding these charts.

    Thank you,

    glen




    #2
    Hello glen,

    Plot colors in an indicator can be set with strategy builder. Line colors, line width, etc, cannot. But these can be set from an unlocked script.

    Are you referring to lines with AddLine() or lines drawn with Draw.Line()?

    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea,


      I'm referring to the standard NT Indicators SMA< EMA etc.

      I was looking for where that was done but don't see those those functions in the code.


      I see the variables being defined , the class created, the Brush methods invoked and the indicator added to the chart AddChartIndicator(EMA1)


      But no idea where those attributes are set.

      What happening is have 30 charts, with the same strategy loaded, The default colors attributes are all wrong so I load up a Unirenko chart with no indicators.

      Then load the strategy.

      Then spend a few minutes on each chart changing the colors, attributes, resizing all the non price indicators trying to save whatever I can in a template but nothing is getting saved.

      Then for a variety of reason the strategy gets deleted from the chart, a restart of NT , a symbol change, an manual order placed or closed but within a short period of time I have to redo the process over and over again. I save workspaces, indicator templates, strategy templates chart templates and starting from scratch each time.
      i
      I would like a workspace with one strategy loaded into each chart and the attributes of all the indicators when are invoked in the strategy, no indicator is put on outside of the strategy.

      I was supposed to start trading this strategy live tomorrow on 4 markets and have tested it running the rules manually every day for months and ready to try it on live markets.

      Today to get setup I have all the rules coded in the strategy and at this point I'm painting the background to indicate a short or long and send the buy/sell order to a sim account for awhile before fully automating. But really need to see those strategy generated colors in each chart because it very short term trading on fast moving markets.

      Can you please suggest how I can get setup properly with as many templates as I can and also find a way keep the strategy loaded. There will be times when I have to manually put an order in a live strategy chart window and would like to have as stable an environment as possible.

      Thank you.

      glen

      Comment


        #4
        Hello glen,

        In the Conditions & Actions page, in the Condition Builder, where you have selected SMA, check the box for 'Plot on chart', then set the color for the plot.

        Below is a link to the Strategy Builder 301 training video which demonstrates setting the color for a plot.
        NinjaTrader's Strategy Builder empowers traders of all levels with point-and-click automated trading strategy development. Create your own advanced automated...



        Unfortunately, the Strategy Builder does not allow for creating a Brush input. This would require unlocking code and coding by hand.



        If you want to change the background color behind the bar when a condition is true, in the Strategy Builder in the actions window ('Do the following' section) select Drawing -> Set background color. (This is shown in the Strategy Builder 301 video as well)


        To save a Strategy Template, so input values are preset when adding a new instance of a strategy, in the Strategies window set the values, then in the bottom right click template -> save -> name the template Default (if you want this selected by default) -> click Save.




        Manual orders will not be seen by the strategy. These will not affect the strategy position or performance.

        In an unlocked script, you can have a strategy add buttons, and use buttons to trigger the strategy to place order, so that the order affects the strategy position. This would not be possible using the Strategy Builder, and the script must be coded by hand.
        I need some guidance. I need to create a script that has 3 plots that are public and they plot either a 1 or 0. But I need to create another indicator that has 3 chart buttons that sets these variables. The first indicator needs to get those values from the second indicator depending on the button clicks. Because of using
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi Chelsea,


          Thanks very much for the response.

          Understood I set the colors in the manner you described. My problem is on the higher resolution monitor the default width of 1 is barely visible how can I change the non color properties?

          Also understood and do set the background when the long conditions are met to paint the background.

          I wanted to set the background color for every bar conditionally when long or short and your response indicates creating another Set to check for that condition, thank you for reminding me I could define a separate set for such a function. Apologies I didn't think of it at the time and it's a great suggestion.

          I'm ok with saving strategy templates it is helpful as you suggest. I was asking how I could avoid having to manually enable and frequently manually reloading a strategy within a chart?

          I was having an issue using chart trader with a strategy loaded where the strategy on the chart seemed to drop off or maybe it was disabled I will verify that when I closed a position.

          So I though as in other platforms that the strategy would be cognizant of orders placed manually, that would be a useful options to have.

          Thank you.

          glen

          Comment


            #6
            Hello glen,

            To confirm you want to change the width of a plot?

            This can be done in an unlocked script. This cannot be done in the Strategy Builder.

            MyIndicator.Plots[0].Width = 2;

            Below is a link to the help guide on Plots.



            Where you have mentioned:
            "I was asking how I could avoid having to manually enable and frequently manually reloading a strategy within a chart?"

            Strategies must be manually enabled. This is by design. The user must consciously decide to turn the strategy on and have it start trading.

            You can design an addon, or indicator using the addon approach to have a script that does not have to be enabled.


            As for reloading, why are you reloading? Is there an issue you are trying to resolve?


            You must design the strategy to have buttons and place orders through the strategy.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hi Chelsea,

              Width=2, awesome thank you very much that will save me a ton of manual tweaking.

              Ok that is the design to enable it each time, that's fine wasn't sure what was happening there.

              I am trying to avoid reloading the strategies. I have 10 charts setup with strategies and all the indicators setup correctly and I rebooted for another issue but had the workspaces saved and all the strategies are no longer loaded on the chart? Is it something I am doing. If you load and enable ten strategies in a chart and save the workspace and restart are those 10 strategies loaded in the charts?


              I will look for some button examples thank you for the help.

              glen
              Last edited by demarcog; 03-01-2021, 10:21 PM.

              Comment


                #8
                Hi Chelsea,

                Does this syntax look correct as it didn't change the width on the lines.
                the code contained:
                EMA1.Plots[0].Brush = Brushes.Crimson;

                And I added this line
                EMA1.Plots[0].Width = 4;


                Unfortunately I spent the last 10 years developing in javascript on a platform where autotrading has been in "beta" for 8 years when I should have been writing in csharp.

                Is there a recommended series of courses? I was in IT for years and started writing a lot of IBM Assembler and written in Python and a few other languages but would never dignify anything I've done worthy of being written by a "developer".

                Thank you

                glen

                Comment


                  #9
                  Hello glen,

                  This is Jim, responding on behalf of Chelsea who is out of the office at this time.

                  Please see the attached strategy which adds an EMA and changes the plot width.

                  Publicly available resources on C# can be found externally to NinjaTrader. Some publicly available resources can be found below. You may also find additional resources as well as online courses with further research.

                  C# Tutorial - C# is a simple, modern, general-purpose, object-oriented programming language developed by Microsoft within its .NET initiative led by Anders Hejlsberg. This C# tutorial will teach you basic C# programming and will also take you through various advanced concepts related to C# programming language.


                  Master the fundamentals of C# and unlock its potential for creating web applications, desktop software, mobile games, and more. This beginner-friendly C# tutorial guide covers syntax, object-oriented programming, and essential tools, empowering you to build efficient and scalable solutions.


                  We look forward to assisting.
                  Attached Files
                  JimNinjaTrader Customer Service

                  Comment


                    #10
                    Hi Jim,

                    Thank you very much for providing that code I appreciate it., that very helpful indeed.

                    Strange as that's what I had coded the only difference was the sequence of of I changed the width after changing the color as you sequence was the opposite which I don't think matters.

                    My apologies to you guys as it was really late after a long day and I'm new to csharp and screwed it up somehow, thanks again.

                    Also appreciate the course references.

                    glen

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by kujista, Today, 05:44 AM
                    0 responses
                    5 views
                    0 likes
                    Last Post kujista
                    by kujista
                     
                    Started by ZenCortexCLICK, Today, 04:58 AM
                    0 responses
                    5 views
                    0 likes
                    Last Post ZenCortexCLICK  
                    Started by sidlercom80, 10-28-2023, 08:49 AM
                    172 responses
                    2,281 views
                    0 likes
                    Last Post sidlercom80  
                    Started by Irukandji, Yesterday, 02:53 AM
                    2 responses
                    18 views
                    0 likes
                    Last Post Irukandji  
                    Started by adeelshahzad, Today, 03:54 AM
                    0 responses
                    8 views
                    0 likes
                    Last Post adeelshahzad  
                    Working...
                    X