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

Backtesting indicator (how to avoid render/plot bars)

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

    Backtesting indicator (how to avoid render/plot bars)

    Hello,

    I have an indicator and I want to add a feature where I can backtest using a static chart (no market replay) and historical data.
    The first goal is to avoid render/plot some bars to analyze to scenario without seeing what was happened.
    How can I achieve it?
    I've already tried to "hide" the bars (changing the color to transparent) in the OnBarUpdate method but when I use the "Fixed scale" (button "F" up in the right corner) I can see if the price was gone up or down because the chart auto scale also the hidden bars. So, I would remove or avoid rendering these bars.

    Thanks.
    Regards,

    #2
    Hello Giorgetto,

    Thank you for your post.

    An indicator would not be able to keep bars from being rendered - which bars are rendered on the chart are dependent on either the bar type or the trading hours template. Are you trying to exclude specific time periods from the chart? It may be simplest to create a custom trading hours template that only includes the periods you would like the indicator applied to, then apply that to the chart prior to adding the indicator. If not, could you be more specific about what bars you're wanting to avoid actually rendering on the chart?

    Thanks in advance; I look forward to assisting you further.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Hello,

      yes, I want to avoid rendering from a specific time, (9AM for example) but only for the last trading day.
      The idea is enable this feature in the indicator (maybe using a button in the chart menu) and later choose the day I want to backtest changing the "End Date" in Data Series properties.
      So, the result should show me all historical data until 9AM (last day in the chart).

      Comment


        #4
        Hello Giorgetto,

        Thank you for your reply.

        I'm still not quite clear on this. So you're saying you want the indicator to plot only up to a specific time but only on the last day of the chart, is that correct?

        As far as I understand it, in this case it may be simplest to use the playback connection with historical data. That way, you can play the day in question up until your selected time, then apply the indicator to the chart and only see it up to that point.

        Here's a link to our help guide that goes over the playback connection:


        Please let us know if we may be of further assistance to you.
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Yes, you've understood correctly. But I don't want to use the market replay for many reasons, like I want backtest years ago, etc.
          If it's not possible achieve it, is it possible at least deactivate the "Fixed scale" (button "F" up in the right corner) via code?
          With deactivate I means that I want to see the button, so, the "Fixed scale" not enabled.

          Thanks.

          Comment


            #6
            Hello Giorgetto,

            Thank you for your reply.

            Changing chartScale properties via code (ie. switching to automatic scaling from fixed) is not documented in the help guide and is not supported by NinjaTrader Support to do.

            You may be able to restrict the indicator's processing using time conditions within the indicator - the tricky part is for it to always cease at a specific time on the last day only. I'll work on this a bit and see if I can come up with a simple example.

            Thanks in advance; I look forward to assisting you further.
            Kate W.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Segwin, 05-07-2018, 02:15 PM
            14 responses
            1,788 views
            0 likes
            Last Post aligator  
            Started by Jimmyk, 01-26-2018, 05:19 AM
            6 responses
            837 views
            0 likes
            Last Post emuns
            by emuns
             
            Started by jxs_xrj, 01-12-2020, 09:49 AM
            6 responses
            3,292 views
            1 like
            Last Post jgualdronc  
            Started by Touch-Ups, Today, 10:36 AM
            0 responses
            12 views
            0 likes
            Last Post Touch-Ups  
            Started by geddyisodin, 04-25-2024, 05:20 AM
            11 responses
            62 views
            0 likes
            Last Post halgo_boulder  
            Working...
            X