Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Change chart panel back color and bar color for a previous bar.

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

    Change chart panel back color and bar color for a previous bar.

    I can't find a way to change the chart panel color for a previous bar on a custom indicator I developed. I know the Backcolor = Color.Salmon; command changes the color of the current bar to Salmon but is there a way to do this for a previous bar?

    Similarly is there a way to change the colour of a previous bar on the chart panel. I know the Barcolor =Color.Salmon can only change the color of the current bar.

    Appreciate any help.

    #2
    Hello,

    Please go here:


    ...and copy and paste in the example section.
    DenNinjaTrader Customer Service

    Comment


      #3
      I looked at the link posted. I guess that means that it's not possible to change for a previous bar then, only possible for the current bar? Actually what I want to do is to make known visibly in a chart, the previous bar selected by the NinjaTrader Swing().SwingHigh() function. Is there a way to do this?

      Comment


        #4
        Hello,

        The swing indicator won't work for this very well. Its values change retroactively. It takes a bit more programming to make that work.
        DenNinjaTrader Customer Service

        Comment


          #5
          How to backcolor of the previous bar in a strategy

          Hi!
          I want to backcolor the previous bar in a strategy.

          Code:
          if (true)
            {
                 set the backcolor of the previous bar to lime green
            }
          How can I do this?

          Since there isn't any bars_ago option in the Backcolor property, I'v tried to use the DrawRegion() method, But it don't woks the way I hoped.
          Code:
          _zero.Set(0);
          
          if (true)
             {
                  DrawRegion("Mytag" + CurrentBar, CurrentBar-1, CurrentBar, _zero, 100000, Color.Empty, Color.Lime, 1);
             }
          (This doesn't paint at all and there is no error message.)

          Do you have any suggestion how I can backcolor the previous bar?
          Last edited by poseidon_sthlm; 03-09-2010, 08:03 AM.

          Comment


            #6
            Have you tried something like this snippet below?

            Code:
             
            if (CurrentBar < 1) return;
             
            DrawRegion("Region1", 1, 0, Low, High[1], Color.Black, Color.Blue, 5);
            Correct is the BackColor call is for the current bar only, so this might provide a workaround.

            For an unsupported method you could check into the CandleStickPattern indicator and how it visualizes the found patterns.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by CarlTrading, 03-31-2026, 09:41 PM
            1 response
            152 views
            1 like
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            89 views
            1 like
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            131 views
            2 likes
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            127 views
            1 like
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            107 views
            0 likes
            Last Post CarlTrading  
            Working...
            X