Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Change single bar color

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

    Change single bar color

    Hi,

    I'm trying to make an indicator to change the color of a single bar when I get a long/short signal. Anyone know how I can go about doing that?

    This is how it currently looks like:

    if (long signal)
    {
    BarColor = Color.Gold;
    }


    else if (short signal)
    {
    BarColor = Color.Silver;
    }

    My programming knowledge is very limited (to a few hours from How to's on youtube).

    - Stoop

    #2
    Stoop,

    This looks ok here, i.e. it appears it would work.

    http://www.ninjatrader.com/support/h...l?barcolor.htm
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Hi,
      Thanks for your reply, I figured out what was wrong. I had an indicator using ATR(20) and realised it wouldn't show anything because I was missing:
      if (CurrentBar < 21)
      return;

      Anyways, I have another question I was hoping you could help me with. I have tried searching around for it but can't seem to find an answer. When I run my indicator it doesn't use the latest bar, even though it's closed. Or rather, it doesn't draw my indicator all the way to the latest bar. I tried looking at the standard DonchianChannel Indicator but the same thing happens to that one as well.
      The only option I have found is to use Displacement = 1, but that doesn't really help.

      Do you have an idea on how I can fix that?

      Comment


        #4
        Stoop,

        Unfortunately I would need to see more code here. Could you post the problem section of your code?
        Adam P.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by Stoop View Post
          Hi,
          Thanks for your reply, I figured out what was wrong. I had an indicator using ATR(20) and realised it wouldn't show anything because I was missing:
          if (CurrentBar < 21)
          return;

          Anyways, I have another question I was hoping you could help me with. I have tried searching around for it but can't seem to find an answer. When I run my indicator it doesn't use the latest bar, even though it's closed. Or rather, it doesn't draw my indicator all the way to the latest bar. I tried looking at the standard DonchianChannel Indicator but the same thing happens to that one as well.
          The only option I have found is to use Displacement = 1, but that doesn't really help.

          Do you have an idea on how I can fix that?
          If you want an indicator to plot on the current bar as it is developing, you have to set CalculateOnBarClose to "false".

          Comment


            #6
            It was just the CalculateOnBarClose that had to be set to false. I guess I just didn't think about that because I thought the bars were done developing.

            Thanks a lot to the both of you!

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by kazisl, Today, 06:41 PM
            0 responses
            2 views
            0 likes
            Last Post kazisl
            by kazisl
             
            Started by einstein, Today, 06:20 PM
            0 responses
            2 views
            0 likes
            Last Post einstein  
            Started by op1031, Today, 05:51 PM
            0 responses
            3 views
            0 likes
            Last Post op1031
            by op1031
             
            Started by nighttrader99, Today, 04:34 PM
            1 response
            8 views
            0 likes
            Last Post NinjaTrader_ShawnB  
            Started by Simon Investimens, Today, 02:51 PM
            1 response
            15 views
            0 likes
            Last Post NinjaTrader_ChrisL  
            Working...
            X