Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

bollinger percent up/down arrow plotting

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

    bollinger percent up/down arrow plotting

    Is there someone here that could program this indicator to plot a arrow on the chart when bollingerpercet histogram passes 20% & down arrow when falls below 80%(or even bar changes color when these conditions meet). I have looked all over to code but can't seem to figure this out.I know alot of traders are here to help & I would really appreciate any sort of help, or even how i could do it myself. I have zero programing experience, but i can follow instructions if i had to do it myself.

    Thanks in advance
    Acura
    Attached Files

    #2
    acura,

    The methods you are looking for are below.





    You can simply use if( ) statements to test when a condition is true then use the aforementioned methods.

    Here is a link to our help guide educational resources :



    You can also contact a NinjaScript consultant and see if they can help you.

    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Ninja Crashes after this code. I know im wrong but dunno where?


      /// <summary>
      /// Called on each bar update event (incoming tick)
      /// </summary>
      protected override void OnBarUpdate()
      {
      PctB.Set(((Input[0] - Bollinger(StandardDev, Period).Lower[0]) / (Bollinger(StandardDev, Period).Upper[0] - Bollinger(StandardDev, Period).Lower[0])) * 100);

      if (CrossAbove(BollingerPercentB(20, 2).PctB, BollingerPercentB(20, 2).PctB, 1))
      {
      DrawArrowUp("UpArrow" + CurrentBar, false, 0, 0, Color.Blue);
      }

      Comment


        #4
        Hello,

        You do not want to have an indicator call itself to rerun itself and put itself into and endless loop.


        You would want to access the local variable since the indicator is already running.

        if (CrossAbove(BollingerPercentB(20, 2).PctB, BollingerPercentB(20, 2).PctB, 1))

        Change to

        if (CrossAbove(PctB[0], PctB[0], 1))

        Comment


          #5
          this is the error msg i get when i try to compile
          Attached Files

          Comment


            #6
            Hello,

            Can you attach the full .cs file on here so I can take a quick look at it. I dont see anything off hand but I suspect PctB and how it is declared earlier in the code.

            -Brett

            Comment


              #7
              Thanks Brett

              Ive attached the .cs file.
              Attached Files

              Comment


                #8
                Hello,

                Thanks for that.

                The reason why it is doing this is the first data series is the same for the secondand series and I guess it checks for this. It needed another data series for the second one.

                What two values are you trying to have cross over. Right now your code is trying to check againt PctB and PctB which will never occur because they both have the same values and as such you have the compile error.

                -Brett

                Comment


                  #9
                  to plot a arrow on the chart when bollingerpercet histogram passes 20 & down arrow when falls below 80(or even bar changes color when these conditions meet).


                  Thanks

                  Acura

                  Comment


                    #10
                    In this case

                    if (CrossAbove(20, PctB[0], 1))

                    Will do the trick for the 20 cross, do the same for the 80 cross if statement.

                    -Brett

                    Comment


                      #11
                      I really dumb when it comes to all this, I appreciate all your time & effort with this.

                      Thanks

                      Acura
                      Attached Files

                      Comment


                        #12
                        Hello,

                        I did mine with SMA() in my test and did not notice apologize about that.

                        When I used yours I then needed to use it as such:

                        if (CrossAbove(20, PctB, 1))

                        Let me know if I can be of further assistance.

                        Comment


                          #13
                          Brett im sorry i keep bugging you with this.
                          ive attached a chart with manually drawn arrows on the chart. This is the way I would like the Bollinger to plot arrows on the Chart.

                          thanks

                          Acura
                          Attached Files

                          Comment


                            #14
                            Hello,

                            You would change your draw arrow line to the following:

                            DrawArrowUp("UpArrow" + CurrentBar, false, 0, Low[0], Color.Blue);

                            Then you will want to add a second indicator to your chart and set it to Panel 0 the primary bars panel and then set the plots colors to be transparent so that it does not plot anything and only draws the arrows in the primary series.


                            -Brett

                            Comment


                              #15
                              Make sure the plot panel is same as input series and the scale justification is set to right.

                              -Brett

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by trilliantrader, 04-18-2024, 08:16 AM
                              5 responses
                              22 views
                              0 likes
                              Last Post trilliantrader  
                              Started by Davidtowleii, Today, 12:15 AM
                              0 responses
                              3 views
                              0 likes
                              Last Post Davidtowleii  
                              Started by guillembm, Yesterday, 11:25 AM
                              2 responses
                              9 views
                              0 likes
                              Last Post guillembm  
                              Started by junkone, 04-21-2024, 07:17 AM
                              9 responses
                              69 views
                              0 likes
                              Last Post jeronymite  
                              Started by mgco4you, Yesterday, 09:46 PM
                              1 response
                              12 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Working...
                              X