• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to play a sound alert when EMA turns up or down

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

    How to play a sound alert when EMA turns up or down

    Hi,
    I'm new to Ninja Script and what I need is a piece of code which I could insert to a custom indicator in NinjaScript editor. I need EMA_Slope_Color indicator (or any other indicator as well) to play a sound alert when it turns from up to down or from down to up (= when it changes color). Staring monitor makes my eyes sore and you can't do that for a long time. Can anybody please help me with this? I have tried this myself for 2 days now but haven't been able to figure it out.

    Thanks

    #2
    Hello Masav,
    Welcome to the forum and I am happy to assist you.

    If you try the below code then are you able to trigger the alert as per your specifications.

    Code:
    if (CurrentBar < 2) return;
    if (Rising(EMA(14)) && EMA(14)[2] > EMA(14)[1])
    {
    	//do something
    }
    else if (Falling(EMA(14)) && EMA(14)[2] < EMA(14)[1])
    {
    	//do something
    }
    http://www.ninjatrader.com/support/h...tml?rising.htm
    http://www.ninjatrader.com/support/h...ml?falling.htm
    http://www.ninjatrader.com/support/h...html?alert.htm
    JoydeepNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by RB104, Today, 06:06 PM
    1 response
    8 views
    0 likes
    Last Post NinjaTrader_ShawnB  
    Started by jtrading82, 05-25-2018, 09:59 AM
    9 responses
    977 views
    0 likes
    Last Post NinjaTrader_ShawnB  
    Started by syxforex, Today, 12:11 AM
    2 responses
    15 views
    0 likes
    Last Post syxforex  
    Started by aslane, Today, 02:31 PM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_Kate  
    Started by stoner, 10-16-2019, 01:38 PM
    5 responses
    51 views
    0 likes
    Last Post sledge
    by sledge
     
    Working...
    X