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 rhyminkevin, Today, 04:58 PM
        3 responses
        47 views
        0 likes
        Last Post Anfedport  
        Started by iceman2018, Today, 05:07 PM
        0 responses
        5 views
        0 likes
        Last Post iceman2018  
        Started by lightsun47, Today, 03:51 PM
        0 responses
        7 views
        0 likes
        Last Post lightsun47  
        Started by 00nevest, Today, 02:27 PM
        1 response
        14 views
        0 likes
        Last Post 00nevest  
        Started by futtrader, 04-21-2024, 01:50 AM
        4 responses
        50 views
        0 likes
        Last Post futtrader  
        Working...
        X