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

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 jaybedreamin, Today, 05:56 PM
          0 responses
          3 views
          0 likes
          Last Post jaybedreamin  
          Started by DJ888, 04-16-2024, 06:09 PM
          6 responses
          18 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by Jon17, Today, 04:33 PM
          0 responses
          1 view
          0 likes
          Last Post Jon17
          by Jon17
           
          Started by Javierw.ok, Today, 04:12 PM
          0 responses
          6 views
          0 likes
          Last Post Javierw.ok  
          Started by timmbbo, Today, 08:59 AM
          2 responses
          10 views
          0 likes
          Last Post bltdavid  
          Working...
          X