Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

EMA Price Alert

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

    EMA Price Alert

    Hello Community,

    I need help with a simple indicator idea. I have tried to use the tools myself but it is not making sense. My overall goal for the indicator is to alert me via text and or email when the price closes above 5EMA displacement 2 or when it closes below. In real-time not delay. I would like it to be customizable. I have what I tried to do in the attachments. Thanks folks
    Attached Files

    #2
    Hello wealthcig,

    Thank you for the post.

    I would suggest as a starting point for this type of alert to take a look at the SampleMACrossOver strategy. The way the indicators are added and used in that script would essentially be what you would need to create an alert. That code can be used in an indicator besides the order submission parts.

    Another easy way to get this script started is to use the strategy builder to create the EMA condition you wanted and then click View Code. The Conditions and Indicator setup could be copied into an indicator and used in the same way.

    displacement 2
    If you mean the displacement property from the user interface that is not used in NinjaScript, you would need to use 0 displacement on the chart and see when the condition actually becomes true. Based on that observation you could make a condition that uses a number of BarsAgo if you need to check something other than the current bar.
    If you otherwise mean to look 2 bars back that would be 2 BarsAgo when configuring using the builder or [2] when using any series.

    when the price closes ... in real-time not delay
    If you want to do something in realtime but when the price closes that presents a problem. You can either do the cross condition OnEachTick to check constantly or OnBarClose to check it when the price closes. To do the alert without delay would require using OnEachTIck. You would also need to add some logic to make sure it only alerts you once per bar because the condition may become true many times in a bar when using OnEachTick.


    Comment


      #3
      I will give the crossover strategy a try as a starting point and see where I end up. Thanks Jesse

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      647 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      369 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      108 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      572 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      573 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X