• 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

BetterVolume w/ UP/DOWN bars

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

    #16
    Originally posted by jupiejupe View Post
    here the cool export of v003 with the two colour error as it is missing the others
    jupiejupe,

    Your Values[x] in your code must match the values[x] defined in the properties section or they will not show up on your charts.

    click the plus sign on properties to see what I am talking about.

    This is great experience for you. I had to learn the hard way.

    RJay
    RJay
    NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

    Comment


      #17
      You need to fix the compiler errors, statements like this:

      if ( CurrentBar < 1);

      will not work.

      Regards
      Ralph

      Comment


        #18
        tweaking the "bc's" either way did not solve the issue.

        i think i found the problem, i do not see any logic after this to say what to do if currentbar is greater than logic.

        if ( Currentbar < 1);

        Comment


          #19
          Curly Brackets again!!

          ---------------------------------------------------

          if ( CurrentBar < 1); <-- Also, remove this semicolon!!!!

          {

          range = High[0] - Low[0];
          VolEMA.Set(v);
          return;
          }

          ---------------------------------------------------
          RJay
          NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

          Comment


            #20
            Originally posted by Ralph View Post
            You need to fix the compiler errors, statements like this:

            if ( CurrentBar < 1);

            will not work.

            Regards
            Ralph
            there are no compile errors, i fixed them all, it even runs on the chart. what ever the problem it's in runtime.

            Comment


              #21
              sweet fix again, i'll go thur and proof all the colours that did not show up, most of them, and the ema come on, so cheers.

              Comment


                #22
                quick question what's the use of the semicolon?
                each colour had one i have most working allready.

                Comment


                  #23
                  It is amazing, but you are right, statements like:

                  if ( CurrentBar < 1);

                  are formally legal syntax in c#.
                  Looks dangerous to me. Review your code carefully, such statements can make a big difference. Your last code example contains some of them.

                  Regards
                  Ralph

                  Comment


                    #24
                    Originally posted by jupiejupe View Post
                    quick question what's the use of the semicolon?
                    each colour had one i have most working allready.
                    It signals the end of statement action. Thats why it didn't execute the following commands now contained inside the curly brackets for the currentbar criteria.
                    Last edited by RJay; 08-28-2009, 10:13 AM.
                    RJay
                    NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

                    Comment


                      #25
                      Hey,

                      Anyone know what this means in the Bettervolume indicator:


                      vwt = 2.0 / (10.0 * lookback + 1.0); // bar average period is 10*lookback


                      What is vwt? Why 2 divided by (10*lookback+1)

                      thanks

                      Comment


                        #26
                        Originally posted by velocity View Post
                        Hey,

                        Anyone know what this means in the Bettervolume indicator:


                        vwt = 2.0 / (10.0 * lookback + 1.0); // bar average period is 10*lookback


                        What is vwt? Why 2 divided by (10*lookback+1)

                        thanks


                        Velocity,

                        Here is the formula for EMA

                        Look familiar...


                        Value.Set(Input[0] * (2.0 / (1 + Period)) + (1 - (2.0 / (1 + Period))) * Value[1]);

                        RJay
                        RJay
                        NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

                        Comment


                          #27
                          okay here's the issuse, all the colours are now working, aside from 2 which are a group (up & down for the same class of volume).

                          i have isolated the problem but have not the coding skills need to fix, it's funny how debugging code is much like debugging cnc machines, i can find the problem just do not know what to do once i get there.

                          here's the og logic: // i bold red is the line of code that had been isolated via the {} i have entered into the new code because it had to choose between "if & else". i believe now the chart does not know how to get the lookback period to colour code these bars.

                          og code:

                          {
                          double range, v = Volume[0];
                          if ( CurrentBar < 1)
                          {
                          range = High[0] - Low[0];
                          VolEMA.Set(v);
                          return;
                          }
                          range = useTrueRange ?
                          Math.Max(High[0], Close[1]) - Math.Min(Low[0], Close[1]) // use true range
                          : High[0] - Low[0]; // use normal range
                          VolEMA.Set(vwt * (v - VolEMA[1]) + VolEMA[1]); // faster than SMA

                          int cc = 0; // climax churn detection
                          int bc = 0; // bar color, default 0 (normal volume bar)

                          vxr.Set(v * range);
                          vdr.Set((range != 0.0) ? v / range : 0.0);
                          if (v == MIN(Volume, lookback)[0]) bc = 1; //LowBar;
                          if (vxr[0] == MAX(vxr, lookback)[0]) { bc = 2; ++cc; } //ClimaxBar
                          if (vdr[0] == MAX(vdr, lookback)[0]) { bc = 3; ++cc; } //ChurnBar
                          if (cc == 2) bc = 4; //ClimaxChurnBar;
                          if (vdr[0] == MIN(vdr, lookback)[0]) bc = 5; //LowChurnBar



                          so i have commented out some of the things i have tried to get the code to compile, and show the purple bars which or the climaxchurnbar up & down. i have been trying to get cc paired with lookback. this is beyond me as i have no coding skills just fumbling, if someone is kind hearted enough to spell it out, i am move than happy to suffer through attemping to figure it out. if someone is so generous as to get'er done i thank you now. as i'll start my next project.


                          new code:


                          {
                          if (Close[0] > Open[0])
                          Values[0].Set(Volume[0]);

                          else
                          Values[1].Set(Volume[0]);


                          double range, v = Volume[0];
                          if ( CurrentBar < 1)
                          {
                          range = High[0] - Low[0];
                          VolEMA.Set(v);
                          return;
                          }

                          range = useTrueRange ?
                          Math.Max(High[0], Close[1]) - Math.Min(Low[0], Close[1]) // use true range
                          : High[0] - Low[0]; // use normal range
                          VolEMA.Set(vwt * (v - VolEMA[1]) + VolEMA[1]); // faster than SMA

                          int cc = 0; // climax churn detection
                          int bc = 0; // bar color, default 0 (normal volume bar)

                          vxr.Set(v * range);
                          vdr.Set((range != 0.0) ? v / range : 0.0);

                          if (v == MIN(Volume, lookback)[0]) //LowBar
                          {
                          if (Close[0] > Open[0])
                          {
                          Values[2].Set(Volume[0]);
                          }
                          else
                          {
                          Values[3].Set(Volume[0]);
                          }
                          }

                          if (vxr[0] == MAX(vxr, lookback)[0]) //ClimaxBar
                          {
                          if (Close[0] > Open[0])
                          {
                          bc += cc;
                          Values[4].Set(Volume[0]);
                          }
                          else
                          {
                          Values[5].Set(Volume[0]);
                          }
                          }

                          if (vdr[0] == MAX(vdr, lookback)[0]) //ChurnBar
                          {
                          if (Close[0] > Open[0])
                          {
                          bc += cc;
                          Values[6].Set(Volume[0]);
                          }
                          else
                          {
                          Values[7].Set(Volume[0]);
                          }
                          }

                          *********************************************
                          //cc += lookback;
                          //(cc += lookback(Volume [0]));
                          if (cc == 2) //ClimaxChurnBar (Volume, lookback)[0])
                          //cc += lookback;
                          {
                          //cc += lookback;

                          if (Close[0] > Open[0])
                          {
                          Values[8].Set(Volume[0]);
                          }
                          else
                          {
                          Values[9].Set(Volume[0]);
                          }
                          }
                          *********************************************

                          if (vdr[0] == MIN(vdr, lookback)[0]) //LowChurnBar
                          {
                          if (Close[0] > Open[0])
                          {
                          Values[10].Set(Volume[0]);
                          }
                          else
                          {
                          Values[11].Set(Volume[0]);
                          }
                          }
                          Attached Files

                          Comment


                            #28
                            Hey Rjay,

                            Thanks for the definition on EMA.

                            Comment


                              #29
                              I did a quick browse and saw a logical error in determining a lowbar. It returns true only if the volume is equal to the lowest of the last "lookback" bars.

                              The original code was:
                              if (v == MIN(Volume, lookback)[0]) //LowBar

                              It should return true if volume is "less than or equal" to:
                              if (v <= MIN(Volume, lookback)[0]) //LowBar

                              ======================


                              Originally posted by jupiejupe View Post
                              okay here's the issuse, all the colours are now working, aside from 2 which are a group (up & down for the same class of volume).

                              i have isolated the problem but have not the coding skills need to fix, it's funny how debugging code is much like debugging cnc machines, i can find the problem just do not know what to do once i get there.

                              here's the og logic: // i bold red is the line of code that had been isolated via the {} i have entered into the new code because it had to choose between "if & else". i believe now the chart does not know how to get the lookback period to colour code these bars.

                              og code:
                              {
                              double range, v = Volume[0];
                              if ( CurrentBar < 1)
                              {
                              range = High[0] - Low[0];
                              VolEMA.Set(v);
                              return;
                              }
                              range = useTrueRange ?
                              Math.Max(High[0], Close[1]) - Math.Min(Low[0], Close[1]) // use true range
                              : High[0] - Low[0]; // use normal range
                              VolEMA.Set(vwt * (v - VolEMA[1]) + VolEMA[1]); // faster than SMA

                              int cc = 0; // climax churn detection
                              int bc = 0; // bar color, default 0 (normal volume bar)

                              vxr.Set(v * range);
                              vdr.Set((range != 0.0) ? v / range : 0.0);
                              if (v == MIN(Volume, lookback)[0]) bc = 1; //LowBar;
                              if (vxr[0] == MAX(vxr, lookback)[0]) { bc = 2; ++cc; } //ClimaxBar
                              if (vdr[0] == MAX(vdr, lookback)[0]) { bc = 3; ++cc; } //ChurnBar
                              if (cc == 2) bc = 4; //ClimaxChurnBar;
                              if (vdr[0] == MIN(vdr, lookback)[0]) bc = 5; //LowChurnBar



                              so i have commented out some of the things i have tried to get the code to compile, and show the purple bars which or the climaxchurnbar up & down. i have been trying to get cc paired with lookback. this is beyond me as i have no coding skills just fumbling, if someone is kind hearted enough to spell it out, i am move than happy to suffer through attemping to figure it out. if someone is so generous as to get'er done i thank you now. as i'll start my next project.


                              new code:

                              {
                              if (Close[0] > Open[0])
                              Values[0].Set(Volume[0]);

                              else
                              Values[1].Set(Volume[0]);


                              double range, v = Volume[0];
                              if ( CurrentBar < 1)
                              {
                              range = High[0] - Low[0];
                              VolEMA.Set(v);
                              return;
                              }

                              range = useTrueRange ?
                              Math.Max(High[0], Close[1]) - Math.Min(Low[0], Close[1]) // use true range
                              : High[0] - Low[0]; // use normal range
                              VolEMA.Set(vwt * (v - VolEMA[1]) + VolEMA[1]); // faster than SMA

                              int cc = 0; // climax churn detection
                              int bc = 0; // bar color, default 0 (normal volume bar)

                              vxr.Set(v * range);
                              vdr.Set((range != 0.0) ? v / range : 0.0);

                              if (v == MIN(Volume, lookback)[0]) //LowBar
                              {
                              if (Close[0] > Open[0])
                              {
                              Values[2].Set(Volume[0]);
                              }
                              else
                              {
                              Values[3].Set(Volume[0]);
                              }
                              }

                              if (vxr[0] == MAX(vxr, lookback)[0]) //ClimaxBar
                              {
                              if (Close[0] > Open[0])
                              {
                              bc += cc;
                              Values[4].Set(Volume[0]);
                              }
                              else
                              {
                              Values[5].Set(Volume[0]);
                              }
                              }

                              if (vdr[0] == MAX(vdr, lookback)[0]) //ChurnBar
                              {
                              if (Close[0] > Open[0])
                              {
                              bc += cc;
                              Values[6].Set(Volume[0]);
                              }
                              else
                              {
                              Values[7].Set(Volume[0]);
                              }
                              }

                              *********************************************
                              //cc += lookback;
                              //(cc += lookback(Volume [0]));
                              if (cc == 2) //ClimaxChurnBar (Volume, lookback)[0])
                              //cc += lookback;
                              {
                              //cc += lookback;

                              if (Close[0] > Open[0])
                              {
                              Values[8].Set(Volume[0]);
                              }
                              else
                              {
                              Values[9].Set(Volume[0]);
                              }
                              }
                              *********************************************

                              if (vdr[0] == MIN(vdr, lookback)[0]) //LowChurnBar
                              {
                              if (Close[0] > Open[0])
                              {
                              Values[10].Set(Volume[0]);
                              }
                              else
                              {
                              Values[11].Set(Volume[0]);
                              }
                              }

                              Comment


                                #30
                                Can someone please post the final BetterVolumeUpDown version here as an attachment ?

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by cmarkb, Today, 12:04 AM
                                0 responses
                                2 views
                                0 likes
                                Last Post cmarkb
                                by cmarkb
                                 
                                Started by supernova0219, Yesterday, 07:48 PM
                                0 responses
                                6 views
                                0 likes
                                Last Post supernova0219  
                                Started by qwfxny, Yesterday, 07:20 PM
                                0 responses
                                7 views
                                0 likes
                                Last Post qwfxny
                                by qwfxny
                                 
                                Started by bouncetherubble, Yesterday, 04:48 PM
                                0 responses
                                5 views
                                0 likes
                                Last Post bouncetherubble  
                                Started by johnnybegoode, Yesterday, 11:35 AM
                                1 response
                                11 views
                                0 likes
                                Last Post NinjaTrader_ChrisL  
                                Working...
                                X