Announcement

Collapse
No announcement yet.

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 Tessan, Today, 04:35 AM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by eiketre, Today, 03:23 AM
        1 response
        15 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by joehanus, 03-11-2025, 03:41 PM
        7 responses
        50 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by trimpy, 03-11-2025, 10:21 AM
        10 responses
        51 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by HappyTrader76, 03-17-2025, 04:14 PM
        9 responses
        54 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Working...
        X