Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Ability to call .wav files easily

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

    Ability to call .wav files easily

    for playsound/alert functions we are forced to point some sound files. (yes, i know, we have doc )
    reembering the variables and locations are not easy and we are wasting several minutes on each case we want to code alerts/playsounds.

    please make a shorthand function builtin, say method (inside NinjaScriptBase) which will have overloads:
    SoundFileLocation(SoundFileNameEnum sName)
    and
    SoundFileLocation(string soundName)

    so, instead of :
    `PlaySound(NinjaTrader.Core.Globals.InstallDir + @"\sounds\Alert1.wav");`
    we could easily call:

    PlaySound( SoundFileLocation("Alert1") );

    or

    PlaySound( SoundFileLocation(SoundFileNameEnum.Alert1) );

    #2
    That sounds like a great idea!
    (excuse the pun)

    In fact, you can do this yourself. It should be relatively
    straightforward and simple enough.

    After you design your enum, you might as well overload the
    standard 'SoundFile()' itself to accept your enum,

    Code:
    PlaySound(SoundFileNameEnum.Alert1);
    which does all the work and calls PlaySound as you would expect.

    Add this code to your partial class library, and you're done!
    Last edited by bltdavid; 07-24-2020, 10:22 AM.

    Comment


      #3
      Hello ttodua,

      Thank you for your post.

      bltdavid has a great suggestion here which is pretty much what we'd suggest as well. You could certainly make your own partial class to handle these, which is what we'd recommend. You have the ability to create your own helper methods like what you're requesting.

      Here's a link to a forum post with an example of creating helper methods like this:



      I'll also work up a more specific example and have that for you on Monday in case you need further guidance.

      Thanks in advance; I look forward to assisting you further.
      Kate W.NinjaTrader Customer Service

      Comment


        #4
        Dears, thanks for suggestion, however you might have seen that this is not my first post or alike, making it in my helper methods has been surely out of question (however, i wouldnt have asked the question, because it's a child-play easy to make the method myself). Just wanted to have the feature in NT, because when i work on separate indicators I have to avoid including any library. so, as the original post also says, we wanted this to "simplify' our work.
        anyway thanks. Kate, please open a formal ticket for request.

        Comment


          #5
          I don't disagree with you.

          However, a simple one-line method, such as this,

          Code:
          private void MyPlaySound(string filnam)
          {
              PlaySound(NinjaTrader.Core.Globals.InstallDir + @"\sounds\" + filnam + ".wav");
          }
          could easily be incorporated into every one of your standalone indicators.

          If you build lots of indicators, setup a skeleton template file that contains
          common C# code and small utility methods every indicator might need.

          This skeleton file should contain only the most universal and most used
          of all your common code. If you have larger indicators needing larger
          amounts of common code, invent multiple skeleton files that provide
          the right foundation of code to flavor the indicator you're creating.

          Every time you start a new standalone indicator that cannot use your
          partial library of common code, start by copying the appropriate
          flavor of skeleton as the basis for the new indicator.

          Just my 2˘.

          Comment


            #6
            bltdavid many thanks for posting your advise surely, i can copy paste that code into every new indicator. my only purpose and question about this could be - how many minutes it will take for NT devs to add that in NinjaScriptBase ? I think it will make developing alerts easier for programmers, instead of spending five's of minutes remembering to find the "NinjaTrader.Code.Globals.InstallDir" name, followed with @sounds and etc...
            so, the only intent, was that NT "facilitate things" for us (developers).

            the good thing is that I have been using personal libraries already for several years for now, and i agree you - is the best way to keep work organized.
            moreoever, i might add some 2c too, which you might find some good for you too. firstly, using https://puvox.software/blog/chart-de...r-ninjatrader/ for debuggin indicators, second, using https://puvox.software/blog/ninjatra...ted-instances/ for creating multiple instances for "Custom" folder (if you need to work on different clients and test .cs or .dll files separately, and third - using https://puvox.software/blog/easiest-...link-symbolic/ for creating the same library reflected into multiple destination folders (like in every "Custom/AddOns" folder, where I have put the symlinks of my single c# library file (to say frankly, i have 2 library files - one for generic c# methods that i use in other c# tasks too, and the second .cs file which only contains nt8 related codes).

            thnx.

            Comment


              #7
              Hello ttodua,

              Thank you for your replies.

              In most cases, our goal is to provide a solution to NinjaScript without adding additional code to base classes. In this case, you can already create your own user defined methods to accomplish the goal.

              As you are interested in having NinjaTrader provide the helper method for you, I have opened SFT-4972 to track user interest in providing a built in helper method for this case.

              As with all feature requests, interest is tracked before implementation is considered, so we cannot offer an ETA or promise of fulfillment. If implemented, it will be noted in the Release Notes page of the Help Guide.

              Release Notes — https://ninjatrader.com/support/help...ease_notes.htm

              Please let us know if we may be of further assistance to you.
              Kate W.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by fx.practic, 10-15-2013, 12:53 AM
              5 responses
              5,404 views
              0 likes
              Last Post Bidder
              by Bidder
               
              Started by Shai Samuel, 07-02-2022, 02:46 PM
              4 responses
              95 views
              0 likes
              Last Post Bidder
              by Bidder
               
              Started by DJ888, Yesterday, 10:57 PM
              0 responses
              8 views
              0 likes
              Last Post DJ888
              by DJ888
               
              Started by MacDad, 02-25-2024, 11:48 PM
              7 responses
              160 views
              0 likes
              Last Post loganjarosz123  
              Started by Belfortbucks, Yesterday, 09:29 PM
              0 responses
              8 views
              0 likes
              Last Post Belfortbucks  
              Working...
              X