Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ColorBars Indicator

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

    ColorBars Indicator

    Hi,

    I have created a custom indicator which colors the bars of 1 min dataseries if a bigger DataSeries (For example 30 min) is bullish.

    But, for some reason the indicator takes into account the last bar of the previous session.

    Could you explain where is the error?

    For backtesting purposes I look into the future and use the index [-1]. But this is not the problem.

    I attach an image and the indi.

    Thanks in advanced
    Attached Files

    #2
    Hi CJS,
    I'm not sure where you feel there is an error. If you print all values in your highlighting condition, are they true?
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      The issue seems to be that the program considers the last 1 min bar of the previous sessión as a portion of the first 1 hour bar of the current session.


      I have figure out that the timestamp of the last bar of the session is 06:00. It should be 20:00.

      But, I have checked directly at 30 minutes time frame, and the timestamp of the last bar is 20:00.

      See images.

      Why is happening that?

      Please, check the code I sent before (is just 1 line of code) and you will see what i pretend to colour.

      Thanks in advanced.
      Attached Files

      Comment


        #4
        I checked your code, but don't see where you're using time stamps or bars of session. I'm not sure why you feel the last bar of the session shouldn't be evaluated true for your conditions.


        if(Closes[1][-1]>Opens[1][-1]&& Range(BarsArray[1])[-1]>SMA(Range(BarsArray[1]), 50)[-1]&& (Closes[1][-1]-Lows[1][-1])>((Highs[1][-1]-Lows[1][-1])*porcRange))
        {
        BarColor=Color.Yellow;
        }
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Ok, I got it.

          Thanks

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          581 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          338 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          103 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          554 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          552 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X