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

Tick replay on an indicator

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

    Tick replay on an indicator

    Hi, I've created an indicator, but it's only working in real time. How can I use tick replay in order to see what the indicator values have been in the past?

    Here's my code:

    HTML Code:
    protected override void OnStateChange()
            {
                if (State == State.SetDefaults)
                {
                    Description                                    = @"Enter the description for your new custom Indicator here.";
                    Name                                        = "CummulativeDelta";
                    Calculate                                    = Calculate.OnEachTick;
                    BarsRequiredToPlot                            = 1;
                    IsOverlay                                    = false;
                    DisplayInDataBox                            = true;
                    DrawOnPricePanel                            = true;
                    DrawHorizontalGridLines                        = true;
                    DrawVerticalGridLines                        = true;
                    PaintPriceMarkers                            = true;
                    ScaleJustification                            = NinjaTrader.Gui.Chart.ScaleJustification.Right;
                    //Disable this property if your indicator requires custom values that cumulate with each new market data event.
                    //See Help Guide for additional information.
                    IsSuspendedWhileInactive                    = true;
                    //AddPlot(Brushes.Blue, "CumulativeDelta");
                    AddPlot(Brushes.RoyalBlue, "CumulativeDelta");
                    AddLine(new Stroke(Brushes.Gray, DashStyleHelper.Dot ,1), 0, "ZeroLine");
                }
                else if (State == State.Configure)
                {
                }
            }
    
            protected override void OnBarUpdate()
            {
                if (Bars == null || CurrentBar == 0)
                    return;
    
                if (Bars.IsLastBarOfSession)
                {
                    cumulativeDelta = 0.0;
                    previousDelta = 0.0;
                }
    
                // indicator logic
    
                Value[0] = indicator result;
            }
        }​

    #2
    Hello speedytrade02,

    Thank you for your post.

    I suggest reviewing the help guide section about developing for tick replay here:To enable tick replay on a chart, you must first go to Control Center > Tools > Options > Market Data > check the box for "Show Tick Replay" > click OK to save the change. Then, once it has been enabled in the options, you will have an option in the Data Series window to use tick replay on a chart. For more information:Please let us know if we may be of further assistance.
    Emily C.NinjaTrader Customer Service

    Comment


      #3
      Thanks for you response. I've already activate the (Center > Tools > Options > Market Data > check the box for "Show Tick Replay") option, but I'm not getting previous values from the chart. Maybe is because I'm using BuySellVolume indicator in order to create my indicator? also which connection should I use to test my indicator?

      HTML Code:
      protected override void OnBarUpdate()
              {
                  if (Bars == null || CurrentBar == 0)
                      return;
      
                  if (Bars.IsLastBarOfSession)
                  {
                      cumulativeDelta = 0.0;
                      previousDelta = 0.0;
                  }
      
                  double currentDelta = BuySellVolume().Buys[0] - BuySellVolume().Sells[0];
                  double deltaDifference = currentDelta - previousDelta;
                  cumulativeDelta += deltaDifference;
                  previousDelta = currentDelta;
      
                  Value[0] = cumulativeDelta;
              }​

      Last edited by speedytrade02; 09-02-2023, 08:10 AM.

      Comment


        #4
        Hello speedytrade02,

        In addition to enabling the option in the options menu you also need to check the tick replay box in the data series window for the chart, did you do that?

        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by sofortune, Today, 02:31 AM
        0 responses
        6 views
        0 likes
        Last Post sofortune  
        Started by sofortune, Today, 01:55 AM
        1 response
        5 views
        0 likes
        Last Post sofortune  
        Started by cls71, Today, 01:37 AM
        0 responses
        5 views
        0 likes
        Last Post cls71
        by cls71
         
        Started by WHICKED, 06-27-2023, 12:07 PM
        63 responses
        763 views
        1 like
        Last Post Leeroy_Jenkins  
        Started by rtwave, Today, 12:10 AM
        0 responses
        5 views
        0 likes
        Last Post rtwave
        by rtwave
         
        Working...
        X