Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Tick counter trigger play wav/mp3 file

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

    Tick counter trigger play wav/mp3 file

    Is it possible to do a tick counter or modify the existing tick counter to play a mp3/wav when it's near completion? Say have it play a beep when there are 10 ticks left to go?
    Would this be doable via the wizard or would it have to be a custom written script?

    #2
    Hi Hungryman,

    Unfortunately this is not possible using the strategy wizard - would have to be created with custom programming.

    You can view source code for all system indicators, including tick counter. This is accessed through Tools > Edit NinjaScript. To save a copy of a system indicator you can right click within the editor > Save As.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Ryan would I simply not be able to edit/rename the @tickcounter.cs file and throw in

      If (Ticks remaining) > 50

      trigger = true;
      Alert(DateTime.Now.Millisecond.ToString(), cbi.Priority.medium, "price level" + price + "' hit!", Cbi.core.InstallDir + @"\sounds\alert4.wav", 0,Color.Yellow, Color.Black);

      If I wanted it to play a wav file when ticks on the counter got below 50. What else would I have to change? I'm simply taking the play alert line from the pricealert.cs so i'm sure this could be simplified?

      Comment


        #4
        Hungryman, that is pretty much what you'll have to do. I would strongly recommend not just renaming the indicator, as there would be naming conflicts - you can open up the TickCounter indicator for editing in NinjaTrader and then right-click and save as and then save it as another file name.

        If you want the alert to sound just once when there are less than 50 ticks left, the code will also have to be a little different:
        Code:
        if (FirstTickOfBar)
           alertSounded = false;
        if (remaining ticks < 50)
        {
           alertSounded = true;
           // play alert
        }
        Please let me know if I can be of further assistance.
        AustinNinjaTrader Customer Service

        Comment


          #5
          Austin, after I have saved as (ticksound.cs) instead of tickcounter.cs can I
          A. cut and paste the code you have given me and hit compile to save?

          B. Or would I need to delete some stuff from the tick counter file? Such as the price alert part of it?

          C. Or being so simple as it seems could I just delete everything in the file and just paste in

          if (FirstTickOfBar)
          alertSounded = false;
          if (remaining ticks < 50)
          {
          alertSounded = true;
          // play alert
          }

          Comment


            #6
            Austin's example is conceptual and will not work as is in a script. Remaining ticks is not the name of the value you're checking for. It will take a bit of work custom coding this, mainly to make sure the value tickCount (the actual value you're checking for) is available within a broader scope than the original script intends.

            Sorry that we can't provide a specific solution for you, but any of our NinjaScript consultants should be able to assist:
            Ryan M.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Waxavi, Today, 02:10 AM
            0 responses
            3 views
            0 likes
            Last Post Waxavi
            by Waxavi
             
            Started by TradeForge, Today, 02:09 AM
            0 responses
            8 views
            0 likes
            Last Post TradeForge  
            Started by Waxavi, Today, 02:00 AM
            0 responses
            2 views
            0 likes
            Last Post Waxavi
            by Waxavi
             
            Started by elirion, Today, 01:36 AM
            0 responses
            4 views
            0 likes
            Last Post elirion
            by elirion
             
            Started by gentlebenthebear, Today, 01:30 AM
            0 responses
            4 views
            0 likes
            Last Post gentlebenthebear  
            Working...
            X