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

Superdom Column sound alert

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

    Superdom Column sound alert

    Hello,
    I am trying to add a sound alert to a superdom column file.
    Code:
    Alert("myBlockAlert", Priority.High, "Block Order Alert", NinjaTrader.Core.Globals.InstallDir+@"\sounds\Alert3.wav", 10, Brushes.DeepSkyBlue, Brushes.Black);
    The normal alert above for an indicator or strategy does not work and throws a CS0118 error - "Alert is a type but is used like a variable".
    I presume that I should use the alerts set up for Add Ons Like so:
    Code:
    NinjaTrader.NinjaScript.Alert.AlertCallback(NinjaTrader.Cbi.Instrument.GetInstrument("ES 06-17"), this, "myBlockAlert", NinjaTrader.Core.Globals.Now, Priority.High, "Block Order Alert", NinjaTrader.Core.Globals.InstallDir+@"\sounds\Alert3.wav", Brushes.DeepSkyBlue, Brushes.Black, 0);
    That code appears to require me to specify an instrument name. As I will be using it across various instruments, is there a way to set a sound alert for a Superdom column without specifying an instrument name?
    Thank you.

    #2
    Hello GeorgeW,

    You are correct, you would need to use NinjaTrader.NinjaScript.Alert.AlertCallBack() and this would require an instrument.


    Can supply SuperDom.Instrument for the instrument. (And SuperDom.Account if you need the account)
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks for your response, ChelseaB.
      I am trying to add the alert to the Mini Time & Sales Superdom Column downloaded from this site. I want the alert to occur when e.Volume >= BlockAlertTrade size.

      The OnPositionUpdate() part of the code that I have added, as per the second paragraph of your reply, does not like "e.Volume >= BlockAlertTrade size" as part of the condition, and I have also tried to set up a bool for when that is true, which it also doesn't like. I am attaching the code with my attempts at updating it referenced, some commented out. I wonder if you could take a look at it and let me know what I need to do to make the alert for other instruments work.
      Thank you.
      Attached Files

      Comment


        #4
        Hi GeorgeW,

        I have not suggested a condition and your condition to trigger the alert can be anything you would like.

        I have only suggested you supply the instrument to the NinjaTrader.NinjaScript.Alert.AlertCallBack() method using SuperDom.Instrument.

        For example:
        Code:
        NinjaTrader.NinjaScript.Alert.AlertCallBack([B]SuperDom.Instrument[/B], this, "myAlert", NinjaTrader.Core.Globals.Now, Priority.High, "my message", NinjaTrader.Core.Globals.InstallDir+@"\sounds\Alert1.wav", Brushes.Blue, Brushes.White, 1);
        Can you clarify your meaning when you mention "let me know what I need to do to make the alert for other instruments work"?

        Is your alert working for some instruments and not others?

        Is your condition evaluating as true?

        Are you printing to the output window to see the values of the variables used in the conditions?
        Dive into manipulating C# code from within an unlocked NinjaScript strategy using the NinjaScript Editor.3:11 Creating a New NinjaScript Strategy13:52 Analyz...
        Last edited by NinjaTrader_ChelseaB; 04-11-2017, 07:45 AM.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Add minimum contract value also?

          George, hope you get his working - I am very interested in it.

          Once you do have it working, is there a possibility you can add a minimum contract number to exclude small contracts from the mini T&S? Then I do not have to see al those single - 3 contract trades on like CL or less than 15 on ES for instance.

          Additionally, there seems to be an issue where I can place the B for big trades. I keep trying to get it closer to the other info but cannot get it there. Not sure why it is not just an alternative original post and needs a second post. But I am not a coder.

          Would really appreciate your posting your final alert capable either way. THANK YOU.

          Comment


            #6
            Hello ChelseaB,
            I misread the meaning of the 2nd paragraph of your first response, but now I have done exactly as you said and the alert works fine. Thank you.

            JMont1, I have attached a copy of the updated Supedom column indicator. I have added a LowestDisplayedTradeSize, which I have currently set to 10 contracts, and you can adjust that on the indicator itself or in properties. I have also added a BlockSoundAlertRearmTime, which I have set at 60 seconds, and you can adjust it as above. Thanks to ZacharyG for the original.

            I am not sure what you mean by "...where I can place the B for big trades"
            Please use the updated version in post #12.
            Attached Files
            Last edited by GeorgeW; 04-23-2017, 11:54 AM.

            Comment


              #7
              George when I try to import it through my ninja script for NInja 8, it says it was made from an older incomplete version of ninja trader. Any Ideas?

              Comment


                #8
                Hello Sns84,

                I have uploaded a correctly exported file.

                I have made a note at line 287 of the code as to what the issue was with my original upload. Basically, if you have version #1 and my updated version #2 in the indicators file at the same time, you need to stop version #1 from compiling, otherwise there will be a conflict in both versions having TextColors as a public enum. I renamed the one in #2 TextColors02, and that worked as I already had the file imported, but that prevents it from being exported or imported. So just delete #1 from the file or stop it compiling, and you can continue to use TextColors as the name in version #2.

                Please use the updated version in post #12.
                Attached Files
                Last edited by GeorgeW; 04-23-2017, 11:55 AM.

                Comment


                  #9
                  Hello,

                  Code:
                  if (e.Price == e.Ask)
                                          priceOutput02.Add(new PriceOutput02() { Output = string.Format("{0}\t\t{1}\t{2}", e.Time.ToLongTimeString(), e.Price.ToString("#.0000"), e.Volume), TextColor = TextColors.AtAsk, BlockAlert = true });
                  In the section of code above I have set the e.Price to four decimal places. Is there a way to set it so that it automatically uses the number of decimal places that the instrument uses, so two for the ES and four for the 6E?

                  Thank you.

                  Comment


                    #10
                    Originally posted by GeorgeW View Post
                    Code:
                    e.Price.ToString("#.0000"), ...
                    In the section of code above I have set the e.Price to four decimal places. Is there a way to set it so that it automatically uses the number of decimal places that the instrument uses, so two for the ES and four for the 6E?
                    Bars.Instrument.MasterInstrument.FormatPrice(e.Pri ce)

                    Comment


                      #11
                      Hello GeorgeW,

                      Thanks for your reply.

                      In OnMarketData() you would want to use:

                      e.Instrument.MasterInstrument.FormatPrice(e.Price)
                      Paul H.NinjaTrader Customer Service

                      Comment


                        #12
                        Thanks Paul and TradeSmart,

                        That works great.

                        I have attached the updated TimeAndSales indicator for anyone who wants to use it.
                        Attached Files

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by cre8able, Today, 03:20 PM
                        0 responses
                        5 views
                        0 likes
                        Last Post cre8able  
                        Started by Fran888, 02-16-2024, 10:48 AM
                        3 responses
                        47 views
                        0 likes
                        Last Post Sam2515
                        by Sam2515
                         
                        Started by martin70, 03-24-2023, 04:58 AM
                        15 responses
                        114 views
                        0 likes
                        Last Post NinjaTrader_Jesse  
                        Started by The_Sec, Today, 02:29 PM
                        1 response
                        7 views
                        0 likes
                        Last Post NinjaTrader_Jesse  
                        Started by jeronymite, 04-12-2024, 04:26 PM
                        2 responses
                        31 views
                        0 likes
                        Last Post NinjaTrader_BrandonH  
                        Working...
                        X