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

Color a region between two lines in a strategy

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

    Color a region between two lines in a strategy

    Hello,

    I want to color a region between two lines in a strategy, any idea how to make it work?

    Regards,

    Kalle

    #2
    Please use DrawRegion().
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Josh,

      that's what I did, but it had no effect. I think I'm doing something wrong:


      OnBarUpdate()
      ...

      DrawRegion("test", CurrentBar, 0, StrategyPlot(4), StrategyPlot(5), Color.Black, Color.Blue, 2);

      The strategy has 10 plots in total and they work perfectly.

      Comment


        #4
        Kalle,

        Please try without StrategyPlot and just do Close price to some value. See if that works.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          I simply pasted the following line of code from the NinjaTrader help section to the strategy @ OnBarUpdate():

          DrawRegion("tag1", CurrentBar, 0, Bollinger(2, 14).Upper, Bollinger(2, 14).Lower, Color.Empty, Color.Lime, 2);

          It does not work either. The chart disappears (blank), but the data window still shows values. Does DrawRegion work with strategies?

          Comment


            #6
            Kalle, please check the attached file - does this work properly for you?
            Attached Files
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Yes, it works fine.

              But if I paste your strategy code into my own strategy and deactivate my DrawRegion command, the result still remains the same. It does not work. I get a blank chart window, nothing else.

              Does it have to do with the fact I am using StrategyPlot() for the line plots?

              Thanks for your help!

              Comment


                #8
                Kalle,

                Please post a screenshot of what you are seeing along with simple as possible code. Strip it down completely. Thank you.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by NinjaTrader_Bertrand View Post
                  Kalle, please check the attached file - does this work properly for you?
                  Bertrand ,
                  Is this something that could be converted to an indicator and plotted on a
                  chart ? Wouldn't mind coloring the area between to EMA's .

                  Comment


                    #10
                    Originally posted by T2020 View Post
                    Bertrand ,
                    Is this something that could be converted to an indicator and plotted on a
                    chart ? Wouldn't mind coloring the area between to EMA's .
                    Have you tried this?

                    Comment


                      #11
                      Originally posted by roonius View Post
                      Thanks roonius ! That's exactly what I was looking for !

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by smartromain, Today, 02:52 AM
                      0 responses
                      10 views
                      0 likes
                      Last Post smartromain  
                      Started by Marklhc1988, 04-19-2023, 11:11 AM
                      12 responses
                      573 views
                      1 like
                      Last Post victor68133  
                      Started by nicthe, Yesterday, 02:58 PM
                      1 response
                      10 views
                      0 likes
                      Last Post nicthe
                      by nicthe
                       
                      Started by percy3687, 05-17-2024, 12:28 AM
                      3 responses
                      31 views
                      0 likes
                      Last Post percy3687  
                      Started by SilverSurfer1, Yesterday, 01:33 PM
                      0 responses
                      14 views
                      0 likes
                      Last Post SilverSurfer1  
                      Working...
                      X