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 rbeckmann05, Yesterday, 06:48 PM
          1 response
          12 views
          0 likes
          Last Post bltdavid  
          Started by llanqui, Today, 03:53 AM
          0 responses
          6 views
          0 likes
          Last Post llanqui
          by llanqui
           
          Started by burtoninlondon, Today, 12:38 AM
          0 responses
          10 views
          0 likes
          Last Post burtoninlondon  
          Started by AaronKoRn, Yesterday, 09:49 PM
          0 responses
          15 views
          0 likes
          Last Post AaronKoRn  
          Started by carnitron, Yesterday, 08:42 PM
          0 responses
          11 views
          0 likes
          Last Post carnitron  
          Working...
          X