Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Modify the volume spike indicator to include BB% and alert

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

    Modify the volume spike indicator to include BB% and alert

    I have installed the Volume Spike NT8 indicator, which I like for the most part, but I would like to combine with the BB%, so it would trigger on only extensions, say under 20 or over 80. Is there an easy way to do this with existing code, and can I set it so it's an alertable event?

    Or is it easier to combine in the alerts condition? I looked a this, but did not know how to get a trigger off the spike activation.



    #2
    Hello Delta_Man,

    Welcome to the NinjaTrader forums!

    Do you have a link to the script you are using?

    How do you combine the bollingerbands with the custom indicator?

    Are you wanting to add a condition for Bollinger(2, 14)[0] > 80 or Bollinger(2,14)[0] < 20 to the conditions?

    To trigger an alert call the Alert() method.
    Alert(string id, Priority priority, string message, string soundLocation, int rearmSeconds, Brush backBrush, Brush foreColor)


    Below is a link to a support article with helpful resources on getting started with C# and NinjaScript.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      This is the stock script
      This is a conversion of the Volume Spike indicator for NinjaTrader 7 requested on this forum thread, originally created by NinjaStrategyLoader.com and publicly available here.


      What I want to do is be able to filter out spike triggers based on the BB% level. Below, you can see the first one is in the middle, not where i want to trade, the second one is what i like. I tried to create an alert based on the spike indicator, but it does not appear in the alert window with the other indicators. If it could appear there, that would seem be the easiest way to add a bb condition.
      What I would like is to able to create ​
      Attached Files

      Comment


        #4
        Hello Delta_Man,

        The indicator you have provided a link to does not set any plots and cannot be used in the Alerts window.

        It sounds like you want to add Bollinger(2, 14)[0] > 80 or Bollinger(2, 14)[0] < 20 to the conditions.

        For example:

        if ( (Low[0]<=Low[1]) && (Low[0]<=Low[2]) &&
        (Close[0]>=Close[1]) && (Close[0]>=Open[0]) &&
        (Close[0]-Open[0])<(High[0]-Low[0]) &&
        (Volume[1]>MAX(Volume,Period)[2]) &&
        (Bollinger(2, 14)[0] > 80 || Bollinger(2, 14)[0] < 20)​

        You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like a list of affiliate consultants who would be happy to create this script or any others at your request or provide one on one educational services.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          OK, that code change sounds like what I want thx. Is there any way to change the original indicator to make it alertable?

          Comment


            #6
            Hello Delta_Man,

            To trigger an alert from the condition logic block call the Alert() method.
            Alert(string id, Priority priority, string message, string soundLocation, int rearmSeconds, Brush backBrush, Brush foreColor)
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hi Chelsea, what i want to use is the BB%, not Bollinger bands. Click image for larger version

Name:	Screenshot 2024-11-19 033721.jpg
Views:	262
Size:	101.2 KB
ID:	1325038

              Comment


                #8
                Also, I tried adding alert, but this does not load. What is wrong here? It was just a c/p, but it was hard to find examples to go off


                //HIGH VOLUME SPIKE SHORT SIGNAL
                if( (High[0]>=High[1]) && (High[0]>=High[2]) &&
                (Close[0]<=Close[1]) && (Close[0]<=Open[0]) &&
                ((Open[0]-Close[0])<(High[0]-Low[0])) &&
                (Volume[1]>MAX(Volume,Period)[2]) )
                {
                Alert("myAlert", Priority.High, "Reached threshold", NinjaTrader.Core.Globals.InstallDir+@"\sounds\Aler t1.wav", 10, Color.Black, Color.Yellow);
                BackBrush = Brushes.Crimson;
                }

                if( (High[0]<=High[1]) && (High[0]>=High[2]) &&
                (Close[0]<=Close[1]) && (Close[0]<=Open[0]) &&
                ((Open[0]-Close[0])<(High[0]-Low[0])) &&
                (Volume[1]>MAX(Volume,Period)[2]) )
                {
                BackBrush = Brushes.Red;
                }

                }
                }​​
                Last edited by Delta_Man; 11-19-2024, 05:24 AM.

                Comment


                  #9
                  Hello Delta_Man,

                  The alert would only be appearing in real-time when the condition evaluates as true, as alerts do not appear from historical.

                  Are you seeing the backbrush change to crimson in real-time?

                  Is the Alerts log window open before you start the script?

                  Have you compiled the changes and reloaded the script?
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    It won't load with that line, there's something not right in the alert line, but I can't find a good example to troubleshoot it.

                    Comment


                      #11
                      Hello Delta_Man,

                      Drawing tool methods, BackBrush, CandleOutlineBrush, Alert Brushes, Buttons, etc. are all WPF and will use Brush (System.Windows.Media.Brush) object types.

                      Change Color.Black to Brushes.Black. Change Color.Yellow to Brushes.Yellow.

                      Moving forward, please provide the full error text or a screenshot of the error for assistance with an error.
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #12
                        Click image for larger version

Name:	image.png
Views:	253
Size:	5.5 KB
ID:	1325084This is the error on import with that Alert line.​

                        Comment


                          #13
                          Hello Delta_Man,

                          Have you modified the code to use Brushes and not Colors?

                          May I confirm you have created the script and are coding this using the NinjaScript Editor?

                          Are you able to add the indicator to a chart?

                          What are you importing?
                          Chelsea B.NinjaTrader Customer Service

                          Comment


                            #14
                            OK double checked and had a syntax error, so the code loads now, and I deleted and reloaded indicator but I still don't see the alert available to meClick image for larger version  Name:	image.png Views:	0 Size:	9.2 KB ID:	1325095

                            Comment


                              #15
                              Hello Delta_Man,

                              The alert would only be appearing in real-time when the condition evaluates as true, as alerts do not appear from historical.

                              Is the indicator applied to the chart?

                              Are you seeing the backbrush change to crimson in real-time?

                              Is the Alerts log window open before you start the script?​
                              https://ninjatrader.com/support/helpGuides/nt8/index.html?using_the_alerts_log_window.htm#Underst andingTheAlertsLogWindow

                              Note, the indicator would be triggering the alert.
                              Chelsea B.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              590 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              342 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              103 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              555 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              552 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X