Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Generate Alert from script

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

    Generate Alert from script

    hi
    i am trying to genertae alert from a script.

    The code to genertae alert was copied from the help.

    this is the code :

    Alert("myAlert", Priority.High, "Reached threshold", NinjaTrader.Core.Globals.InstallDir + @"\sounds\Alert2.wav", 10, Brushes.Black, Brushes.Yellow);


    however the compilation generate an error :

    Error 625 'NinjaTrader.NinjaScript.Alert' is a 'type' but is used like a 'variable' d:\docs\Documents\NinjaTrader 8\bin\Custom\Indicators\Ace.cs 13460 21 NinjaTrader.Custom

    what am i missing ?

    in addition the following command


    PlaySound(@"C:\mySound.wav");

    generate err :

    Error 644 The name 'PlaySound' does not exist in the current context d:\docs\Documents\NinjaTrader 8\bin\Custom\Indicators\Ace.cs 13477 21 NinjaTrader.Custom


    what am i missing again ?
    Last edited by doron; 04-11-2016, 11:01 AM.

    #2
    Hello doron,

    The Alert call does appear to be correct.

    Where was this placed? Is this code in a condition in OnBarUpdate?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      hi

      no it is called from OnMarketData

      please look also on the PlaySound err i added above

      Comment


        #4
        Hello doron,

        The call to PlaySound() also looks correct.

        Likely you have a syntax error in your script somewhere before (above where) these calls are being made.
        Without being able to see the code I would not be able to tell you what that syntax error is.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          hi
          It looks that both the call to the alert and to playsound has to be made from higher level in the script . any how problem is solved.


          What will happen if playsound or alert with sound will be activated in high rate , say rate that is shorter than the time needed to play the sound ?

          Do you have a que and the sound is played one after the other or sound will overlap ?

          Comment


            #6
            Hi doron,

            If a sound is played while another sound is playing, the sound will be interrupted. The first sound will stop and the second sound will start (because they run in a single thread).

            However, unless the script compiles the code in the script will not be run. From the errors you have posted in your previous email, where you able to find the syntax error that was preventing the script from compiling?

            If not, are you able to share this script on the forum?
            If so, please attach the .cs file to your next post.

            If you would like me to take a look privately you can send the script to platformsupport [at] ninjatrader [dot] com. In the email please include a link to this forum thread.
            Last edited by NinjaTrader_ChelseaB; 04-11-2016, 01:39 PM.
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Brevo, Today, 01:45 AM
            0 responses
            3 views
            0 likes
            Last Post Brevo
            by Brevo
             
            Started by aussugardefender, Today, 01:07 AM
            0 responses
            3 views
            0 likes
            Last Post aussugardefender  
            Started by pvincent, 06-23-2022, 12:53 PM
            14 responses
            238 views
            0 likes
            Last Post Nyman
            by Nyman
             
            Started by TraderG23, 12-08-2023, 07:56 AM
            9 responses
            384 views
            1 like
            Last Post Gavini
            by Gavini
             
            Started by oviejo, Today, 12:28 AM
            0 responses
            6 views
            0 likes
            Last Post oviejo
            by oviejo
             
            Working...
            X