Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Request - HMA and Bollinger Bands In Single Indicator

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

    #16
    DrawText

    Hi,

    if (Close[0] > HMA(HMA1)[0]&& Close[0] > Bollinger(0.26, Bollinger1).Upper[0]
    && RSI50(Rsi, 9)[1] > RsiBuy))

    BarColor = Color.Blue;

    I want along with Bar coloring, Buy or Long text to appear below the bar when the conditions are met.

    Is there any scope to achieve this? My knowledge of coding is limited with which I could achieve certain tasks but this seems to be beyond my reach. Any help would be appreciated.

    Thanks in advance.

    Comment


      #17
      You could then just add something like the below to your condition to color the bar and draw the text for you - it will use the signal bar low - 2 ticks as Y value.

      DrawText("tag1" + CurrentBar, "BUY", 0, Low[0] - 2 * TickSize, Color.BlueViolet);

      Comment


        #18
        Originally posted by NinjaTrader_Bertrand View Post
        You could then just add something like the below to your condition to color the bar and draw the text for you - it will use the signal bar low - 2 ticks as Y value.

        DrawText("tag1" + CurrentBar, "BUY", 0, Low[0] - 2 * TickSize, Color.BlueViolet);
        Hello Bertrand,

        Thanks again.

        I am attaching 2 images: 1. with Heiken Ashi and 2 normal range bar charts; both with your buy/sell text.

        One of the key indicators in my HMA-BB system is Heiken Ashi. The text I reqd. mainly because I don't know how to code Heiken Ashi bars to change to respective, buy and sell colors when the conditions are met.

        Please let me know whether it is possible to make Heiken ashi bars to change to respective colors as is done with normal bars.

        Regards
        Attached Files

        Comment


          #19
          Hello psb1967,

          You would only be able to change the colors of the Heiken Ashi bars from the Indicators window under Visual. Note that you can create a new indicator with the orginal code from another indicator by going to the Control Center -> Tools -> Edit NinjaScript -> Indicators. Then double left click on the indicator that you want to have the orginal code from for example the "HeikenAshi". It will then open up the source code for the indicator. Right click inside the window and select Save As. Type in a name of your choosing then press "Save". Press the "OK" button as NinjaTrader will automattically rename them for you. Now you have a new indicator based off the system indicator code that you can modify to change the conditions.


          Please let me know if I can be of further assistance.
          JCNinjaTrader Customer Service

          Comment


            #20
            Originally posted by NinjaTrader_JC View Post
            Hello psb1967,

            You would only be able to change the colors of the Heiken Ashi bars from the Indicators window under Visual. Note that you can create a new indicator with the orginal code from another indicator by going to the Control Center -> Tools -> Edit NinjaScript -> Indicators. Then double left click on the indicator that you want to have the orginal code from for example the "HeikenAshi". It will then open up the source code for the indicator. Right click inside the window and select Save As. Type in a name of your choosing then press "Save". Press the "OK" button as NinjaTrader will automattically rename them for you. Now you have a new indicator based off the system indicator code that you can modify to change the conditions.


            Please let me know if I can be of further assistance.
            Hello JC,

            Kind of you to respond immediately as always.

            Actually my requirement is, as it usually happens in the bar or range bar charts, when it is long, the bar color changes to say, in this case Blue and for short Red when the respective conditions are met.

            Similarly, my question was, whether it is possible to make Heiken Ashi also to change its color automatically when respective conditions are met.

            I have attached my chart images for the reference.

            Regards

            Comment


              #21
              Hello psb1967,

              Since Heiken Ashi is going to be a system indicator you will not be able to change the source code. Therefore you would not be able to set conditions to change the color.

              With that said it would be possible to create a custom indicator that will be able to change the color based upon conditions.

              Please let me know if I can be of further assistance.
              JCNinjaTrader Customer Service

              Comment


                #22
                Originally posted by NinjaTrader_JC View Post
                Hello psb1967,

                Since Heiken Ashi is going to be a system indicator you will not be able to change the source code. Therefore you would not be able to set conditions to change the color.

                With that said it would be possible to create a custom indicator that will be able to change the color based upon conditions.

                Please let me know if I can be of further assistance.
                Thanks again JC.

                <<With that said it would be possible to create a custom indicator that will be able to change the color based upon conditions.>>

                This is encouraging to hear. Can you just guide me thru' as to how to make HA to change color as per the conditions in my strategy?


                Awaiting eagerly for your reply.

                Regards
                Last edited by psb1967; 07-27-2012, 04:46 PM.

                Comment


                  #23
                  Originally posted by psb1967 View Post
                  Hello Bertrand,

                  Thanks for your reply.

                  Although I am not a fan of auto strategy, I ventured into developing my first HMA-BB-RSI Strategy and it so happened it ended up if not exactly, almost the way I trade manually. Only I could not find a way to plot the text, Buy/Sell or arrows on the chart but managed with bar coloring respectively.

                  My conditions are: Price should Close above HMA & BB; 2. RSI should be above 50 for long and vice versa for short.

                  Humbling putting it, the credit goes to you for, I got full inspiration like last time with my MA crossover indicator, from you and you know how to make a novice like me who knows nothing about coding to come out with the desired results.

                  Yet another constraint I have to put up with, I have become used to having Haiken Ashi but now have to do away with it due to bar coloring.

                  Thanks again and pleasant weekend to you.
                  Hi There,

                  It's been a long time I was been using a similar kind of setup for trading only difference was I am using macd but the conditions are same for buy and sell as you have. It will be appreciated and great help to me if you can forward your indicator setup to me as I am not a programmer.my email I'd is [email protected], Thanks!

                  Comment


                    #24
                    Hello psb1967,

                    Sure, you can follow the steps in reply #19 to create a new indicator based on the HeikenAshi source code.

                    After you have created the new indicator under the Miscellaneous region inside the code you will see the public override void Plot where you can set the different conditions when painting the bars.

                    Please let me know if I can be of further assistance.
                    JCNinjaTrader Customer Service

                    Comment


                      #25
                      Originally posted by psb1967 View Post
                      Hi,

                      if (Close[0] > HMA(HMA1)[0]&& Close[0] > Bollinger(0.26, Bollinger1).Upper[0]
                      && RSI50(Rsi, 9)[1] > RsiBuy))

                      BarColor = Color.Blue;

                      I want along with Bar coloring, Buy or Long text to appear below the bar when the conditions are met.

                      Is there any scope to achieve this? My knowledge of coding is limited with which I could achieve certain tasks but this seems to be beyond my reach. Any help would be appreciated.

                      Thanks in advance.
                      Hi PSB1967, is that possible that you email a copy of your custom made indicator as I am not that sound with the programming, I tried alot make changes as mentioned by JC but ended up in too many errors since I have no knowledge to fix it all efforts are in vain, if so kindly able to forward your indicator will be great even if you post it on the forum many might be usefull. Thanks!

                      Comment


                        #26
                        Originally posted by NinjaTrader_JC View Post
                        Hello psb1967,

                        Sure, you can follow the steps in reply #19 to create a new indicator based on the HeikenAshi source code.

                        After you have created the new indicator under the Miscellaneous region inside the code you will see the public override void Plot where you can set the different conditions when painting the bars.

                        Please let me know if I can be of further assistance.
                        Hello JC,

                        Thanks for your immense cooperation and prompt reply.

                        This is getting more interesting and challenging than I thought.

                        I have created a new Heiken Ashi indicator and only could not proceed since I am confused whether I must place my HMA-BB-RSI strategy conditions #16 here so that as per the conditions the colors of Heiken Ashi will change.

                        I just would request you to clarify me, whether Heiken Ashi can be accommodated in my HMA-BB-RSI strategy and HA color can be changed accordingly.

                        Should I have to place my HMA-BB-RSI strategy conditions in the Heiken Ashi or the other way round?

                        I fully realize I am testing your patience but I can't help it since my coding knowledge is very much limited and thanks to Bertrand I managed to learn something.

                        Awaiting for your reply.
                        Last edited by psb1967; 07-30-2012, 09:18 AM.

                        Comment


                          #27
                          Originally posted by sorhash View Post
                          Hi PSB1967, is that possible that you email a copy of your custom made indicator as I am not that sound with the programming, I tried alot make changes as mentioned by JC but ended up in too many errors since I have no knowledge to fix it all efforts are in vain, if so kindly able to forward your indicator will be great even if you post it on the forum many might be usefull. Thanks!
                          Hello Sorhash,

                          I am sorry I could not reply since I myself was terribly busy with others things.

                          I had no problem in including JC's DrawText code and it worked like a baby. Just to clarify I am making all these changes in my HMA-BB-RSI strategy not in my indicator. I am yet to try to do the same in my indicator, if necessary and time permits.

                          I will surely email my strategy to you soon.

                          Regards

                          Comment


                            #28
                            Originally posted by psb1967 View Post
                            Hello Sorhash,

                            I am sorry I could not reply since I myself was terribly busy with others things.

                            I had no problem in including JC's DrawText code and it worked like a baby. Just to clarify I am making all these changes in my HMA-BB-RSI strategy not in my indicator. I am yet to try to do the same in my indicator, if necessary and time permits.

                            I will surely email my strategy to you soon.

                            Regards
                            Thanks for your early reply and appreciate for your kindness, you can email it on [email protected]. Thanks in Advance!

                            Comment


                              #29
                              Hello psb1967,

                              Yes, you would put your conditions inside your new Heiken Ashi indicator. Basically, you would replace the following code:

                              Code:
                              public override void Plot(Graphics graphics, Rectangle bounds, double min, double max)
                              {
                              (...)
                              if (y4 > y1)
                                   graphics.FillRectangle(brushDown, x - barPaintWidth / 2, y1, barPaintWidth, y4 - y1);
                              (...)
                              }
                              With the conditions that you would like to have them meet like "if (Close[0] > HMA(HMA1)[0]&& Close[0] > Bollinger(0.26, Bollinger1).Upper[0] && RSI50(Rsi, 9)[1] > RsiBuy))".

                              Only thing to note with that is that it looks like you have a few defined variable that you would have to create inside this indicator like you did in your strategy.


                              You would not be able to accommodate the Heiken Ashi inside your strategy because it used the override Plot() method to change the colors of the Bars and you will not be able to access the override Plot() method inside of a strategy.

                              If you want the bars to change color based upon your conditions then you would place the HMA-BB-RSI conditions inside the new Heiken Ashi indicator that you created yes.

                              Please let me know if I can be of further assistance.
                              JCNinjaTrader Customer Service

                              Comment


                                #30
                                Originally posted by NinjaTrader_Bertrand View Post

                                Plot1.Set(Bollinger(Close, 2, 20).Upper[0]);
                                Plot2.Set(Bollinger(Close, 2, 20).Lower[0]);
                                Plot3.Set(Bollinger(Close, 2, 20).Middle[0]);[/CODE]
                                So I have to ask. Isn't that code performing the entire BB calculation from a series THREE separate times? One complete calculation for each of upper, lower, then middle? Isn't there some way for greater efficiency sake to calculate the BB result only once, and then pull the three needed values (upper,lower,middle) from the results of that single calculation?

                                Thanks....

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                                0 responses
                                600 views
                                0 likes
                                Last Post Geovanny Suaza  
                                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                                0 responses
                                347 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
                                558 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by RFrosty, 01-28-2026, 06:49 PM
                                0 responses
                                558 views
                                1 like
                                Last Post RFrosty
                                by RFrosty
                                 
                                Working...
                                X