Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

colocacion de ordenes limitadas extrañas

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

    colocacion de ordenes limitadas extrañas

    I am building a liquidity map using the level 2 data that I receive from the OnMarketDepth method. These data come from the Ninjatrader Continuum provider. I'm including screenshots of the code to ensure that the data is being read correctly:

    Click image for larger version

Name:	image.png
Views:	170
Size:	12.3 KB
ID:	1316118
    Once an update is detected, another method is called to calculate the volume increment:

    Click image for larger version

Name:	image.png
Views:	173
Size:	43.3 KB
ID:	1316119

    In the previous code, I obtain the previous volume using the price received in the update as the key, and I compare the previous volume with the current one to calculate the increment. The strange thing is that increments are constantly occurring at certain price levels, and these seem to follow an unnatural pattern. This happens throughout the day, and these limit orders never seem to get executed since they always remain at the same distance, which also doesn't make sense as it would be odd to place orders just to cancel and move them continuously. Here is a visual test of the generated liquidity map; the circles represent the big trades of liquidity caused by these large contract movements:


    Click image for larger version

Name:	image.png
Views:	243
Size:	56.5 KB
ID:	1316117

    I printed the volume increments to the console along with other related data to see the specific volume numbers that we receive:

    Click image for larger version

Name:	image.png
Views:	171
Size:	99.8 KB
ID:	1316120

    As you can see, the volume increments/decrements occur constantly, and the amounts are almost always the same: 100, 150, and 250. Sometimes I do get more normal readings outside of this pattern. I have included the "tick diff" in the logs, which is the tick difference between the current price and the price where the limit order is placed, and as you can see, the distance remains around 20 ticks approximately. I would like to know if the error is being made by me when reading the data, which is why I attached code screenshots, but if that's not the case, I don't understand how such a large number of contracts can be moved without them ever getting executed, or if the problem lies with the data provider.

    #2
    Hello juliangonzaconde,

    There is a reference sample of creating a level II book you may find very helpful.


    I see that you have a custom method to get the previous volume, which may be where the issue is coming from.

    I would recommend doing further debugging in this method to find out why the previousVolume is 100 less than the marketUpdate.Volume.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChelseaB View Post
      Hello juliangonzaconde,

      There is a reference sample of creating a level II book you may find very helpful.


      I see that you have a custom method to get the previous volume, which may be where the issue is coming from.

      I would recommend doing further debugging in this method to find out why the previousVolume is 100 less than the marketUpdate.Volume.
      I have imported the example indicator you referenced and compared the map it constructs. At the end of each bar, the dictionary produced by my indicator is identical to the dictionary of the example indicator. I have attached both text files in case you want to check them. I have also changed the way I obtain the previous value, omitting the use of TryGetValue, and the result remains unchanged; I am still getting these strange increments.​ own Book .txt example book.txt

      Comment


        #4
        Hello juliangonzaconde,

        I am not able to reproduce this behavior.

        Below is a link to a video of a test where I save the previous volume to the class row before updating the volume to the new volume.


        Most often the difference is 1, but I am also seeing differences of 2 and 4 and 7 and even one that was 24.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_ChelseaB View Post
          Hello juliangonzaconde,

          I am not able to reproduce this behavior.

          Below is a link to a video of a test where I save the previous volume to the class row before updating the volume to the new volume.


          Most often the difference is 1, but I am also seeing differences ​ of 2 and 4 and 7 and even one that was 24.
          I do not have access to the video; I requested access with the Gmail account [email protected]. Nevertheless, I will share new observations I have made:

          This morning, I was monitoring the volume inflow, as it seemed 'normal', with apparently random volume entries, just as you saw it. However, starting at a certain time, as seen in the image below, volume began to enter in amounts of 100, 150, and 250. This can also be verified in the logs


          Click image for larger version  Name:	Captura de pantalla 2024-08-29 140505.png Views:	0 Size:	183.0 KB ID:	1316207

          On the other hand, I checked if the anomalous volume is also present in the book of the example indicator, and it records the same amount of volume per price level. Additionally, it moves in the same way as it does in my indicator, this is another test i've done 5 minutes ago by printing both books:

          my book:

          Price: 5649,25, Volume: 255
          Price: 5649,5, Volume: 366
          Price: 5649,75, Volume: 154
          Price: 5650, Volume: 221
          Price: 5650,25, Volume: 90
          Price: 5650,5, Volume: 75
          Price: 5650,75, Volume: 82
          Price: 5651, Volume: 80
          Price: 5651,25, Volume: 92
          Price: 5651,5, Volume: 74
          Price: 5651,75, Volume: 86
          Price: 5652, Volume: 96

          example indicators book:

          Ask Price=5649,25 Volume=255 Position=19
          Ask Price=5649,5 Volume=366 Position=20
          Ask Price=5649,75 Volume=154 Position=21
          Ask Price=5650 Volume=221 Position=22
          Ask Price=5650,25 Volume=90 Position=23
          Ask Price=5650,5 Volume=75 Position=24
          Ask Price=5650,75 Volume=82 Position=25
          Ask Price=5651 Volume=80 Position=26
          Ask Price=5651,25 Volume=92 Position=27
          Ask Price=5651,5 Volume=74 Position=28
          Ask Price=5651,75 Volume=86 Position=29
          Ask Price=5652 Volume=96 Position=30

          The increase of 250 contracts occurred at the 5649.5 level, and both dictionaries reflect this. If later, in my dictionary, this volume is moved to 5648, for example, it would be reflected in the same way in the example indicator's book. This seems to indicate that if I am doing something wrong, the example indicator is also doing it wrong.

          Do you think it would be easier if I shared the source code of the indicator privately? I'm not sure if this is possible.
          Last edited by juliangonzaconde; 08-29-2024, 09:51 AM.

          Comment


            #6
            Hello juliangonzaconde,

            Apologies, I've changed the share permissions on the video, you should be able to view this now.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by juliangonzaconde View Post

              I do not have access to the video; I requested access with the Gmail account [email protected]. Nevertheless, I will share new observations I have made:

              This morning, I was monitoring the volume inflow, as it seemed 'normal', with apparently random volume entries, just as you saw it. However, starting at a certain time, as seen in the image below, volume began to enter in amounts of 100, 150, and 250. This can also be verified in the logs


              Click image for larger version Name:	Captura de pantalla 2024-08-29 140505.png Views:	0 Size:	183.0 KB ID:	1316207

              On the other hand, I checked if the anomalous volume is also present in the book of the example indicator, and it records the same amount of volume per price level. Additionally, it moves in the same way as it does in my indicator, this is another test i've done 5 minutes ago by printing both books:

              my book:

              Price: 5649,25, Volume: 255
              Price: 5649,5, Volume: 366
              Price: 5649,75, Volume: 154
              Price: 5650, Volume: 221
              Price: 5650,25, Volume: 90
              Price: 5650,5, Volume: 75
              Price: 5650,75, Volume: 82
              Price: 5651, Volume: 80
              Price: 5651,25, Volume: 92
              Price: 5651,5, Volume: 74
              Price: 5651,75, Volume: 86
              Price: 5652, Volume: 96

              example indicators book:

              Ask Price=5649,25 Volume=255 Position=19
              Ask Price=5649,5 Volume=366 Position=20
              Ask Price=5649,75 Volume=154 Position=21
              Ask Price=5650 Volume=221 Position=22
              Ask Price=5650,25 Volume=90 Position=23
              Ask Price=5650,5 Volume=75 Position=24
              Ask Price=5650,75 Volume=82 Position=25
              Ask Price=5651 Volume=80 Position=26
              Ask Price=5651,25 Volume=92 Position=27
              Ask Price=5651,5 Volume=74 Position=28
              Ask Price=5651,75 Volume=86 Position=29
              Ask Price=5652 Volume=96 Position=30

              The increase of 250 contracts occurred at the 5649.5 level, and both dictionaries reflect this. If later, in my dictionary, this volume is moved to 5648, for example, it would be reflected in the same way in the example indicator's book. This seems to indicate that if I am doing something wrong, the example indicator is also doing it wrong.

              Do you think it would be easier if I shared the source code of the indicator privately? I'm not sure if this is possible.
              Could you please take a look at this post and tell me your thoughts? I'm still struggling to understand that anomalous volume.I would like to emphasize that those volume increases are not measured at the close of the bar, but rather with each real-time volume update received.
              Last edited by juliangonzaconde; 08-30-2024, 07:27 AM.

              Comment


                #8
                Hello juliangonzaconde,

                This is likely an issue with the custom logic in the script.

                I am not able to reproduce as shown in the video I have provided.

                Yes, the data is updating from OnMarketDepth() on every change in market depth.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by NinjaTrader_ChelseaB View Post
                  Hello juliangonzaconde,

                  This is likely an issue with the custom logic in the script.

                  I am not able to reproduce as shown in the video I have provided.

                  Yes, the data is updating from OnMarketDepth() on every change in market depth.
                  It's normal that sometimes it doesn't reproduce; I also couldn't reproduce it at certain times, but at other times, I could. And also, I am only printing big L2 orders. I am receiving normal volume as well—1 most of the time, 2, 4... but when the order is big, it's mostly 100, 150, or 250.. This is what I'm trying to explain above; it's all detailed, so please read it carefully. Also, as I mentioned above, my indicator is showing the same books as the indicator you use in the video, so if the logic of my script isn't correct, then the logic of the script you're using as an example isn't correct either.

                  Last edited by juliangonzaconde; 08-30-2024, 11:57 AM.

                  Comment


                    #10
                    Hello juliangonzaconde,

                    May I have an export of the script to confirm you made the exact changes I showed in the video? (The script should be exactly the same, character for character, as in the video)

                    To export a NinjaTrader 8 NinjaScript so this can be shared and imported by the recipient do the following:
                    1. Click Tools -> Export -> NinjaScript Add-on...
                    2. Click the 'add' link -> check the box(es) for the script(s) and reference(s) you want to include
                    3. Click the 'Export' button
                    4. Enter the script name in the value for 'File name:'
                    5. Choose a save location -> click Save
                    6. Click OK to clear the export location message
                    By default your exported file will be in the following location:
                    • (My) Documents/NinjaTrader 8/bin/Custom/ExportNinjaScript/<export_file_name.zip>
                    Below is a link to the help guide on Exporting NinjaScripts.
                    http://ninjatrader.com/support/helpG...nt8/export.htm
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      Originally posted by NinjaTrader_ChelseaB View Post
                      Hello juliangonzaconde,

                      May I have an export of the script to confirm you made the exact changes I showed in the video? (The script should be exactly the same, character for character, as in the video)

                      To export a NinjaTrader 8 NinjaScript so this can be shared and imported by the recipient do the following:
                      1. Click Tools -> Export -> NinjaScript Add-on...
                      2. Click the 'add' link -> check the box(es) for the script(s) and reference(s) you want to include
                      3. Click the 'Export' button
                      4. Enter the script name in the value for 'File name:'
                      5. Choose a save location -> click Save
                      6. Click OK to clear the export location message
                      By default your exported file will be in the following location:
                      • (My) Documents/NinjaTrader 8/bin/Custom/ExportNinjaScript/<export_file_name.zip>
                      Below is a link to the help guide on Exporting NinjaScripts.
                      http://ninjatrader.com/support/helpG...nt8/export.htm
                      I have just modified the sample indicator the same way you did, but also added a condition to print big increments:

                      Click image for larger version  Name:	image.png Views:	0 Size:	16.8 KB ID:	1316373

                      and the sample indicator is reading exactly the same big increments: 100,150,250:

                      Click image for larger version  Name:	image.png Views:	0 Size:	12.0 KB ID:	1316374

                      You can try adding the same condition and you should read the same big increments as we have the same sample indicator and the same data provider​​ (and same symbol: ES 09-24 ).
                      Last edited by juliangonzaconde; 08-30-2024, 01:40 PM.

                      Comment


                        #12
                        Hello juliangonzaconde,

                        The output you are providing is not the output the video is showing and doesn't give a clear picture of the values involved. And you did not export the script and provide this as directed.

                        As you are not able to provide the requested information so that I may assist, attached is an export of the test script.
                        SampleLevel2Book_NT8.zip

                        Please provide the output from the script without making any modifications. Instead of a screenshot, right-click the output window and select Save as.
                        Attach the output text file to your next post.

                        Also, please let me know what connection you are connected to.
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #13
                          The output is not the same because I modified the script to print volumes greater than 50 as they arrive. It's the code from the screenshot I shared.I print the moment the larger volume comes in not only on bar close. The same values that I print with my indicator are printed. I also have screenshots from my indicator showing the volume moving without apparent reason: 100, 150, 250 (ES 09-24)—the same values that I print with the modified example indicator. I'll send you the zip so you can try it when the market opens. In very few instances, this anomalous volume doesn't appear, but most of the time, these increments are recorded. SampleLevel2Book_nt8volIncre.zip
                          Attached Files
                          Last edited by juliangonzaconde; 08-31-2024, 10:04 AM.

                          Comment


                            #14
                            Have you tried what I told you in the previous post? i am still stuck with this

                            Comment


                              #15
                              Hello juliangonzaconde,

                              The test script provided is meant to show snapshots of level 2 volume to show that this is not always 100 different.

                              Please provide the output from the provided test script without making any modifications to it.
                              Chelsea B.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              558 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              324 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              101 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              545 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              547 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X