Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Simulating bracket ordering behavior not working

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

    #16
    Hi Chelsea,
    Sorry for the confusion on my part. The problematic locations in the file where tickreplay is enable are at times 12/2/2024 3:00:00 AM and 12/2/2024 5:05:00 AM. When tickreplay is enabled it fails to highlight the EMA crossovers correctly. I have uploaded new files where tickreplay is enabled and disabled with just the time and fast0/slow0 values at that time. I also included screenshots of the charts. Thanks for your help!
    Attached Files

    Comment


      #17
      Hello love2code2trade,

      I'll assist you in making an informative print that is looking for a CrossAbove().



      In the output you have provided I am seeing:

      12/2/2024 2:55:00 AM fast0/slow0: 6038.53493933264 / 6038.66907750588
      12/2/2024 3:00:00 AM fast0/slow0: 6038.52858672671 / 6038.65607154389​

      The fast on the first tick of the 2:55 bar is 6038.53 and the slow is 6038.66. On the first tick of the 3:00 bar the fast is 6038.52 and the slow is 6038.65.

      The fast was below the slow on the previous bar's first tick, the fast was below the slow on the current bar's first tick.

      This is not a crossabove or a crossbelow. The fast is lower than the slow on both bars.



      Note, when a bar is updating with Calculate.OnPriceChange/.OnEachTick barsAgo 0 would be the currently updating bar. BarsAgo 1 would be the most recently closed bar.

      When using Calculate.OnBarClose (or with TickReplay disabled in historical) barsAgo 0 would be the most recently closed bar, while BarsAgo 1 would be the bar previous.

      You might be wanting to check the previous bars and not the currently updating bar.

      If you do, the condition would appear as:

      if (_fast[1] < _slow[1] && _fast[2] > _slow[2])
      Chelsea B.NinjaTrader Customer Service

      Comment


        #18
        Hi Chelsea,
        Thanks for your reply. Should I expect the tick replay values to correlate with what NT8 builds on the chart that is shown in the data box? When I run the following code the close values are different on the chart vs what is on the print statements.

        protected override void OnStateChange() {
        if (State == State.SetDefaults) {
        //Calculate = Calculate.OnBarClose;
        Name = "MyBrac****rderTestStrategy";
        }
        else if (State == State.Configure) {
        ClearOutputWindow();

        Calculate = Calculate.OnPriceChange;
        AddDataSeries(BarsPeriodType.Tick, 1);
        }
        else if (State == State.DataLoaded) {
        _fast = EMA(10);
        _slow = EMA(25);

        _fast.Plots[0].Brush = Brushes.Green;
        _slow.Plots[0].Brush = Brushes.Blue;

        AddChartIndicator(_fast);
        AddChartIndicator(_slow);
        }
        }

        protected override void OnBarUpdate() {
        if (BarsInProgress == 0) {
        if (IsFirstTickOfBar) {
        Print($"time: {Time[0].ToString("HH:mm:ss")} bi: {CurrentBar} c: {Close[0]}", false);
        }
        }
        }

        Print Output:
        == TickReplay Enabled ==
        time: 12:00:00 bi: 491 c: 6087.75
        time: 12:05:00 bi: 492 c: 6087
        time: 12:10:00 bi: 493 c: 6086.75​

        == TickReplay Disabled Correlates with values in Data box ==
        time: 12:00:00 bi: 491 c: 6087
        time: 12:05:00 bi: 492 c: 6086.5
        time: 12:10:00 bi: 493 c: 6087​​

        Comment


          #19
          Hello love2code2trade,

          It would depend on when the print appears, if this is during or after the bar is finished building.

          If the value is from when the order is building it may be different than the final value when the bar closes.

          Your print appears to print the value of the very first tick that has opened the bar as it first starts building.
          If you print the previous bar's value after that bar has closed, it will show the same values as the databox.
          Chelsea B.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Today, 05:17 AM
          0 responses
          43 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          124 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          65 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          42 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          46 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X