Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Changing Background color in an Automated Trading System

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

    Changing Background color in an Automated Trading System

    Hello All,

    Building a Strategy that when a set of conditions are met. The Background color of the chart will change buy(green) sell (red). I am setting the command to change color in "do the following" backcolor=color.red..etc but it does not work.. what am I missing here... need your help.

    #2
    Hi traderfolife777,

    Thanks for your note.

    Are you creating this strategy with custom code or with the Strategy Wizard?

    May I see the code in your strategy?

    To export your script do the following:
    • Click File -> Utilities -> Export NinjaScript
    • Enter a unique name for the file in the value for 'File name:'
    • Select the strategy from the objects list on the left -> click the right facing arrow ">" to add the strategy to the export
    • Click the 'Export' button -> click 'yes' to add any referenced indicators to the export -> click OK to clear the export location message


    By default your exported file will be in the following location:
    • (My) Documents/NinjaTrader 7/bin/Custom/ExportNinjaScript/<export_file_name.zip>


    Below is a link to the help guide on Exporting NinjaScripts.
    http://www.ninjatrader.com/support/h...nt7/export.htm
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello,
      Thank you for your prompt response.

      I am using Strategy Wizard right now. I exported the script but how do I get you to view it.
      In the "do the following tab" in strategy wizard I simply have backcolor=color.red and for condition i have low[1]>EMA(34)[0]..

      Let me know what you think.

      Regards,
      George

      Comment


        #4
        Hi George,

        In your next post, click the paperclip icon -> click the Choose file button -> select the file -> click Open -> click Upload -> click Close this window.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Re:File attached-Background color change.

          Hello,

          I attached the file. Also, Do you know a fast method for someone to learn Ninja Script without spending years learning C#:....

          Thank you for your help,

          Let me know your thoughts on this.

          Regards,
          George
          Attached Files

          Comment


            #6
            Hi George,

            This file was exported as a compiled assembly. (Meaning the Export compiled assembly of selected source files was selected when you exported).

            Because of this, I will not be able to look at the code you have written.

            Please export this with selecting this option (leave the first option selected).

            Also, an understanding of C# will make you the most proficient NinjaScript coder as NinjaScript is C# with some pre-made classes, methods, and updated variables available for you to use.

            Below are links to a few resources that may assist.

            https://www.bigmiketrading.com/ninja...-strategy.html

            http://www.dotnetperls.com/

            http://www.manzoorthetrainer.com/

            The best way to begin learning NinjaScript is to use the Strategy Wizard. With the Strategy Wizard you can setup conditions and variables and then see the generated code in the NinjaScript Editor by clicking the View Code button.

            I'm also proving a link to a recently recorded 'Automated Strategy Development Webinar' video for you to view at your own convenience: Automated Strategy Development Level 1 - NinjaTrader Training - 3/26/2013

            We also have great resources in relation to Strategy Development on our Support Forum. There is a very active developer community in our support forum that supplements the responses provided by NinjaTrader support staff providing all users with an exceptional support experience.
            Take me to your support forum!

            There are a few Sample Automated Strategies which come pre-configured in NinjaTrader that you can use as a starting point. These are found under Tools--> Edit NinjaScript--> Strategy. You will see locked strategies where you can see the details of the code, but you will not be able to edit (you can though always create copies you can later edit via right click > Save as)

            We also have some Reference samples online as well as ‘Tips and Tricks’ for both indicators and strategies:
            Click here to see our NinjaScript Reference Samples
            Click here to see our NinjaScript Tips

            These samples can be downloaded, installed and modified from NinjaTrader and hopefully serve as a good base for your custom works.

            Further, the following link is to our help guide with an alphabetical reference list to all supported methods, properties, and objects that are used in NinjaScript.
            Alphabetical Reference

            We also have a few tutorials in our help guide for both Indicators and Strategies.
            Indicator tutorials
            Strategy tutorials

            Last, if you would like to have this strategy coded for you, you may contact one of our professional NinjaScript consultants.
            Click here to see our Consultants page

            Please let me know if I can be of further assistance.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              File attached-code

              Hello,

              The information you included is very helpful and will use it. I sent you the file attached.

              Let me know what you think.

              Regards,
              George
              Attached Files

              Comment


                #8
                Hello George,

                I have tested your strategy and found that it is coloring the background.

                What is the issue you are experiencing?
                Attached Files
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  I activate the strategy in the strategy panel and does not work. what can be the issue with this.

                  Comment


                    #10
                    Hi George,

                    Have you enabled the strategy?

                    (Right-click the chart -> select Strategies... -> select the strategy instance -> on the right change the value for Enabled to True -> click OK)
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      Enabling a strategy

                      I have a good experience with the strategy wizard and have built and enabled 7 running strategies so far. not sure why I am not seeing what you are seeing. I will try starting a fresh chart and running the strategy on that chart. and see if that works.

                      Any Ideas.

                      Regards,
                      George

                      Comment


                        #12
                        Hi George,

                        The code you have supplied does work correctly on my end.

                        If this script is not enabling for you after you try and add the script to a blank chart, check to see if there are any error messages appearing in the Log tab of the Control Center.
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #13
                          still not Working

                          Hello Chelsea

                          Tried this on 1 minute chart in a new work space . Still Not displaying on chart. Checked the log tab..(No Errors). Also,The Strategy is enabled.I checked the setting of the Strategy. Put the min bars required for this strategy to be 50. any suggestions on why this is working on your machine and not mine. Also, If I try to activate a strategy directly from a chart by right clicking on the chart >pull down menu>Strategies. That tab is not active. Wondering if that has anything to do with this problem.

                          I have not been able to put any drawing or color on any of my charts using a strategy.

                          Regards,
                          George
                          Last edited by traderfolife777; 04-14-2014, 07:07 PM. Reason: added more info

                          Comment


                            #14
                            Hello Chelsea,

                            I figured out what went wrong here.

                            1- I have to disable chart Trader in order to run a strategy.

                            Once that is done I was able to change color of the background per my strategy criteria.

                            However, I have two question for you. What If I want to highlight just a simple zone for example, above SMA 50 and below SMA 7 (Color Red). And leave the rest of the chart white.

                            Also, How can I manually execute on a chart that I have a trend color changing strategy running.

                            Any Ideas on that.

                            By the way you are very helpful and I do appreciate this very much.

                            Regards,
                            George

                            Comment


                              #15
                              Hi George,

                              If ChartTrader is open it is not possible to add a strategy to that chart.

                              Were you adding the strategy directly to the strategies tab and enabling this? (Was it showing as enabled on this tab without showing as added to the chart?).

                              If so, adding a strategy directly to the strategies tab will not cause a chart to open. The strategy will need to be added to a chart for any visual properties to show on the chart.


                              To add a condition to check that the close price is above the SMA(50) in the strategy wizard or less than SMA(7) take a look at the attached screenshot. (Are you wanting to check if the high is greater than the SMA(50) or if the low is less than the SMA(7)?)

                              Regarding placing manual trades from a chart while this script is running on it, you would need to move this code to an indicator for that to work.
                              • To transfer the code, you will need to create a new indicator
                              • Tools -> New NinjaScript -> Indicator...
                              • Give the indicator a unique name -> click the Generate button
                              • Then view the code of your strategy by clicking the View Code button
                              • Copy all text between the brackets following 'private override void OnBarUpdate() { <copy this text> }'
                              • Paste the test inbetween the same brackets in OnBarUpdate of the indicator
                              • Right-click the indicator code -> select Compile


                              After the script is compiled you can add this to a chart as an indicator.
                              Attached Files
                              Last edited by NinjaTrader_ChelseaB; 04-15-2014, 08:13 AM.
                              Chelsea B.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by RideMe, 04-07-2024, 04:54 PM
                              5 responses
                              28 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Started by f.saeidi, Today, 08:13 AM
                              1 response
                              4 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by DavidHP, Today, 07:56 AM
                              1 response
                              6 views
                              0 likes
                              Last Post NinjaTrader_Erick  
                              Started by kujista, Today, 06:23 AM
                              3 responses
                              9 views
                              0 likes
                              Last Post kujista
                              by kujista
                               
                              Started by Mindset, Yesterday, 02:04 AM
                              2 responses
                              18 views
                              0 likes
                              Last Post NinjaTrader_RyanS  
                              Working...
                              X