Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Get alert when swing high or low got broken

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

    Get alert when swing high or low got broken

    I was trying to set alert when current price passes through swing high or low. I guess ninjatrader set indicator plot swing high or low to a null value or something that it can't be compared to an integer. I am not much of a coder and was looking at it using ninjascript editor. I actually wanted to combine that with some other condition such as cumulative delta to form an alert. So I need either the value of the latest high/low to persist temporarily until a new high/low is formed or a true/false condition if the high/low got broken to be accessible to the ninjatrader alert system.​
    Last edited by flybuzz; 09-11-2022, 01:10 PM.

    #2
    You can see if the indie can help, it has an alert function in the swing levels when these have been reached.

    NT8 Indicator Update: SwingRays2 - NinjaTrader Support Forum

    Comment


      #3
      Originally posted by LoganJKTrader View Post
      You can see if the indie can help, it has an alert function in the swing levels when these have been reached.

      NT8 Indicator Update: SwingRays2 - NinjaTrader Support Forum
      Thank you for the response, I actually wanted to combine that with some other condition such as cumulative delta to form an alert. So I need either the value of the high/low to persist after it got broken or a true/false condition if the high/low got broken to be accessible to the ninjatrader alert system. I will update the original post.

      Comment


        #4
        Hello flybuzz,

        You are correct about the swing and how it has null values, this indicator actually has special methods to access its data so that you can get a continuous value.



        For example:

        Print("The high of the swing bar is " + High[Math.Max(0, Swing(5).SwingHighBar(0, 1, 10))]);

        SwingHighBar is used to get the BarsAgo from the swing, you can then use that value to get the value on each bar where it would not be set before the next swing.


        Code:
        double highBar = Swing(5).SwingHighBar(0, 1, 10); 
        double lowBar = Swing(5).SwingLowBar(0, 1, 10); 
        
        double highValue = High[highBar];
        double lowValue = Low[highBar];




        Comment


          #5
          Thank you Jesse for your response. pardon me for sounding stupid, but how do I pass those values to alert system so under indicator plot I can select them?



          Originally posted by NinjaTrader_Jesse View Post
          Hello flybuzz,

          You are correct about the swing and how it has null values, this indicator actually has special methods to access its data so that you can get a continuous value.



          For example:

          Print("The high of the swing bar is " + High[Math.Max(0, Swing(5).SwingHighBar(0, 1, 10))]);

          SwingHighBar is used to get the BarsAgo from the swing, you can then use that value to get the value on each bar where it would not be set before the next swing.


          Code:
          double highBar = Swing(5).SwingHighBar(0, 1, 10);
          double lowBar = Swing(5).SwingLowBar(0, 1, 10);
          
          double highValue = High[highBar];
          double lowValue = Low[highBar];



          Comment


            #6
            hello flybuzz,

            You would need to create an indicator in order to do that. Inside the indicators OnBarUpdate area you can use that code to get the swing values. If you are just looking to plot the values for the alert system you can replot those values using Plots and AddPlot: https://ninjatrader.com/support/help...ghtsub=addplot




            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