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, 10:50 PM
                      0 responses
                      2 views
                      0 likes
                      Last Post smartromain  
                      Started by popecapllc, 08-09-2023, 07:42 PM
                      10 responses
                      1,366 views
                      0 likes
                      Last Post BartMan
                      by BartMan
                       
                      Started by jbays87, Today, 09:46 PM
                      0 responses
                      6 views
                      0 likes
                      Last Post jbays87
                      by jbays87
                       
                      Started by ETFVoyageur, 04-30-2024, 02:04 PM
                      11 responses
                      101 views
                      0 likes
                      Last Post ETFVoyageur  
                      Started by bubblegum, 03-18-2024, 10:41 AM
                      3 responses
                      48 views
                      0 likes
                      Last Post vjsworld  
                      Working...
                      X