• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Change in colors intrabar question

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

    Change in colors intrabar question

    Hello All,

    as is known, volume changes colors according to the price bar/candle/etc...Change occurs at doji.The question is,how do i have the first color the bar/volume paint in the background regardles of its next changes at doji?

    Here`s the code example.I`m trying this,but the colors in the background are still changing;

    Code:
    if(Values[0][1] < Values[7][1] && Values[1][0] > Values[4][0] && ExtrnColor[0] == 1){
    					BackColor = Color.FromArgb(50, Color.Black);}
    else if(Values[0][1] < Values[7][1] && Values[1][0] > Values[4][0] && ExtrnColor[0] == -1){
    					BackColor = Color.FromArgb(50, Color.Red);}

    #2
    Hello,

    Just to clarify, are you saying that if a bar heads upward, turning the backColor green (or any other color representing an up bar), then starts to head lower than its opening price within the same bar, that you would like the backColor to stay green, rather than switching and ending up red (or any other color representing a down bar) after the bar closes down?
    Dave I.NinjaTrader Product Management

    Comment


      #3
      Originally posted by NinjaTrader_Dave View Post
      Hello,

      Just to clarify, are you saying that if a bar heads upward, turning the backColor green (or any other color representing an up bar), then starts to head lower than its opening price within the same bar, that you would like the backColor to stay green, rather than switching and ending up red (or any other color representing a down bar) after the bar closes down?
      Hi Dave,

      yes,exactly.Bar on the way up and touches(EMA,for e.g.),and greenish,i want the greenish color to stick to the background,regardles if it suddenly gets bavk to the openenig,crosses the doji,and becomes redish now.

      The snippet i provided doesn`t work.It`s still changing background colors at doji.

      Comment


        #4
        Hey guys, i know your all excited about your new toy,but could you plese share some of you precious time for those who aren`t yet?

        Thank you

        Comment


          #5
          Hello,

          Please note that our regular support hours are 9am to 6pm EST, Monday through Friday. However, threads remain open in the discussion forum to allow other users to reply.

          You should be able to prevent this by setting a bool to true when the color has been changed, then changing it back to false on the first tick of the next bar, then adding a check for this variable in the condition that sets backColor. You can check the boolean value of FirstTickOfBar to determine when a new bar begins.
          Dave I.NinjaTrader Product Management

          Comment


            #6
            Originally posted by NinjaTrader_Dave View Post
            Hello,

            Please note that our regular support hours are 9am to 6pm EST, Monday through Friday. However, threads remain open in the discussion forum to allow other users to reply.

            You should be able to prevent this by setting a bool to true when the color has been changed, then changing it back to false on the first tick of the next bar, then adding a check for this variable in the condition that sets backColor. You can check the boolean value of FirstTickOfBar to determine when a new bar begins.
            Hi Dave,

            can you please provide some pseudo example for this snippet?

            Code:
            if(Values[0][1] < Values[7][1] && Values[1][0] > Values[4][0] && ExtrnColor[0] == 1){
            					BackColor = Color.FromArgb(50, Color.Black);}
            else if(Values[0][1] < Values[7][1] && Values[1][0] > Values[4][0] && ExtrnColor[0] == -1){
            					BackColor = Color.FromArgb(50, Color.Red);}
            Thanks

            Comment


              #7
              Sure thing. I'm thinking something like this:

              Code:
              private bool backColorChanged = false;
              
              protected override void OnBarUpdate() {
                 if (FirstTickOfBar) backColorChanged = false;
              
                          if (Values[0][1] < Values[7][1] && Values[1][0] > Values[4][0] && ExtrnColor[0] == 1 && backColorChanged == false)
                          {
                              BackColor = Color.FromArgb(50, Color.Black);
                              backColorChanged = true;
                          }
                          else if (Values[0][1] < Values[7][1] && Values[1][0] > Values[4][0] && ExtrnColor[0] == -1 && backColorChanged == false)
                          {
                              BackColor = Color.FromArgb(50, Color.Red);
                              backColorChanged = true;
                          }
              }
              Dave I.NinjaTrader Product Management

              Comment


                #8
                Originally posted by NinjaTrader_Dave View Post
                Sure thing. I'm thinking something like this:

                Code:
                private bool backColorChanged = false;
                
                protected override void OnBarUpdate() {
                   if (FirstTickOfBar) backColorChanged = false;
                
                            if (Values[0][1] < Values[7][1] && Values[1][0] > Values[4][0] && ExtrnColor[0] == 1 && backColorChanged == false)
                            {
                                BackColor = Color.FromArgb(50, Color.Black);
                                backColorChanged = true;
                            }
                            else if (Values[0][1] < Values[7][1] && Values[1][0] > Values[4][0] && ExtrnColor[0] == -1 && backColorChanged == false)
                            {
                                BackColor = Color.FromArgb(50, Color.Red);
                                backColorChanged = true;
                            }
                }
                Thanks,Dave,

                i`m going to try it.

                Best!

                Comment


                  #9
                  Hi Dave,

                  the idea doesn`t work.The background colors still alternate,as the bar futher develops.

                  Comment


                    #10
                    Hi Dave,i found the way to make it workable as i needed to,without setting the bool flag you`ve suggested.The problem now,is that the background colors disappear after i hit F5.

                    Any ideas?

                    Comment


                      #11
                      Hello,

                      That does sound odd. That would mean that, for whatever reason, your indicator is not performing all of its logic when it is re-loaded. If you are willing to share your script with me, I'll be happy to test it out on my end and see what might be causing the trouble. Feel free to send it to platform support via email and reference ticket # 1312732, if you would like to keep it out of the forum.
                      Dave I.NinjaTrader Product Management

                      Comment


                        #12
                        Hello,

                        Thank you for your patience. After testing a bit, I cannot seem to reproduce the results you are seeing. The background regions seem to be drawing as expected, and they persist when I reload all NinjaScript on the chart by pressing F5 or using the right-click context menu.

                        Can you think of any other variables in play that I may need to do or set up in order to reproduce the issue? Do you see the same issue on a chart with only this one indicator applied?
                        Dave I.NinjaTrader Product Management

                        Comment


                          #13
                          Originally posted by NinjaTrader_Dave View Post
                          Hello,

                          Thank you for your patience. After testing a bit, I cannot seem to reproduce the results you are seeing. The background regions seem to be drawing as expected, and they persist when I reload all NinjaScript on the chart by pressing F5 or using the right-click context menu.

                          Can you think of any other variables in play that I may need to do or set up in order to reproduce the issue? Do you see the same issue on a chart with only this one indicator applied?
                          Hi Dave,the background is colore according to the Volume bar value on close,which is exposed as the Values[0].I need it to be colored using Predicted volume on COBC = false,which is exposed as the Values[1].

                          Can you please double check it?

                          Comment


                            #14
                            Hello,

                            You bet, but I'll need to know a little more about exactly what is expected. Can you take a look at the screenshot below and tell me exactly where these backColor changes should have occurred?

                            http://screencast.com/t/VlXw3wWwT
                            Dave I.NinjaTrader Product Management

                            Comment


                              #15
                              Originally posted by NinjaTrader_Dave View Post
                              Hello,

                              You bet, but I'll need to know a little more about exactly what is expected. Can you take a look at the screenshot below and tell me exactly where these backColor changes should have occurred?

                              http://screencast.com/t/VlXw3wWwT
                              Hi Dave,

                              The prior bar is below the threshold(which is Values[7] and the bar with the colored background is Above the threshold(which is Values[7],as well)which is you did`nt activate,btw.It all occured on the Bar[0] on the bar closed.What i need is,to color the background when the Predicted volume touches the threshold.Predicted volume value exposed as the Values[1]

                              There is a problem though,which i described many many many times.The background colors disappear as soon as you hit F5,no matter if you use Predicted volume value or simple volume bar on close.

                              Hope that helps.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by ntbone, Yesterday, 09:54 PM
                              0 responses
                              6 views
                              0 likes
                              Last Post ntbone
                              by ntbone
                               
                              Started by rwilliam, Yesterday, 03:14 PM
                              0 responses
                              8 views
                              0 likes
                              Last Post rwilliam  
                              Started by rwilliam, Yesterday, 03:10 PM
                              1 response
                              7 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by rontronimous, Yesterday, 03:04 PM
                              2 responses
                              12 views
                              0 likes
                              Last Post rontronimous  
                              Started by zacharydw00, Yesterday, 03:14 PM
                              0 responses
                              9 views
                              0 likes
                              Last Post zacharydw00  
                              Working...
                              X