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 strategist007, Today, 07:51 PM
          0 responses
          2 views
          0 likes
          Last Post strategist007  
          Started by StockTrader88, 03-06-2021, 08:58 AM
          44 responses
          3,967 views
          3 likes
          Last Post jhudas88  
          Started by rbeckmann05, Today, 06:48 PM
          0 responses
          4 views
          0 likes
          Last Post rbeckmann05  
          Started by rhyminkevin, Today, 04:58 PM
          4 responses
          55 views
          0 likes
          Last Post dp8282
          by dp8282
           
          Started by iceman2018, Today, 05:07 PM
          0 responses
          6 views
          0 likes
          Last Post iceman2018  
          Working...
          X