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

Volume Spike Indicator

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

    #16
    Originally posted by NinjaTrader_Bertrand View Post
    Sorry I'm not following you, with key off I meant for your signal / alert the trend series offered is then where you want to work with closely, as it would directly offer you what's needed to setup the alert condition. The snippet I've shown could be entered for example in the OnBarUpdate() below the paint bar condition.

    Thanks,so for the DownSwing i`d need to add the appropriate line?

    Comment


      #17
      Correct. Just the opposing condition then...
      BertrandNinjaTrader Customer Service

      Comment


        #18
        Originally posted by NinjaTrader_Bertrand View Post
        Correct. Just the opposing condition then...
        Ok,i did as you suggested,and now i get an alert on each and every tick

        here`s the snippet:

        {
        if (Trend[0] == 1 && Trend[1] == -1)
        Alert("myAlert1", NinjaTrader.Cbi.Priority.High, "up swing", "LB.wav", 10, Color.Black, Color.Yellow);
        Alert("myAlert1", NinjaTrader.Cbi.Priority.High, "down swing", "LB.wav", 10, Color.Black, Color.Yellow);
        if(CurrentBar == 0)
        {
        Trend.Set(Close[0] >= Open[0] ? 1 : -1);
        Value.Set(Trend[0] == 1 ? Low[0] : High[0]);
        return;
        }

        Comment


          #19
          if (Trend[0] == 1 && Trend[1] == -1)
          Alert("myAlert1", NinjaTrader.Cbi.Priority.High, "up swing", "LB.wav", 10, Color.Black, Color.Yellow);
          Alert("myAlert1", NinjaTrader.Cbi.Priority.High, "down swing", "LB.wav", 10, Color.Black, Color.Yellow);

          I would not expect that part to work, the second statement will be evaluated at each OnBarUpdate() call, you also did not add the proper opposing condition for the short swing in here?

          Would try something like at the bottom of the OnBarUpdate(), below the paint bar code and outside of any other condition -

          if (Trend[0] == 1 && Trend[1] == -1)
          Alert("myAlert1", NinjaTrader.Cbi.Priority.High, "up swing", "Alert1.wav", 10, Color.Black, Color.Yellow);
          else if (Trend[0] == -1 && Trend[1] == 1)
          Alert("myAlert2", NinjaTrader.Cbi.Priority.High, "dn swing", "Alert1.wa", 10, Color.Black, Color.Yellow);
          BertrandNinjaTrader Customer Service

          Comment


            #20
            Originally posted by NinjaTrader_Bertrand View Post
            if (Trend[0] == 1 && Trend[1] == -1)
            Alert("myAlert1", NinjaTrader.Cbi.Priority.High, "up swing", "LB.wav", 10, Color.Black, Color.Yellow);
            Alert("myAlert1", NinjaTrader.Cbi.Priority.High, "down swing", "LB.wav", 10, Color.Black, Color.Yellow);

            I would not expect that part to work, the second statement will be evaluated at each OnBarUpdate() call, you also did not add the proper opposing condition for the short swing in here?

            Would try something like at the bottom of the OnBarUpdate(), below the paint bar code and outside of any other condition -

            if (Trend[0] == 1 && Trend[1] == -1)
            Alert("myAlert1", NinjaTrader.Cbi.Priority.High, "up swing", "Alert1.wav", 10, Color.Black, Color.Yellow);
            else if (Trend[0] == -1 && Trend[1] == 1)
            Alert("myAlert2", NinjaTrader.Cbi.Priority.High, "dn swing", "Alert1.wa", 10, Color.Black, Color.Yellow);
            No,same result.

            Comment


              #21
              On which CalculateOnBarClose setting do you run this?
              BertrandNinjaTrader Customer Service

              Comment


                #22
                Originally posted by NinjaTrader_Bertrand View Post
                On which CalculateOnBarClose setting do you run this?
                '''''''False''''''''

                Comment


                  #23
                  Thanks, that would explain it - then I would suggest including a check to FirstTickOfBar in your Alert conditions.

                  if (Trend[0] == 1 && Trend[1] == -1 && FirstTickOfBar)
                  Alert("myAlert1", NinjaTrader.Cbi.Priority.High, "up swing", "Alert1.wav", 10, Color.Black, Color.Yellow);
                  else if (Trend[0] == -1 && Trend[1] == 1 && FirstTickOfBar)
                  Alert("myAlert2", NinjaTrader.Cbi.Priority.High, "dn swing", "Alert1.wav", 10, Color.Black, Color.Yellow);
                  BertrandNinjaTrader Customer Service

                  Comment


                    #24
                    Originally posted by NinjaTrader_Bertrand View Post
                    Thanks, that would explain it - then I would suggest including a check to FirstTickOfBar in your Alert conditions.

                    if (Trend[0] == 1 && Trend[1] == -1 && FirstTickOfBar)
                    Alert("myAlert1", NinjaTrader.Cbi.Priority.High, "up swing", "Alert1.wav", 10, Color.Black, Color.Yellow);
                    else if (Trend[0] == -1 && Trend[1] == 1 && FirstTickOfBar)
                    Alert("myAlert2", NinjaTrader.Cbi.Priority.High, "dn swing", "Alert1.wav", 10, Color.Black, Color.Yellow);
                    It seems to be working this way.Thank you for your assistance!

                    Comment


                      #25
                      Originally posted by SnakeEYE View Post
                      It seems to be working this way.Thank you for your assistance!
                      Excuse me,
                      when copying this snippet, I get the error "Trend doesn't exist in this context".
                      Why ?
                      Last edited by fliesen; 03-08-2014, 04:00 AM.

                      Comment


                        #26
                        Originally posted by fliesen View Post
                        Excuse me,
                        when copying this snippet, I get the error "Trend doesn't exist in this context".
                        Why ?
                        ...because you took it out of context here, the full indicator should be in post 12 of this thread.
                        BertrandNinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by haas88, 03-21-2024, 02:22 AM
                        18 responses
                        208 views
                        0 likes
                        Last Post haas88
                        by haas88
                         
                        Started by Board game geek, Today, 02:20 AM
                        0 responses
                        2 views
                        0 likes
                        Last Post Board game geek  
                        Started by knighty6508, Today, 01:20 AM
                        2 responses
                        14 views
                        0 likes
                        Last Post knighty6508  
                        Started by franatas, Today, 01:53 AM
                        0 responses
                        3 views
                        0 likes
                        Last Post franatas  
                        Started by knighty6508, Today, 01:17 AM
                        0 responses
                        9 views
                        0 likes
                        Last Post knighty6508  
                        Working...
                        X