Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using the "dashes" parameter of the StrokeStyle constructor causes excp

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

    #16
    Yeah, Google has stopped updating Chrome on Windows 7.
    So that version I gave, I presume it's the last one.

    I just tried FF/Edge/Chrome browsers on Win11.
    For me, that link works fine on all browsers.
    No issues.

    Yeah, either your cache or, hmm, got any Addons that mess
    with embedded links?

    Comment


      #17
      Those are all good ideas. I disabled every extension in Chrome, cleared by cache, and restarted it. Still the same. But no worries. Bigger fish to fry. Thanks for checking. My Windows 11 works also, same version of Chrome as on this non-working one on Windows 10, so clearly it's a local issue.
      Bruce DeVault
      QuantKey Trading Vendor Services
      NinjaTrader Ecosystem Vendor - QuantKey

      Comment


        #18
        Yeah, perhaps a Chrome settings issue ...

        Maybe try resetting your Chrome back to all default settings.

        Comment


          #19
          Originally posted by bltdavid View Post
          Yeah, perhaps a Chrome settings issue ...

          Maybe try resetting your Chrome back to all default settings.
          Resetting Chrome to default settings does fix the links. Thanks for the suggestion. No idea what setting was breaking this and I don't recall changing any settings but it doesn't matter if it works. Perhaps just got messed up over the years - this one's been installed for ages.
          Bruce DeVault
          QuantKey Trading Vendor Services
          NinjaTrader Ecosystem Vendor - QuantKey

          Comment


            #20
            Wow, you guys are great. If only I could wake up EVERY morning with all of my problems solved, hah.

            Bruce, using DashStyle.Custom did indeed solve the problem, and makes obvious sense in retrospect. This is very helpful, as it gives me another visual vector along which to display line "strength", besides color, which I am already overusing.

            The odd exception behavior, the "unsafe" keyword, and the relative obscurity of this part of the API had me worried I had run into an area of the code that perhaps didn't work.

            bltdavid - This is the first time I've ever NOT gotten exception info from within VS2022. What environment are you in that enabled you to get a stack trace?

            As a general brief question to both of you -- are there any high level techniques or understandings I should have when dealing with unsafe parts of the NT8 API? N/w it not, just figured I'd shake the tree while I'm here. It was not my first instinct to even look at the DashStyle parameter here, b/c of the worries mentioned above.

            Anyhow, thank you kindly for all of your help. Much appreciated.

            Cheers,
            Peter​

            Comment


              #21
              Just make sure you release the memory you allocate (make sure you use "using" where appropriate or are meticulous about deleting your new objects when appropriate). There's nothing inherently unsafe about programming with SharpDX it's just a more technical area.

              I didn't see the same trace as bltdavid - I'm not sure where that specific example he posted came from - but the traces are in the Documents -> NinjaTrader 8 -> trace file.
              Bruce DeVault
              QuantKey Trading Vendor Services
              NinjaTrader Ecosystem Vendor - QuantKey

              Comment


                #22
                To quickly get a stack trace, I used an existing indicator.

                That is, I opened up prior downloaded indicator called
                'FootprintChart.cs', which is stored in 'Indicators\Poncho'
                folder -- don't recall where i got it, probably NT forums,
                it's free and has lots of useful code to learn from.

                Anyways,
                I used it because I know it has an OnRender, and I know
                practically the entirely code inside OnRender was first
                wrapped in a try/catch block by the author.

                So, I use that indicator and I borrowed your function,
                called it from inside the try/catch block inside OnRender,
                and got the stack trace in the output window.

                It was the quickest of the quick & dirty methods, so
                the trace parts showing Poncho.FootPrintChart, well
                that's kinda useless, the method name GetStrokeStyle
                comes from your code, so the stack trace above that
                shows the underlying SharpDX constructor ... which
                looks like an unmanaged constructor? .. which is why
                I thought maybe NT was missing a constructor overload.

                Anyways, I use try/catch a lot to get print stack traces.

                Comment


                  #23
                  Well, well, well. Thank you guys again.

                  Interestingly, the traces files DO contain a critical line of output that matches the exception:

                  2023-04-30 10:39:53:153 ERROR: Indicator 'Alphanaut': Error on calling 'OnRender' method on bar 6730: HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message: The parameter is incorrect.

                  Very easy to miss in the hurricane of logging I do, but there it is. So thanks for pointing that out Bruce. I guess they have a logs AND a trace directory for a reason, hah.

                  And. While turning on capture of all possible exception types in VS2022 (something I thought to try after this convo) did not provide further clarity, simply catching and printing the exception did, just like you suggested bltdavid. Hahahah, live and learn. I was a C++ guy for most of my career, and exceptions are still kind of a dirty word there, so I cannot say I have any sort of C# exception spider sense. But perhaps a new rule for me should be: "if you get an exception of ANY kind, there is info attached to that exception SOMEWHERE and finding it is the next step".

                  Click image for larger version  Name:	image.png Views:	0 Size:	69.4 KB ID:	1249106Bam!

                  Cheers,
                  Peter

                  Comment


                    #24
                    Yes, the prescient issue is that the parameters are in fact incorrect.
                    Bruce DeVault
                    QuantKey Trading Vendor Services
                    NinjaTrader Ecosystem Vendor - QuantKey

                    Comment


                      #25
                      Crossing language barriers in general, which is what is happening with the "unsafe" keyword, puts me into heightened alert mode for mystery voodoo and unexplained failures. C# does an amazing job compared to what I've seen in the past, but it's still one of those spaces where my past informs me that it is often better to first ask the tribe what some mystery problem might be, than going on what could be a multi-day spelunking mission.

                      Fortunately, C#'s high quality integration tech ultimately would have made figuring out what was going here MUCH easier than I expected, had I known what to do or been a little more aggressive about trying the "right" things!
                      Last edited by carnitron; 04-30-2023, 12:13 PM.

                      Comment


                        #26
                        Hello carnitron,

                        Thanks for your posts.

                        QuantKey_Bruce is correct and the code they shared demonstrates how StrokeStyle could be used.

                        You could find this information on the help guide page linked below which bltdavid shared in post # 7. When clicking the link that bltdavid shared I see the correct help guide page appear in the Chrome web browser on Windows 10.



                        Please let us know if you have further questions on this topic.
                        <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

                        Comment


                          #27
                          Brandon, ah thank you for confirming the link there, I have bookmarked it.

                          One thing that would be helpful is linking to this page from the pages that talk about StrokeStyle. If you do a search for "dashes" from the Table of Contents page, you will see that this pages is the very last item in the search results, and it is labeled "NinjaScript > Educational Resources > Using SharpDX for Custom Chart Rendering", which makes it seem unrelated or tangentially related to the "dashes" topic one is searching for.

                          I looked through the other links and didn't see anything helpful so I made a snap conclusion that this was an edge case area of the API with minimal documentation.

                          Annoyingly, I had even read about the "Custom" setting a day or two before, which mentions "The dash pattern is specified by an array of floating-point values", but I was looking for a different answer then, so my brain clearly jettisoned the info as not overly useful b/c of the context at the time, lol.

                          A link to this example in the "Custom" HTML table entry here: "NinjaScript > SharpDX SDK Reference > SharpDX.Direct2D1 > StrokeStyle > SharpDX.Direct2D1.StrokeStyle.DashStyle" might save future doc readers from the same fate, Not sure if you guys field doc bugs, but this feel like a 90 second fix, if you do.

                          Cheers,
                          Peter

                          P. S. I am not pasting the direct link, b/c I can't figure out how to get it ftm and I have to move on. When I navigate through the help, it keeps the link I started on and must maintain the topic frame I am on as some inner frame state. Is there a way to share the intended link to the topic page I'm on so it is easier to communicate about the help pages? (This seems related to what Bruce and bltdavid were talking about earlier, but it's not quite the same, b/c I see the same behavior on both the latest version of Edge AND Chrome.)

                          Comment


                            #28
                            Hello Peter,

                            Thanks for your notes.

                            When searching for "dashes" in the NinjaTrader 8 help guide, I am seeing the SharpDX.Direct2D1.StrokeStyle.DashStyle help guide page is the 4th search result listed. See the attached screenshot.

                            That said, the specific link to SharpDX.Direct2D1.StrokeStyle.DashStyle could be found below.

                            DashStyle: https://ninjatrader.com/support/help..._dashstyle.htm

                            To share a help guide link, you could right-click on "DashStyle" found by navigating to NinjaScript > SharpDX SDK Reference > SharpDX.Direct2D1 > StrokeStyle > DashStyle, select the 'Copy link address" option from the right-click menu, and then paste the link where you want to share it.

                            Please let me know if I may assist further.
                            Attached Files
                            <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

                            Comment


                              #29
                              Ok cool the right-click trick works for me, TY.

                              In my prior post, I'm saying that the link you shared with the super useful code example is the 6th item:

                              Click image for larger version  Name:	image.png Views:	0 Size:	425.1 KB ID:	1249391

                              I was suggesting you link to it in the text of item 4, the one that has the Custom entry for DashStyle. And maybe others too. There are many barriers to finding it, given that it is in an entirely different section of doc, has a title that does not appear related to stroke styles, and isn't linked to anywhere in the sections talking about stroke styles.

                              Does this make sense?

                              Cheers,
                              Peter

                              Comment


                                #30
                                That was actually my example in post 9 in this thread above https://forum.ninjatrader.com/forum/...55#post1249055 but I couldn't get the link to work either and bltdavid and I ended up having a big sidebar discussion about that.
                                Bruce DeVault
                                QuantKey Trading Vendor Services
                                NinjaTrader Ecosystem Vendor - QuantKey

                                Comment

                                Latest Posts

                                Collapse

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