Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ES and MES draw differently on the same time scale

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

    ES and MES draw differently on the same time scale

    Is there any difference in data (Dataseries) between ES and Micro ES Charts? Because I made an indicator that draws a Rectangle in the OnRender, I meant, My Indicator Draws Volume Areas per Bar, I am using renderTarget.DrawRectangle in ES (5 Minutes), it is drawn very well and matches the Volumetric (5 Minutes) Chart in ES 5 minutes, but if I use my indicator in a Micro-ES (5 Minutes) type Data series, the rectangle does not match in the same areas, it only matches if I set the TickReplay option to True, but as we already know that slows down the platform, am I missing something to add to my code? I am sending in this post two images in the same area so that you can see the difference in how the rectangles are drawn.

    ES Image Rectangles are OK:


    MES Is Not OK

    Click image for larger version

Name:	MES-0325.png
Views:	269
Size:	10.7 KB
ID:	1335723​​

    #2
    Hello icebergdelphi,

    These are different instruments that trade at different prices.

    The underlying commodity/security may be the same but as they are traded separately the price movements will be different.

    It would depend on what the script is doing and if the script is referencing different data series.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      NinjaTrader_ChelseaB I am using this in my code:
      PHP Code:
      else if (State == State.Configure)
      {
      if (Bars.BarsType.IsTimeBased && Bars.BarsType.IsIntraday)
      {
      AddVolumetric(Instrument.FullName, Bars.BarsPeriod.BarsPeriodType, Bars.BarsPeriod.Value, VolumetricDeltaType.BidAsk, 1);
      }
      }​​ 
      

      Comment


        #4
        Hello icebergdelphi,

        Data series information is not supported to use with AddDataSeries(), AddVolumetric(), or any other AddDataSeres type method.

        From the Desktop SDK:
        "Arguments supplied to AddDataSeries() should be hardcoded and NOT dependent on run-time variables which cannot be reliably obtained during State.Configure (e.g., Instrument, Bars, or user input). Attempting to add a data series dynamically is NOT guaranteed and therefore should be avoided. Trying to load bars dynamically may result in an error similar to: Unable to load bars series. Your NinjaScript may be trying to use an additional data series dynamically in an unsupported manner.​"
        Join the official NinjaScript Developer Community for comprehensive resources, documentation, and community support. Build custom indicators and automated strategies for the NinjaTrader platforms with our extensive guides and APIs.


        That said, this confirms the script is adding additional series as suspected and is likely using information from a different instrument with different pricing information and different volume as the bars ago and price values for the Draw.Rectangle() call.

        It would be expected these do not match (but would be loosely correlated) if this is the case.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          NinjaTrader_ChelseaB I need AddVolumetric​ because I get the POC for calculations in the OnBarUpDate: double pocPrice;
          barsType.Volumes[CurrentBar].GetMaximumVolume(false, out pocPrice);​

          And based on the POC I draw the VAH and the VAL of the Candle using the rectangle

          Comment


            #6
            Hello icebergdelphi,

            The instrument and bar type would need to match if you want the Open, High, Low, Close, and Volume to match.

            As an example, attached is a test script that shows the same high and low of the primary and volumetric if the data series is the same.
            IcebergdelphiVolumetricOpenCloseBarTest_NT8.zip
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_ChelseaB View Post
              Hello icebergdelphi,

              The instrument and bar type would need to match if you want the Open, High, Low, Close, and Volume to match.

              As an example, attached is a test script that shows the same high and low of the primary and volumetric if the data series is the same.
              [ATTACH]n1335759[/ATTACH]
              The problem is not the candles, it seems strange to me that I am using the same method to obtain the VAH and VAL from the POC To Draws the corresponding rectangles of the Value area are painted in each Candle and with ES they work very well whether normal or Volumetric Bars, the problem is when I use the same method in MES my rectangles are seen higher or lower than the candles, I am using OnRender and renderTarget.FillRectangle(rect, VABrushColor4);
              renderTarget.DrawRectangle(rect, VPDashStyle.BrushDX, VPDashStyle.Width, VPDashStyle.StrokeStyle); etc etc.​

              Maybe it's the data since I use the same method to calculate the POC and VA in both ES and MES. As I told you before if in the MES Dataseries Config I click in the TickReplay option the Rectangles Draws Really good.
              Last edited by icebergdelphi; 02-24-2025, 02:54 PM.

              Comment


                #8
                Hello icebergdelphi,

                The data from the volumetric bars will be the same as would be shown a chart.

                Below is a link to an example of calculating the POC.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  NinjaTrader_ChelseaB Well I resolved MySelf, I Put: AddVolumetric(Instrument.FullName, BarsPeriodType.Minute, Bars.BarsPeriod.Value, VolumetricDeltaType.BidAsk, 1); I Meant I changed from Bars.BarsPeriod.BarsPeriodType to BarsPeriodType.Minute, Thank you.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  580 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  335 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  102 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  554 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  552 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X