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 klaxtoncapital, Today, 12:31 PM
        0 responses
        4 views
        0 likes
        Last Post klaxtoncapital  
        Started by PatutLee, Today, 11:59 AM
        0 responses
        3 views
        0 likes
        Last Post PatutLee  
        Started by tradingnasdaqprueba, Today, 11:55 AM
        0 responses
        4 views
        0 likes
        Last Post tradingnasdaqprueba  
        Started by Taddypole, Today, 11:33 AM
        0 responses
        18 views
        0 likes
        Last Post Taddypole  
        Started by antoniocruz1962, Today, 08:42 AM
        2 responses
        9 views
        0 likes
        Last Post antoniocruz1962  
        Working...
        X