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

Background color (backBrush) of future bar

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

    Background color (backBrush) of future bar

    Can you change the color of the backbrush of a future bar as such. I would like to use the back brush as a signal on a future bar.

    PHP Code:
    BackBrushes[-1] = backBrush

    #2
    Hello cutzpr,

    There is no ability to affect future bars, are you trying to color the building bar?
    JesseNinjaTrader Customer Service

    Comment


      #3
      No not the building bar, but future bar. I assumed it could but it makes sense since the bar isnt created yet. But cant you draw objects at locations where future bars can be located useing -1?

      Comment


        #4
        Hello cutzpr,

        Drawing objects use slots in the chart which is a little different of a concept so technically those can draw to a certain extent into the future although that is not supported in NinjaScript and has issues with rendering in certain use cases. In general there is no ability to reference future bars because they have not been processed yet. All scripts are intended to process bars as they come in and reference bars in the past that are available at the time of processing.

        JesseNinjaTrader Customer Service

        Comment


          #5
          Could you give me an example where I could use a draw.region to mimic that of drawing a backbrush in of a future bar.

          Comment


            #6
            Hello cutzpr,

            No there is no support for drawing into the future with NinjaScript, you can with some objects technically use negative bars ago but that can also cause problems. I wouldn't be able to assist with that type of logic. If you want to draw into the future with a drawing object you can use a Ray which does a rendering projection with the chart coordinates rather than using bars. That renders to the edge of the chart so if you scroll ahead its still visible. In that use case you would use 1 bars ago as the start anchor and 0 bars ago as the end anchor to point the ray to the right.

            JesseNinjaTrader Customer Service

            Comment


              #7
              So after some test, I noticed that if paint a future backbrush with an index in the future
              PHP Code:
              BackBrushes[-1] = backBrush
              , eventually when I get to that bar, the background is painted once that bar actually completes. Which works well for testing atleast. Could you please confirm that what I am seeing is correct?

              Comment


                #8
                Hello cutzpr,

                As mentioned there is no support for using negative bars ago in NinjaScript so that is not something I could confirm. We don't have any guidelines on that topic and that is known to produce problems by using the barsago field in unsupported ways.
                JesseNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by rt61968, 02-17-2018, 05:24 PM
                3 responses
                2,733 views
                0 likes
                Last Post MasterEtrad3  
                Started by nuobo, Today, 07:43 PM
                0 responses
                1 view
                0 likes
                Last Post nuobo
                by nuobo
                 
                Started by ETFVoyageur, Today, 02:04 PM
                3 responses
                21 views
                0 likes
                Last Post ETFVoyageur  
                Started by cre8able, Today, 06:18 PM
                0 responses
                6 views
                0 likes
                Last Post cre8able  
                Started by ETFVoyageur, Today, 06:05 PM
                0 responses
                7 views
                0 likes
                Last Post ETFVoyageur  
                Working...
                X